Merge contours from image [closed]

asked 2016-09-22 07:35:06 -0600

Morten Gryning gravatar image

My task is to detect shapes on a whiteboard. So far, I have used blur, morphology, edge canny detection and then the findcontour function. I think that the output looks quite look, but the issue i'm facing is that the contours are not "whole". The below image show the original image with the contours displayed.

image description

What I would like is to somehow merge the contours for each rectangle. and discard the contours for the text. Preferably, I would like something like the below image

image description

When looking around the net, people suggest using more morphology (with morph closed on the image) to get more consistent boxes. But I can't really get it to work. Is there a standardized way to archive the desired output, or should I do some calculations myself to see if I can merge the contours? What would you do from here?

I tried with ApproxPolyDP, but since the contours are not "whole" the area returned is very small.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-10-22 14:57:26.113785

Comments

Hello, I was wondering if you ever found a solution to your problem, i'm facing the same thing and even though i tried closing the contours by using the dilate function it didn't give me the output that i was hoping for.

Safa gravatar imageSafa ( 2018-05-03 10:36:34 -0600 )edit