1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | function [last_endpoint,last_bifurpoint] = my_direction_t(out_endpoint,out_bifurpoint,thin) Table=[3*pi/4, 2*pi/3, 7*pi/12, pi/2, 5*pi/12, pi/3, pi/4; 5*pi/6, 0, 0, 0, 0, 0, pi/6; 11*pi/12, 0, 0, 0, 0, 0, pi/12; pi, 0, 0, 0, 0, 0, 0; -11*pi/12, 0, 0, 0, 0, 0, -pi/12; -5*pi/6, 0, 0, 0, 0, 0, -pi/6; -3*pi/4, -2*pi/3, -7*pi/12, -pi/2, -5*pi/12, -pi/3, -pi/4]; last_endpoint = []; last_bifurpoint = []; CentroidTermX = out_endpoint(:,1); CentroidTermY = out_endpoint(:,2); CentroidBifX = out_bifurpoint(:,1); CentroidBifY = out_bifurpoint(:,2); OrientationTerm = []; for ind = 1:length(CentroidTermX) klocal=thin(CentroidTermX(ind)-3:CentroidTermX(ind)+3,CentroidTermY(ind)-3:CentroidTermY(ind)+3); klocal(2:end-1,2:end-1)=1; [i,j]=find(klocal==0); if length(i)~=1 continue end OrientationTerm=[OrientationTerm;Table(i,j)]; last_endpoint = [last_endpoint;[CentroidTermX(ind),CentroidTermY(ind),1,Table(i,j)]]; end dyTerm = sin(OrientationTerm)*5; dxTerm = cos(OrientationTerm)*5; OrientationTerm2 = []; for ind = 1:length(CentroidBifX) klocal2=thin(CentroidBifX(ind)-3:CentroidBifX(ind)+3,CentroidBifY(ind)-3:CentroidBifY(ind)+3); klocal2(2:end-1,2:end-1)=1; [i,j]=find(klocal2==0); if length(i)~=3 continue end a1=Table(i(1),j(1)); a2=Table(i(2),j(2)); a3=Table(i(3),j(3)); b1=abs(a1-a2); b2=abs(a2-a3); b3=abs(a3-a1); if b1>=pi b1 = 2*pi-b1; end if b2>=pi b2 = 2*pi-b2; end if b3>=pi b3 = 2*pi-b3; end if (b1<=b2)&&(b1<=b3) OrientationTerm2 = [OrientationTerm2;a3]; last_bifurpoint = [last_bifurpoint;[CentroidBifX(ind),CentroidBifY(ind),2,a3]]; elseif (b2<=b1)&&(b2<=b3) OrientationTerm2 = [OrientationTerm2;a1]; last_bifurpoint = [last_bifurpoint;[CentroidBifX(ind),CentroidBifY(ind),2,a1]]; elseif (b3<=b1)&&(b3<=b2) OrientationTerm2 = [OrientationTerm2;a2]; last_bifurpoint = [last_bifurpoint;[CentroidBifX(ind),CentroidBifY(ind),2,a2]]; end end dyTerm2 = sin(OrientationTerm2)*5; dxTerm2 = cos(OrientationTerm2)*5; CentTermX = last_endpoint(:,1); CentTermY = last_endpoint(:,2); CentBifX = last_bifurpoint(:,1); CentBifY = last_bifurpoint(:,2); % figure % imshow(thin) % hold on % plot(CentBifY,CentBifX,'bo','linewidth',2) % plot([CentBifY CentBifY+dxTerm2]',[CentBifX CentBifX-dyTerm2]','b','linewidth',2) % hold on % plot(CentTermY,CentTermX,'ro','linewidth',2) % plot([CentTermY CentTermY+dxTerm]',[CentTermX CentTermX-dyTerm]','r','linewidth',2) end | cs |
'정보 보안 > 지문 & 홍채인식 프로젝트' 카테고리의 다른 글
match 함수 - 지문인식 (0) | 2020.02.05 |
---|---|
minutiae_ext 함수 - 지문인식 (0) | 2020.02.05 |
toIdx 함수 - 지문인식 (0) | 2020.02.05 |
totheta 함수 - 지문인식 (0) | 2020.02.05 |
alignment 함수 - 지문인식 (0) | 2020.02.05 |