Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line intersecting contour in openCv

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.

like image 424
Wazy Avatar asked Dec 28 '11 11:12

Wazy


People also ask

Can two contours intersect?

Contour lines join places with the same altitude on a map. Therefore,generally they do not cross each other.

How contour detection works in OpenCV?

Since OpenCV 3.2, findContours() no longer modifies the source image but returns a modified image as the first of three return parameters. In OpenCV, finding contours is like finding white object from black background. So remember, object to be found should be white and background should be black.

How do you expand contour in OpenCV?

You can use cv::dilate() and cv::erode() then detect the contours again.


1 Answers

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.

like image 143
mathematical.coffee Avatar answered Oct 21 '22 08:10

mathematical.coffee