How to separate the object from the background from the image

8 次查看(过去 30 天)
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.
Hope that someone could guide me what to do next or example code. Thank you,

采纳的回答

Image Analyst
Image Analyst 2021-5-9
Try
background = grayImage == 255;
foreground = ~background;
  3 个评论
Tuck Wai Yip
Tuck Wai Yip 2021-5-15
It is because I need to compare the pixels detected by the thresholding algorithm, Sauvola for next step and calculate the (pixel detected by sauvola algorithm)/ (original pixel of A) for the zeta.
Image Analyst
Image Analyst 2021-5-15
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);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Language Support 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by