object recognition
Annika from United States  [14 posts]
10 year
Hi Steven,

I'm continuing work on the pill bottle problem. I've successfully unwrapped the bottle labels with manual coordinate entry, but not I'm puzzling over how to detect the edges of the bottle as they are not necessarily the same size or distance from the camera in each image.

I've found the Center of Gravity module works well, so if I can set my crop parameters using COG_X +/- half the object width, I'm set. What's the best way to detect the object width? Some sort of edge detect, vertical lines, perhaps? I guess I'm just not sure how to isolate a single blob.

Let me know if I'm on the right track. I am guessing I don't need to go so far as feature detection since this project is relatively simple.

Steven Gentner from United States  [1446 posts] 10 year

The COG will detect the object but will not give you the bounds information that you need.

Are you able to create a solid background (ideally black) with respect to the images of the pill bottle? If so, this will make the next process much easier.

For example, using the default auto-threshold the first image appears as

which is exactly what we want. We can take this image and automatically do the bottle unwrap by finding its coordinates and radius (i.e. width). BUT the problem is that not all images have this nice property

is an example of when that doesn't work since the image includes some of the outside light through the window which causes the segmentation to fail. There are other ways around this which are more complex but the simplest is to put a black background behind the pill bottle which will eliminate this problem.

If you can do that, take a full set of new images we can then show you how to auto-configure everything.

If not, can you describe the environment a little more where this will be used?


Anonymous 10 year
Quick follow up question - Once I have an image that auto thresholds to isolate the label alone, which module can I use to detect the x-coordinates/radius for the bottle unwrap?
Steven Gentner from United States  [1446 posts] 10 year
Have a look at the attached. Uses the blob filter to remove smaller objects and create the needed center coordinate. It assumes the bottle is about the same distance from the camera. If not, you will need to change the radius parameter too based on the width of the detected object. That can be determined from the Geometric Statistics module.



This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index