Ask Your Question

findContours when image is cut off (part of the object in the image)

asked 2016-02-22 10:08:19 -0500

samurex gravatar image

updated 2016-02-22 11:27:55 -0500

I have the following image (many immages of that kind, backgroud vary from image to image, might be dark, or light)

image description image description

i use canny, then dilate, then I find largest contour with findContours and drawContour (CV_FILLED). This is my result:

image description image description

the problem is that there is only part of the object in the image (part of the leg), and it seems that in the place where the photo is cut, contour is not closed. How i can somehow close the contour where the image is cut ?

Im not publishing my code here becouse i use binding for node, I ask my question here, becouse this is much bigger community!

edit retag flag offensive close merge delete


Hi, its actually not alawys solid, here is another example: my output (look at jeans)

samurex gravatar imagesamurex ( 2016-02-22 10:52:14 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-02-22 10:48:10 -0500

strann gravatar image

updated 2016-02-22 10:50:49 -0500

I'm not sure if it's a good solution, but if the background is always solid, you could try using Otsu's binarization method but using histogram with less than 256 bins. Here's the result I got using histogram with 16 bins

Otsu's binarization

edit flag offensive delete link more

Question Tools



Asked: 2016-02-22 10:08:19 -0500

Seen: 459 times

Last updated: Feb 22 '16