我有这个代码:
import cv2
from matplotlib import pyplot as plt
import numpy as np
img = cv2.imread('forklift2.jpg')
A = cv2.rectangle(img, (180, 90), (352, 275), (255,0,0), 2)
B = cv2.rectangle(img, (100, 220), (300, 275), (155,122,100), 2)
cv2.imshow('Object detector', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
我需要检测2个矩形A和B之间的交叉点,如图中所示:
所以我需要一个布尔变量,如果这两个矩形有一些公共面积,它应该是真的。 我怎么能做到呢?在
您可以参考
IOU
实现如下:相关问题 更多 >
编程相关推荐