Info
此问题已关闭。 请重新打开它进行编辑或回答。
How can I convert this image in binary image such that region inside red curve is filled with white while rest with black?
1 次查看(过去 30 天)
显示 更早的评论
How can I convert this image in binary image such that region inside red curve is filled with white while rest with black? I have around 900 images like this so free hand drawing will be very lengthy. So is there any other way of doing it...maybe by setting some threshold?
0 个评论
回答(1 个)
Adam Wyatt
2020-9-9
Your question is quite vague and the methodology and results depend very much on how the images vary.
Remember that the computer will have no concept of how you decide where to draw that boundary, so you need to come up with some criterion on how to do that. If you have the image processing toolbox, that has many functions that can help you to create a mask from an image.
Assuming that using a threshold will suffice - i.e. all points within the enclosed region are above threshold and outside are below, you can create a mask in 1 line:
mask = (ImgArray>threshold_value);
However, you are likely going to be required to pre-process the data. The most likely is to perform smoothing using e.g. imfilter or filter2 You may then also need to refine the mask - for example by only taking connected points (image processing toolbox will be your friend). A little trick you can use is to smooth the mask and then threshold that - this can help get rid of any holes and create a little extra padding.
If you don't have the toolbox, it is still possible to find the continous region, but it will be slow (I do have a function to do that).
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!