Image detect and convert white image

I want to convert like this,,,, detect image and convert in to whole white, because i have to count white pixels

답변 (3개)

Walter Roberson
Walter Roberson 2022년 5월 30일

1 개 추천

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)
area = 173456

댓글 수: 1

Walter Roberson
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
KSSV 2022년 5월 30일

0 개 추천

I = imread('https://in.mathworks.com/matlabcentral/answers/uploaded_files/1015935/test.png') ;
I1 = rgb2gray(I) ;
I2 = ~imbinarize(I1) ;
imshow(I2)
Matt J
Matt J 2022년 5월 30일
편집: Matt J 2022년 5월 30일

0 개 추천

A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png');
imshow(any(250-A,3))

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

질문:

2022년 5월 30일

댓글:

2022년 5월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by