Hello, can anyone help me how to find the only whitepixels that mushrooms occupied in given image??
3 views (last 30 days)
g = rgb2gray(I);
By using this code i am getting All no of whitepixels in an image but i only want whitepixels of mushrooms that occupied in an image
Pratyush Roy on 30 Sep 2021
As per my understanding you want to find onl the white pixels in the image of the mushroom.
As a workaround, you can try using the imerode function to remove small white patches after binarizing the image with imbinarize. The following code snippet demonstrates the use of bith these functions:
im1 = imread('mushroom.jpeg');
gray_image = rgb2gray(im1);
bw_image = imbinarize(gray_image);
se = strel('line',11,90);
erodedBW = imerode(bw_image,se);
Hope this helps!