How to separate the object from the background from the image
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Tuck Wai Yip
el 9 de Mayo de 2021
Comentada: Image Analyst
el 15 de Mayo de 2021
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/612490/image.png)
These are the images sample that I requires to separate the object (in this case it is the letter 'A' ) with its background and store them for further processing so that it will form like this afterwards, which means I need to make the letter such that it could clearly seen the outline and the pixel occupied by it on the image pixels.
Note: it is sign language example.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/612495/image.png)
Hope that someone could guide me what to do next or example code. Thank you,
0 comentarios
Respuesta aceptada
Image Analyst
el 9 de Mayo de 2021
Try
background = grayImage == 255;
foreground = ~background;
3 comentarios
Image Analyst
el 15 de Mayo de 2021
I don't know what sauvola is, or means. Same for zeta.
The foreground and background are already saved into those variables. If you want them saved for after the loop, you can save them into a cell array or a 3-D array.
To count the number of "true" pixels in the thresholded images you can use nnz():
numForegroundPixels = nnz(foreground);
numBackgroundPixels = nnz(background);
Más respuestas (0)
Ver también
Categorías
Más información sobre Language Support en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!