Image detect and convert white image
1 回表示 (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015930/image.png)
I want to convert like this,,,, detect image and convert in to whole white, because i have to count white pixels
0 件のコメント
回答 (3 件)
Walter Roberson
2022 年 5 月 30 日
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png';
img = imread(filename);
negmask = all(img > 240, 3);
mask = ~bwareafilt(negmask, 1);
imshow(mask)
area = nnz(mask)
1 件のコメント
Walter Roberson
2022 年 5 月 30 日
The 240 that I chose was arbitrary. When I filtered for any component < 240, a small number of small dots were left near the lower right of the object. The bwareafilt is used to select just the largest area, discarding the small dots.
KSSV
2022 年 5 月 30 日
I = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1015935/test.png') ;
I1 = rgb2gray(I) ;
I2 = ~imbinarize(I1) ;
imshow(I2)
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!