我怎么能找到线和轮廓的交点的面积 [英] how could I find the area of the intersection of line and contour
本文介绍了我怎么能找到线和轮廓的交点的面积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
蓝色的笔是轮廓
红色的笔是直线
如何找到线和轮廓的交点的两个区域
how could I find the two areas of the intersection of line and contour
现在,我可以通过
area = cv2.contourArea(np.array( [ [i] for i in blue_points ] ))
推荐答案
一种简单但可能不是最有效的方法是使用cv.drawContours
和cv.line
创建两个图像:一个具有斑点轮廓,另一个一个带有线条的轮廓.然后cv.bitwise_and
将它们放在一起,任何仍为正的点将成为相交点.
A simple but perhaps not the most efficient way would be to use cv.drawContours
and cv.line
to create two images: one with the contour of the blob and one with the contour of the line. Then cv.bitwise_and
them together, and any point that is still positive will be points of intersection.
这篇关于我怎么能找到线和轮廓的交点的面积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文