How to Extract a certain Shape from Image
3 次查看(过去 30 天)
显示 更早的评论
I would like to distinguish between "background" pixels and the "orange plastic bag" pixels in order to manipulate those pixels (count, hist, etc).
I can't use indx = I(I ~= 1) because there are some white pixel inside the orange plastic bag.
Moreover, this bag is aligned but it might be rotate in other images.
Thanks.
1 个评论
Rakshit Kothari
2013-2-18
So what you basically need is some form of object recognition, am i correct? If you just need to extract the bag of chips, image segmentation using Otsu's method is probably what you need.
If you need recognition i suggest you read up on SIFT or SURF.
回答(2 个)
Walter Roberson
2013-2-18
convert to gray, threshold to select non-white, imfill() 'holes'. The result should be a mask you can use to select from the larger image.
2 个评论
Rakshit Kothari
2013-2-18
So what you basically need is some form of object recognition, am i correct? If you just need to extract the bag of chips, image segmentation using Otsu's method is probably what you need.
If you need recognition i suggest you read up on SIFT or SURF.
If its a quick thing that you are looking for, just invert the image, threshold and then use REGIONPROPS with filled holes option.
If you need the shape of the object:
Ratio = Area of Object/Area under bounding box
If Ratio is a reasonably high value, you object is a square or a rectangle. If its lower, its probably a triangle or circle.
1 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!