IMAGE PROCESSING
IMAGE PROCESSING
RESULTS :
Codes :
%reading
images
image=imread(image name)
moment00=0
moment01=0
moment10=0
%Sample image size : 660*613
for i=1:660
for j=1:613
% Depends on images 1
could be 255 or 250
etc.
if image(i,j)==1
moment00=moment00+i^0*j^0
moment10=moment10+i^1*j^0
moment01=moment01+i^0*j^1
end
end
end
%calculating center images
Centerx=moment10/moment00
Centery=moment01/moment00
moment11=0
moment20=0
moment02=0
for i=1: 660
for j=1: 613
if image(i,j)==1
moment11=moment11+(i-Centerx)^1*(j-Centery)^1
moment20=moment20+(i-Centerx)^2*(j-Centery)^0
moment02=moment02+(i-Centerx)^0*(j-Centery)^2
end
end
end
ShapeOrientation = (1/2)*atan(2*moment11/(moment20-moment02))
ShapeElongation
[x y]=find(img==1)
xMaxValue=max(x)
xMinValue=min(x)
yMaxValue=max(y)
yMinValue=min(y)
(xMaxValue-xMinValue)/(yMaxValue-yMinValue)
ElongationWithUsingCentralMoments
= (moment20+moment02-sqrt(4*moment11^2+(moment20-moment02)^2))/(moment20+moment02+sqrt(4*moment11^2+(moment20-moment02)^2))
ShapeCircularity
=1/(2*pi)*((moment00^2)/(moment20+moment02))
Yorumlar
Yorum Gönder