0% found this document useful (0 votes)
7 views12 pages

Image Analysis Segmentation

Uploaded by

razay678
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views12 pages

Image Analysis Segmentation

Uploaded by

razay678
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

IMAGE ANALYSIS: SEGMENTATION

INSTRUCTOR: AZKA MIR


IMAGE SEGMENTATION
WHY IS IT NECESSARY?
PRINCIPLE APPROACHES
THRESHOLDING
SEGMENTATION- THRESHOLDING

 %load image
 %declare threshold values
 Image=imread(“[Link]”)
 thresholdValue=0.3
 Cracked_image= image > threshold;
 Imshow(Cracked_image)
MULTI-LEVEL THRESHOLDING

 boneThreshold = 0.4
 tissueThreshold = 0.2;
 bone = zeros(size(image));
 tissue = zeros(size(img));
 background = zeros(size(image));
 bone(image>= boneThreshold) = 1;
 tissue((image< boneThreshold) & (image >= tissueThreshold)) = 1;
 background(image < tissueThreshold) = 1;
EDGE DETECTION (VERTICAL)

Img=imread(“[Link]”);
copied=Img;
mask=[1, 0, -1;1, 0, -1;1, 0, -1];

%Rotate image by 180 degree first flip up to down then left to right
mask=flipud(mask);
mask=fliplr(mask);
for r=2:size(Img, 1)-1
for c=2:size(I, 2)-1
N_matrix=mask.*copied(r-1:r+1, c-1:c+1);
avg=sum(N_matrix(:));
Img(r, c)=avg;
end
End;
imshow(Img)
SOBEL OPERATOR

 maskAlongX=[-1 0 1; -2 0 2; -1 0 1];
 maskAlongY=[-1 -2 -1; 0 0 0; 1 2 1];
 [r,c]=size(image);
 Gradient_image=zeros(r,c);
 for i=2:r-1
 for j=2:c-1
 Gradient_along_X=sum(sum(maskAlongX.*image(i-1:i+1,j-1:j+1)));
 Gradient_along_Y=sum(sum(maskAlongY.*image(i-1:i+1,j-1:j+1)));
 Gradient_image(i,j)=sqrt(Gradient_along_ X^2+ Gradient_along_ Y^2);
 end
 end
PREWITT OPERATOR
 maskAlongX=[-1 0 1; -1 0 1; -1 0 1];
 maskAlongY=[-1 -1 -1; 0 0 0; 1 1 1];
 [r,c]=size(image);
 Gradient_image=zeros(r,c);
 for i=2:r-1
 for j=2:c-1
 Gradient_along_X=sum(sum(maskAlongX.*image(i-1:i+1,j-1:j+1)));
 Gradient_along_Y=sum(sum(maskAlongY.*image(i-1:i+1,j-1:j+1)));
 Gradient_image(i,j)=sqrt(Gradient_along_ X^2+ Gradient_along_ Y^2);
 End
 End
 prewittG=(prewittG/max(prewittG(:)))*255;
THE END

You might also like