特价图书,人流后能洗头吗,里番吧
其中x1,y1;x2,y2分别表示两个矩形框的中心点
def calciou(x1, y1, w1, h1, x2, y2, w2, h2): if((abs(x1 - x2) < ((w1 + w2)/ 2.0)) and (abs(y1-y2) < ((h1 + h2)/2.0))): left = max((x1 - (w1 / 2.0)), (x2 - (w2 / 2.0))) upper = max((y1 - (h1 / 2.0)), (y2 - (h2 / 2.0))) right = min((x1 + (w1 / 2.0)), (x2 + (w2 / 2.0))) bottom = min((y1 + (h1 / 2.0)), (y2 + (h2 / 2.0))) inter_w = abs(left - right) inter_h = abs(upper - bottom) inter_square = inter_w * inter_h union_square = (w1 * h1)+(w2 * h2)-inter_square calciou = inter_square/union_square * 1.0 print("calciou:", calciou) else: print("no intersection!") return calciou def main(): calciou(1, 2, 2, 2, 2, 1, 2, 2) if __name__ == '__main__': main()
以上这篇python计算机视觉里的iou计算实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Python 实现将numpy中的nan和inf,nan替换成对应的均值
python爬虫把url链接编码成gbk2312格式过程解析
网友评论