QQ:231469242
pip install opencv
如果找不到版本,去非官方下载opencv第三方包http://www.lfd.uci.edu/~gohlke/pythonlibs/
下载好文件放入C:/Anaconda3/Scripts 文件夹, 然后 用pip install opencv安装
# -*- coding: utf-8 -*- """ Created on Sat Dec 24 10:42:10 2016 @author: daxiong """ import cv2 import numpy as np #import os file1= "1.png" file2="3.png" image1 = cv2.imread(file1) image2 = cv2.imread(file2) 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 ("两张图片不一样")
时间: 2024-12-01 16:27:51