?? findtheta.m
字號:
function theta = FindTheta(img, x, y, CN)
theta = -1;
if (CN == 1)
% for ridge ending find the only other white pixel
for i=1:8
if (P(img, x, y, i) == 1)
% found only other pixel decide which angle
switch (i)
case {1, 9}
theta = 0;
case 2
theta = 45;
case 3
theta = 90;
case 4
theta = 135;
case 5
theta = 180;
case 6
theta = 225;
case 7
theta = 270;
case 8
theta = 315;
end % switch
end % if Pxyi = 1
end % for i
else
% ridge bijection, find single pixel on an axis
if (P(img, x, y, 1) & ~(P(img, x, y, 2) & P(img, x, y, 8)) )
theta = 0;
end
if (P(img, x, y, 2) & ~(P(img, x, y, 1) & P(img, x, y, 8) & P(img, x, y, 3) & P(img, x, y, 4)))
theta = 45;
end
if (P(img, x, y, 3)& ~(P(img, x, y, 2) & P(img, x, y, 4)))
theta = 90
end
if (P(img, x, y, 4)& ~ (P(img, x, y, 3) & P(img, x, y, 2) & P(img, x, y, 5) & P(img, x, y, 6)))
theta = 135;
end
if (P(img, x, y, 5) & ~ (P(img, x, y, 4) & P(img, x, y, 6)))
theta = 180;
end
if (P(img, x, y, 6) & ~ (P(img, x, y, 4) & P(img, x, y, 5) & P(img, x, y, 7) & P(img, x, y, 8)))
theta = 225;
end
if (P(img, x, y, 7) & ~ (P(img, x, y, 6) & P(img, x, y, 8)))
theta = 270;
end
if (P(img, x, y, 8) & ~ (P(img, x, y, 2) & P(img, x, y, 1) & P(img, x, y, 7) & P(img, x, y, 6)))
theta = 315;
end
end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -