how to detect and count pills (capsules)

Which algorithm is use full to detect pills and capsules. And after detection count the number of capsules on the table using opencv android.

edit retag close merge delete

1

First of all, before people start suggesting approaches, are these images examples of the cases this is going to be used on? These seem as google grabbed examples, whereas computer vision problems depend A LOT on the actual situation, so providing examples that will need the algorithm to work on, will be much better.

( 2014-07-23 03:36:37 -0500 )edit

How to detect capsules from image using opencv android ? Just now i am using generalize Hough transform algorithm to detect capsules

( 2014-07-23 04:11:55 -0500 )edit
1

( 2014-07-23 04:35:12 -0500 )edit

These images are from google. But in my criteria 5 to 10 capsule on table and user start app camera and count the capsules. like i have 10 live capsules on table and count it

( 2014-07-23 04:54:10 -0500 )edit

background is white(normal no another item at background) and light is appropriate for detect. it's depend on shape(cylinder shape)

( 2014-07-23 05:14:41 -0500 )edit

Then please add pictures that represent your problem. If I describe a solution for these images, which are quite difficult, then it will never work for you ...

( 2014-07-23 05:53:19 -0500 )edit

Hello StevenPuttemans i upload images please check and give solution how to detect all pills using opencv android

( 2014-07-29 01:25:54 -0500 )edit

I do not provide copy paste solutions. I will think about some guidelines and get back to you.

( 2014-07-30 03:42:26 -0500 )edit

ok i am also think on it and you get then update me . Thank you....

( 2014-07-30 23:44:21 -0500 )edit

Sort by ยป oldest newest most voted

Since I am not a favorite of providing of the shelf solutions but rather insights on how to tackle this problem, I will try to explain how I would go ahead with this problem.

1. Perform a grayscaling and histogram equilization of the input image.
2. Perform a thresholding on the image, based on the background color range to retrieve a binary blob image.
3. Since the binary image will also contain the lines on the paper (no way of avoiding lines but keeping black pills) I would perform a erosion operator on the image then a dilation to grow the pill regions back.
4. You will now have blobs that perfectly describe regions of pills.
5. You are now able to perform a contours finding function, resulting in the amount of pills inside the image.
6. If preferred you could set a region of interest to the seperate pills and use a classifier to decide which kind of pill you are dealing with.
more