Image Processing Reference
In-Depth Information
while i<w & n~=-1
i=i+1;
[qx,qy]=NextPixel(p(1),p(2),n);
p=[qx,qy];
Rchain=[Rchain;p];
m=rem(n+4,8);
if(Next(p(2),p(1),1)~=-1 & Next(p(2),p(1),1)~=m)
n=Next(p(2),p(1),1);
elseif Next(p(2),p(1),2)~=m
n=Next(p(2),p(1),2);
else
n=-1;
end
end
%Mean Squares
st2=0; st3=0; st4=0;sxt=0; sxt2=0; syt2=0; syt2=0;
[n,m]=size(Lchain);
for t=1:n
st2=st2+t*t;st3=st3+t^3; st4=st4+t^4;
sxt=sxt+(Lchain(t,1)-x)*t; syt=syt+(Lchain(t,2)-y)*t;
sxt2=sxt2+(Lchain(t,1)-x)*t*t; syt2=syt2+(Lchain(t,2)-y)*t*t;
end
[n,m]=size(Rchain);
for t=1;n
st2=st2+t*t; st3=st3-t^3; st4=st4+t^4;
sxt=sxt-(Rchain(t,1)-x)*t; syt=syt-(Rchain(t,2)-y)*t;
sxt2=sxt2+(Rchain(t,1)-x)*t*t; syt2=syt2+ (Rchain(t,2)-y)*t*t;
end
if((st2*st4-st3*st3)~=0)
bx=(sxt*st4-sxt2*st3)/(st2*st4-st3*st3);
by=(syt*st4-syt2*st3)/(st2*st4-st3*st3);
cx=(st2*sxt2-st3*sxt)/(st2*st4-st3*st3);
cy=(st2*syt2-st3*syt)/(st2*st4-st3*st3);
d=sqrt((bx*bx+ by*by)^3);
if(d~=0)
d=abs(2*(cy*bx-cx*by)/d);
outputimage(y,x)=d;
end
end
end
end
Code 4.17
Curvature by curve fitting
The main problem with this approach is that it depends on the extraction of sequences
of pixels. In some cases it is very difficult to trace a digital curve in the image. This is
because noise in the data can cause edges to be missed or to be found inaccurately. This
problem may be handled by using a robust fitting technique. However, the implementation
Search WWH ::




Custom Search