I have an image which looks like this:
I have a task in which I should circle all the bottles around their opening. I created a simple algorithm and started working it. My algorithm follows:
I did according to the algorithm above and but I have some portion of the image around which I draw a circle. This is because I have selected the area since the area of the mouth of bottle and the remained noise is almost same. And so I yielded a figure like this.
The processing applied on the image look like this:
And my final image after plotting the circle over the original image is like this:
I think I can deal with the extra circle, that is, because of some white portion of the image remained as shown in the figure 2 below. This can be filtered out using regionproping for eccentricity. Is that a good idea or there are some other approaches to this? How would I deal with other bottles behind the glass and select them?
Image types determine how MATLAB® interprets data matrix elements as pixel intensity values. The toolbox supports many image types including binary, grayscale, truecolor, multispectral, and label images.
Description. centers = imfindcircles( A , radius ) finds the circles in image A whose radii are approximately equal to radius . The output, centers , is a two-column matrix containing the (x,y) coordinates of the circle centers in the image.
bwareafilt returns a binary image BW2 containing only those objects that meet the criteria. example. BW2 = bwareafilt( BW , n ) keeps the n largest objects. In the event of a tie for n -th place, only the first n objects are included in BW2 .
Nice example images you provide for your question!
One thing you can use to detect the remaining bottles (if there are any) is the well defined structure of the placement of the bottles. The 4 by 5 grid of the bottle should be relatively easy to locate, and when the grid is located you can test if a bottle is detected at each expected bottle location.
With respect to the extra detected bottle, you can use shape features like
If you are able to detect the grid, it should be easy to located it as an outlier (far from an expected bottle location) and discard accordingly.
Good luck with your project!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With