Skip to content
Advertisement

How to improve rectangles from image using opencv?

I’ve an input image like below :

enter image description here]

I did some processing and got lines from my input image as below Lined Image :

enter image description here

I want to have output with cell detected like this: Output Image

enter image description here

I tried to found cells Bounding box using findContours and connectedComponentsWithStats method but they’re not giving me a satisfying results.

My Code:

For Contours:

JavaScript

For connectedComponentsWithStats:

JavaScript

Any Help is appreciated.

Advertisement

Answer

JavaScript

result image that You want: Reference:

  1. How to detect all rectangular boxes python opencv without missing anything
  2. Unboxing opencv rectangles
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement