2

So, I have the following Image

enter image description here

I want to detect the white lump in that image ignoring the thin white line. I need help with the approach that I can use to detect it with OpenCV python.

Please help, I don't want the code but need a direction on how to go about it.

Thank you

Dhiraj kadam
  • 377
  • 3
  • 15
  • 3
    An initial approach could be to use morphological operations to remove some of the "white line" noise in the image. This can be followed by connected component analysis with some size threshold to isolate the blobs. – Pankaj Daga Aug 16 '18 at 08:53
  • 1
    As Pankaj suggested, an opening with a small structuring element should get rid of the line. – Cris Luengo Aug 16 '18 at 08:59
  • Thank you so much @pankaj and Cris. I used Erosion and it did the job of removing noise my next task is to somehow detect the lump and print a text. Any suggestion for the same? – Dhiraj kadam Aug 16 '18 at 09:13

1 Answers1

3

I suggest the following solution:

  1. Make it binary.

  2. Perform opening morphological transformation.

  • I used Erosion from morphological transformation and it worked pretty well, Now I want to figure out how to detect the lump and print a text based on it. I'm confused on this bit. – Dhiraj kadam Aug 16 '18 at 09:15
  • Erosion erodes away boundaries. If it is no problem for you than proceed with erosion. However, if (for some reason) shape of detected lump is important, then opening is better option. [Here](https://stackoverflow.com/questions/22805349/how-to-detect-white-blobs-using-opencv) you can find the code that may be interesting for you. – Slawomir Orlowski Aug 16 '18 at 09:32
  • Thank you for the help, Yes Opening worked better than Erosion. – Dhiraj kadam Aug 16 '18 at 10:03