# IMAGE PROCESSING

" Two roads diverged in a wood, and I,
I took the one less traveled by,
And that has made all the difference "-Robert Frost

### Identifying the objects based on count(bwlabel)

Identifying the objects based on labeling

Steps To Be Performed:

1. Convert the RGB image to binary image.
2. Fill the holes in the image.
3. Label the objects in the image based on connectivity 8
4. Display the images in a RGB format
4.1.  Store the co-ordinates(x,y) of the object 1 which is  labeled as 1.
4.2.  Calculate the image size for object one. The length can be found by subtracting the maximum and the minimum of y values. Similary for x find the width by subtracting the maximum and minimum of x values.
4.3.  Now map the pixel value to the new image.

 Original Image

figure,imshow(A);
title('Original image');
C=~im2bw(A);
B=imfill(C,'holes');
label=bwlabel(B,8);
for j=1:max(max(label))

[row, col] = find(label==j);

len=max(row)-min(row)+2;
sy=min(col)-1;
sx=min(row)-1;

for i=1:size(row,1)
x=row(i,1)-sx;
y=col(i,1)-sy;
target(x,y,:)=A(row(i,1),col(i,1),:);
end
mytitle=strcat('Object Number:',num2str(j));
figure,imshow(target);title(mytitle);
end

The objects that are displayed in a RGB format.

Like "IMAGE PROCESSING" page

Aaesha S said...

very nice :) keep posting :)

Kavita Deshpande said...

good for reference
keep posting........

Kavita Deshpande said...

Excellent

Balun Qui said...

thank you, this is great