-1
我想匹配來自我的a.jpg和b.jpg的圖片。OpenCV - 如何在Python中掩蓋匹配圖片?
但是有一些地方我不想匹配。
我應該如何掩飾它?
(PS:如果傳送這些區域爲黑色,它會影響cv2.matchTemplate
)
import cv2
import numpy as np
img1 = cv2.imread("a.jpg")
img2 = cv2.imread("b.jpg")
myROI = img2[183:374,293:408]
# here I want to mask a part of myROI ..
# It means that I don't want to match something in my picture...
# How should I do ?
res = cv2.matchTemplate(img1,myROI,method= eval('cv2.TM_CCOEFF_NORMED'))
min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
print max_val*100 # score
B.JPG
你可以上傳兩張圖片以及 –
@JeruLuke,編輯! – eason
首先嚐試'cv2.matchTemplate()'然後執行屏蔽 –