Counting tablets

asked 2019-03-25 23:41:04 -0600

KansaiRobot gravatar image

updated 2019-03-25 23:42:57 -0600

I have developed a pill counter. It uses something similar to this tutorial and to this tutorial

However (as the next step) I want to count also tablets such as: The problem

Although the segmentation process is a bit complicated (because of the semi-transparency of the tablets) I have managed to get this

segmented

My problem is here. How can I count the elongated tablets, separating each one from the image, similar to the final results in the linked tutorials? I would appreciate if someone can help me to find a solution. So far I have applied distance transform, then smooth it with a Gaussian filter and then watershed and I got

failed

As you can see, it does not work well, specially for adjacent tablets.

The solution does have to work for this image and also for other arrangements of the tablets, the most difficult being for example

problem2

Thank you very much for any pointer or help on how to solve this problem. (My project has to address more complicated problems too, but would like to start with this)

edit retag flag offensive close merge delete

Comments

really interesting topic. I'm thinking if some iterative closest point methods can handle this or not.

gino0717 gravatar imagegino0717 ( 2019-04-01 20:55:18 -0600 )edit

Could you specify one example of these methods so that I can investigate further from there?

KansaiRobot gravatar imageKansaiRobot ( 2019-04-03 00:40:46 -0600 )edit

don't know if it work or not, I just thinking if you can use some template of points from a single pill and match it one by one like https://github.com/abreheret/icp-opencv

It is common in biological image that the objects may be in any angle and may overlap , I'm surprising that there are so few of rotation invariant algortihm can doing fine job in these issue after doing a little survey .

gino0717 gravatar imagegino0717 ( 2019-04-03 03:18:51 -0600 )edit