title: How compare two edges images in opencv (not matchShapes)
body: <p>A little introduction on what I'm doing ...
  For academic purposes I am creating an application in c++ using opencv for the detection of static objects in a scene.
  The application is based on a combined approach of background subtraction and tracking, and the detection of events related to the abandonment of the objects works fine.
  But at the moment I have a problem that I can't solve; I have to implement a finite state machine for detect the event of object removal, both before and after the entry of the object in the background.
  To do this I was ordered by my superiors to use the edges of objects.</p>
  
  <p>And now the problem.
  After detecting a vehicle illegally parked along a road, I need to compare the edges of various images (the background captured at the time of the alarm, the current background, the current frame) to understand what the vehicle do (picks up the movement, remains parked or picks up the movement after being in the background).
  I run these comparisons on the region of the scene in which there is the vehicle (vehicles typically have different size), I pull the edges using canny algorithm by obtaining a binarized CV_8UC1 cv::Mat.
  At this point I have to compare them.
  I tried to detect the contours with findContours and compare them with matchShapes, but it does not seem the right way, I'd compare each contour of the first image with every contour of the second, in addition typically the two images to campare have different number of contour (for example original background and current background, because the edges of the current background increased with the entry of the vehicle in the background).</p>
  
  <p>I also tried to create a new image in which each pixel corresponds to the absolute difference of the other two, then I counted the white pixels of the difference image (wPx), and I used this number for comparison in this way: I set two thresholds (thr1 and thr2), and counted the pixels of the bounding rect of the vehicle (perim), if wPxthr2*perim images are different.
  (I set percentages thresholds and I moltipy them with the perimeter of the bounding box to adapt the thresholds to the vehicle dimensions.)
  This solution, however, seems to be very little robust.</p>
  
  <p>Do you have something simple to suggest me?
  Thank you very much in any case, more than once you StackOverflow users have helped me!</p>
  
  <p>PS: <a href="http://i.stack.imgur.com/D68Mq.jpg" rel="nofollow">THIS</a> is an example of the images that I have to compare</p>
  
  <ul>
  <li><p>The first is the background without the vehicle stationary, contains the edges of the street;</p></li>
  <li><p>the second is the original background, the one captured when the stationary vehicle is detected;</p></li>
  <li><p>the third is the current background (which in this case is equal to the original being the same frame, but then change);</p></li>
  <li><p>the fourth is the current frame of the video;</p></li>
  </ul>