Ask Your Question

i used canny function to detect the contour in my android app but i would now to fill the inside of the forms to treat the image easely.

asked 2016-03-10 11:51:41 -0500

nadia gravatar image

updated 2016-03-11 13:46:25 -0500

image description

image description

edit retag flag offensive close merge delete


please post the original image

sturkmen gravatar imagesturkmen ( 2016-03-10 16:58:20 -0500 )edit

I post the original image .I would find image contours and fill the contours to make the picture more clear

nadia gravatar imagenadia ( 2016-03-11 04:38:56 -0500 )edit

You can try to use cv::adaptiveThreshold() instead of cv:Canny. Or you can try cv::niBlackThreshold() from the ximgproc in contrib modules. Here I have posted some other statistical thresholds you can try (you have to scroll down).

Here is an actual link to the paper.

matman gravatar imagematman ( 2016-03-11 11:06:45 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-03-10 15:31:58 -0500

  1. use find contour to get the contour of each letter.
  2. then draw contour() using thickness -1
edit flag offensive delete link more


I don't like just to find contours but i would to fill the inside of contours with white color .i find the Floodfill function is it useful for me in this case?

nadia gravatar imagenadia ( 2016-03-10 15:59:50 -0500 )edit

when you put thickness -1 it will fill every contour for you. i have never use floodfill, so you should give it a try

Adams30 gravatar imageAdams30 ( 2016-03-10 16:19:20 -0500 )edit

I tried thickness -1 I test it with some formes that i draw and it works really but it doen't work efficiently in my picture case because the contours aren't very clear .Have you an other solution which help me?

nadia gravatar imagenadia ( 2016-03-11 07:07:42 -0500 )edit

I think the problem here is, that cv:Canny will leave a lot of open edges, because of "non maxima suppression". So you can't fill these contours in a satisfactory way. A method to avoid this problem is to blur your image in the first step with cv::GaussianBlur or cv::blur. Than use cv::Sobel or cv::Laplacian and finally use a cv::threshold

matman gravatar imagematman ( 2016-03-11 12:08:59 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-03-10 11:51:41 -0500

Seen: 550 times

Last updated: Mar 11 '16