Ask Your Question
0

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

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

samurex gravatar image

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

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, https://github.com/peterbraden/node-o... I ask my question here, becouse this is much bigger community!

edit retag flag offensive close merge delete

Comments

Hi, its actually not alawys solid, here is another example: http://i.imgur.com/P6jyPNO.jpg my output (look at jeans) http://i.imgur.com/dOP2D2Y.png

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

1 answer

Sort by ยป oldest newest most voted
0

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

strann gravatar image

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

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

2 followers

Stats

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

Seen: 697 times

Last updated: Feb 22 '16