5

I have a contour of object..and a line..
Object is moving..but line is constant..
I want to know the points at which contour intersects the line..

For example:- Take example of Car Race in which their is finish line..
I have a contour of Car and finish line.
I want to know the points on contour which intersects the finish line.

Wazy
  • 8,822
  • 10
  • 53
  • 98

1 Answers1

7

Intersect the object contour with the line contour (use numpy.logical_and( object_mask, line_mask )) and all points where the resulting image is non-zero are the points of intersection.

mathematical.coffee
  • 55,977
  • 11
  • 154
  • 194
  • Please give me some more info on `numpy.logical_and( object_mask, line_mask ))`....Any links will be highly appreciated... – Wazy Dec 28 '11 at 11:53
  • 1
    Oh sorry, `numpy` is used in the python interface. Basically, you get an image of zeros and draw the contour on it, and you get another image of zeros and draw the line on it, and then go through each pixel and `AND` them together. That is, store a TRUE when the pixel values in both images are positive, and a FALSE otherwise. Your resulting image will be TRUE where the contour intersects the line and FALSE otherwise. – mathematical.coffee Dec 28 '11 at 13:11