Borrar filtros
Borrar filtros

Image detect and convert white image

1 visualización (últimos 30 días)
윤주 황
윤주 황 el 30 de Mayo de 2022
Comentada: Walter Roberson el 30 de Mayo de 2022
I want to convert like this,,,, detect image and convert in to whole white, because i have to count white pixels

Respuestas (3)

Walter Roberson
Walter Roberson el 30 de Mayo de 2022
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 comentario
Walter Roberson
Walter Roberson el 30 de Mayo de 2022
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.

Iniciar sesión para comentar.


KSSV
KSSV el 30 de Mayo de 2022
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 el 30 de Mayo de 2022
Editada: Matt J el 30 de Mayo de 2022
A=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1015940/image.png');
imshow(any(250-A,3))

Community Treasure Hunt

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

Start Hunting!

Translated by