title: Detection of parking lot lines and ROI openCV
body: <p>I am working on a openCV project, trying to detect parking spaces and extract the ROI(Region of Interest) from an image for further vehicle detection. The image provided will consist of all empty parking spaces. I have read several posts and tutorials about this. So far, the approach I have tried are:</p>
  
  <pre><code>1.Convert image to grayscale using `cvtColor()`
  2.Blur the image using `blur()`
  3.Threshold the image to get edges  `threshold()`
  4.Find image contours using findContours()
  5.Finding all convex contours using `convexHull()`
  6.Approx polygonal regions using `approxPolyDP()`
  7.Get the points for the result from 5, if total number of points =4. 
    Check for area and angle. 
  </code></pre>
  
  <p>I guess the problem with this approach is when I do <code>findContours()</code>, it finds irregular and longer contours which causes <code>approxPolyDP</code> to assume quadrilaterals larger than the parking space itself. Some parking lines have holes/irregularity.</p>
  
  <p>I have also tried <code>goodFeaturesToTrack()</code> and it gives corners quite efficiently, but the points stored in the output are in arbitrary order and I think it is going to be quite rigorous to extract quadrilaterals/rectangles from it. </p>
  
  <p>I have spent quite good hours on this. Is there any better approach to this? </p>
  
  <p><a href="https://dl.dropbox.com/u/20895098/oneshotimage.jpg" rel="nofollow">This</a> is the image I am playing with.</p>