0

I have been trying Python+OpenCV for quite long time already and followed many tutorials in order to identify particles in the following image:

Particles

My ultimate goal is to identify every particle, from there I will be able to e.g. count number of particles, calculate a size distribution, etc.

I have already tried to customize many examples several sites. I got good hints based on:

  1. How to define the markers for Watershed in OpenCV?
  2. Counting particles using image processing in python

Although I was not able to achieve decent results.

How can I identify particles in this image using Python and OpenCV?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
tburd
  • 71
  • 2
  • 9
  • This is a very hard problem and you will not get a perfect result. Even with a perfect segmentation, you will not be able to get the sizes of the particles that are partially visible, only a relatively small fraction is fully visible. And of the particles that are fully visible, you don't know what their 3D shape is, so any size measurement will be inaccurate at best. :( – Cris Luengo Feb 28 '19 at 22:14
  • I doubt that this is possible at all: Even a human might be unsure, which of the partially visible particles in the dark spots are individual particles again. Thus the result would be strongly subjective. How would one formulate an algorithmic rule for the decision to be taken by a computer? Maybe, the problem as such is ill-posed: With the large dynamic range of particle sizes, each large particle could hide 5 or more smaller particles below. Thus: How reliable can even only a particle count be? – dasmy Feb 28 '19 at 22:27
  • @CrisLuengo and dasmy thank you very much for your comments. I totally understand and agree with your explanation. Although I would like to mention that doing a 2D evaluation and getting just the visible area of the particles from the "surface" should be fairly enough for this exercise that I am working on. Any suggestions on the best way to move forward? Best regards! – tburd Feb 28 '19 at 23:28
  • This problem is instance segmentation and can be solved by MASK R-CNN. But it's a long and hard way... – Nuzhny Mar 01 '19 at 10:23
  • I really tried to move forwards with MASK R-CNN, but I was not able to get it working. Any one with another suggestion? – tburd Apr 28 '19 at 09:36

2 Answers2

0

IMO, the only hope to get meaningful results is to use the fact that the particles are round. By using some homogeneity criterion, you could find candidate particle centers, and from these grow contours in such a way that they remain round and stop at edges. An option could be to draw rays from the seed point, find the closest edge points and use a robust fit of a circle or an ellipse.

Reject the shapes that are too far from roundness. This should allow you to find the unoccluded particles. Then you can continue the game from other seed points, this time growing contours that can be occluded by the already detected particles. (When an edge is hit, if it is known to belong to a particle, ignore it.)

  • thnks for the input. I tried to follow your suggestions but I was not really able to do what you mentioned. Do you know some tutorials that could support me? Thank you very much – tburd Apr 28 '19 at 09:37
0

Let's pretend the goal is to get an estimated number of particles. Also, let's assume those particles are spheres.

With that being said it should be possible to build a model, based on highlight, shadow, halftone to make the final result as accurate as it can be.

With that being said a simple proof of the concept based on highlight segmentation can be verified.

enter image description here

Initial result doesn't seem to be promising, but a tiny change of the contrast improves it:

enter image description here

Should be enough to get estimated number of stones and apply more advanced models for identified regions.

enter image description here

Renat Gilmanov
  • 17,735
  • 5
  • 39
  • 56
  • Sorry, no code to share, I used home-grown video processing tool (here are some examples: https://www.youtube.com/channel/UCLsVHuYpywKFNAHKFfImIVg/videos) – Renat Gilmanov Oct 24 '19 at 07:02