【问题标题】:Feature detection (copy/move)特征检测(复制/移动)
【发布时间】:2020-06-23 11:44:51
【问题描述】:

虽然有很多示例如何比较两张不同的图片,但我很难在https://29a.ch/photo-forensics/#clone-detection 中找到图片中的重复特征

img1 = cv2.imread('my.jpg')
orb1 = cv2.ORB_create()
kp1, des1 = orb.detectAndCompute(img1, None)
bf = cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck=True)
# how to match now to itself?

【问题讨论】:

    标签: python image opencv


    【解决方案1】:

    再读一遍图片

    img2 = cv2.imread('my.jpg')
    orb2 = cv2.ORB_create()
    kp2, des2 = orb.detectAndCompute(img2, None)
    matches = bf.match(des1,des2) 
    

    循环匹配并保持不相同的匹配

    for match in matches:
        img1_idx = match.queryIdx
        img2_idx = match.trainIdx
        (x1,y1) = kp1[img1_idx].pt
        (x2,y2) = kp2[img2_idx].pt
    
    if int(x1) != int(x2) and int(y1) != int(y2):
        cv2.line(img2, (int(x1),int(y1)), (int(x2),int(y2)), (0,0,255), 1)
    

    【讨论】:

      猜你喜欢
      • 2016-06-27
      • 1970-01-01
      • 2012-12-16
      • 2017-03-06
      • 2013-03-18
      • 1970-01-01
      • 1970-01-01
      • 2010-11-20
      相关资源
      最近更新 更多