赞
踩
本文实例为大家分享了python opencv实现图像配准与比较的具体代码,供大家参考,具体内容如下
代码
from skimage import io
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img_path1 = "2_HE_maxarea.png"
img_path2 = "2_IHC_maxarea.png"
img1 = io.imread(img_path1)
img2 = io.imread(img_path2)
img1 = np.uint8(img1)
img2 = np.uint8(img2)
# find the keypoints and descriptors with ORB
orb = cv.ORB_create()
kp1, des1 = orb.detectAndCompute(img1,None)
kp2, des2 = orb.detectAndCompute(img2,None)
# def get_good_match(des1,des2):
# bf = cv.BFMatcher()
# matches = bf.knnMatch(des1, des2, k=2)
# good = []
# for m, n in matches:
# if m.distance < 0.75 * n.distance:
# good.append(m)
# return good,matches
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。