object recognition using morphological filters

13 次查看(过去 30 天)
Somehow I have to detect the rectangular components at the bottom right of the image:
The result should look something like this:
I though opening by reconstructing is a good start then I have no clue what to do.
Any help is appreciated
  2 个评论
KALYAN ACHARJYA
KALYAN ACHARJYA 2021-1-3
More specific please, if you want help, then you need to make it easy to be helped.
Remi MOrre
Remi MOrre 2021-1-3
I have to detect the objects just like shown in image b

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2021-1-3
Why not just subtract with imabsdiff()?
diffImage = imabsdiff(image1, image2);
bigDifferences = diffImage > 5; % Or whatever.
% Get rid of blobs less than 3 pixels in area
bigDifferences = bwareaopen(bigDifferences, 3); % This is a morphological operation
imshow(bigDifferences, []);
  8 个评论
Remi MOrre
Remi MOrre 2021-1-5
编辑:Remi MOrre 2021-1-5
Ok thanks man you were very helpful. by the way I was able to detect the objects by applyaing erosion followed by thresholding fowllowed by opening the image.
Image Analyst
Image Analyst 2021-1-5
Yes, like I said, if your definition of an object is something bright, you can find it by thresholding. You can find a full demo in my Image Segmentation Tutorial in my File Exchange.
An erosion does a local minimum operation, so that will make things darker and shrink the bright blobs, possibly making the smaller blobs disappear so that only larger bright blobs remain. Then you thresholded which gave you a binary image of those larger bright blobs. An opening is an erosion followed by a dilation so that makes the binary blobs smaller and then enlarges them again to their original size, roughly. What it does is to smooth out the black parts of the image by getting rid of the small blobs and snipping off any "tendrils" or "peninsulas" that may poke out of the bright blobs. It may potentially separate blobs into more blobs so you may want to call bwareaopen() or bwareafilt() after that. I'm not sure the erosion at the very beginning is really necessary, but whatever -- as long as it works and you're happy with the result.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by