赞
踩
直接判断numpy相等:
(np.array(self.cls_1)==df_label.columns[1:]).all()
判断图片相似:
二、
- import cv2
-
- import numpy as np
-
- image1 = cv2.imread("1.png")
-
- image2 = cv2.imread("22.png")
- difference = cv2.subtract(image1, image2)
- result = not np.any(difference) #if difference is all zeros it will return False
-
-
- if result is True:
- print("两张图片一样")
- else:
- cv2.imwrite("result.jpg", difference)
- print ("两张图片不一样")
结果改一下:
- diff = cv2.subtract(preFrame, frame2)
- if np.max(diff)<10:
- print('diff<10', self.cam_no,np.max(diff))
- return True
- if not np.any(diff): # 判断为图片相同
- return True
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。