Reputation: 1576
I want to convert the particular white region of the image to black.
in the above image apart from eye portion what ever is white i want to turnit to black. How can I achieve that in Matlab 2016a.
Upvotes: 0
Views: 64
Reputation: 726
I am sure there are lots of ways doing this. Connected component analysis, morphological operations etc. However, in your case you are trying to find the regions that contain left and right sides of the image. So just select those regions with bwselect and replace the pixels with zeros.
im=imread('eye.png');
[n,m]=size(im);
im2=im;
im2(bwselect(im,1,1))=0;
im2(bwselect(im2,m,n))=0;
figure,imagesc(im2),axis image;colormap gray
Upvotes: 1