landmarks.m - getLandmarks function[marks]= landmarks(path Im = rgb2gray(imread(path Im=edge(Im'canny%extract edge points= curNum=1 get all contour

landmarks.m - getLandmarks function[marks]= landmarks(path...

This preview shows page 1 - 2 out of 2 pages.

%% getLandmarks function [marks]= landmarks(path) Im = rgb2gray(imread(path)); Im=edge(Im,'canny'); %extract edge points=[]; curNum=1; %% get all contour points clockwise while size(points,1)<100 [i,j] = find(Im); numPoints=size(i,1); currentR=i(1,1); currentC=j(1,1); points=zeros(numPoints,2); while isempty(getpoint(Im,currentR,currentC))==0 [nextpoints]=getpoint(Im,currentR,currentC); points(curNum,:)=[nextpoints(1),nextpoints(2)]; curNum=curNum+1; for i=-1:1 Im(currentR+i,currentC-1)=0; Im(currentR+i,currentC) =0; Im(currentR+i,currentC+1)=0; end currentR=nextpoints(1); currentC=nextpoints(2); end end %% select landmarks d1=floor(size(points,1)/100); d2=d1+1; d3=floor((size(points,1)-d1*100)/10); marks=[]; index=0; for i=1:10 for j=1:10-d3 index=index+d1; marks=[marks;points(index,:)]; end for j=1:d3
Image of page 1

Subscribe to view the full document.

Image of page 2

Unformatted text preview: index=index+d2; marks=[marks;points(index,:)]; end end %% eight coordiates scanning method function [nextpoints]=getpoint(Im,currentR,currentC) nextpoints=; if Im(currentR,currentC-1)==1 nextpoints=[currentR,currentC-1]; end if Im(currentR+1,currentC)==1 nextpoints=[currentR+1,currentC]; end if Im(currentR,currentC+1)==1 nextpoints=[currentR,currentC+1]; end if Im(currentR-1,currentC)==1 nextpoints=[currentR-1,currentC]; end if Im(currentR-1,currentC-1)==1 nextpoints=[currentR-1,currentC-1]; end if Im(currentR+1,currentC-1)==1 nextpoints=[currentR+1,currentC-1]; end if Im(currentR+1,currentC+1)==1 nextpoints=[currentR+1,currentC+1]; end if Im(currentR-1,currentC+1)==1 nextpoints=[currentR-1,currentC+1]; end end end...
View Full Document

  • Fall '17
  • Alexiander

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes