0

I'm working on an iOS app with OpenCV. I am trying to locate the position of the box around the person. I would like to start by getting the width of the box.

I'm converting the image to Greyscale and then using a Canny edge detector.

Link to image here http://s18.postimg.org/bbpczub2x/sampleshot.png

What would be the best way to get the coordinates of the extreme horizontal ends of the box (marked by the red in the picture)? Any pre-existing functions?

geekchic
  • 2,371
  • 4
  • 29
  • 41

1 Answers1

1

Well I'm going to go ahead and answer this myself. After a bit of digging, I found the Hough Line Transform which perfectly suits my needs.

It is pretty well documented here.

I wanted higher accuracy, so I used HoughLinesP.

    HoughLinesP(dst, lines, 1, CV_PI/180, 100, 100, 10);

The arguments are well defined and its pretty much trial and error after that to perfect it. I've used a Median Blur and a Canny Edge Detector before this for better results.

geekchic
  • 2,371
  • 4
  • 29
  • 41