How to detect an absent object from a mask image and remove it on the original image?
2 次查看(过去 30 天)
显示 更早的评论
This is the binary image of the original image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164110/image.bmp)
While, this is the 'masked' image:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/164112/image.bmp)
I extracted the center part of the blob as part of my segmentation process.
As pointed by the grey-ish arrow, one of the blob in the masked image is removed.
May I know how can I make the original image detect the absence of that blob in the masked image hence removing the whole blob in the original image?
I am thinking of using bwconncomp but I don't know how to start.
Please lend me a hand. Your assistance is very much appreciated!
(I am using R2013a version)
0 个评论
回答(1 个)
Alessandro Masullo
2016-5-20
I don't know what are your general conditions and I assume your images are always slightly different from each other and every blob is distinct (not overlapping with others).
With these assumptions, I would use bwboundaries to detect the objects first, then I would cycle over the set of objects and I would detect for each of them the centroid, using regionprops. Once you have the centroid in both your images, you can use uniquetol to find duplicates (and so the absence) of some blobs within a certain tolerance.
A different approach could also be evaluating the difference between the two binary images, look for boundaries again with bwboundaries, evaluate the area of each element with regionprops and then select only those areas with an area bigger than a threshold (your minimum blob area).
In both cases, you can then use the pixel coordinates of bwboundaries to delete the detected blob from the original image.
I hope this helps,
Alessandro
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Segmentation and Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!