資源簡介
找出子圖片在原圖中的坐標
代碼片段和文件信息
#?-*-?coding:?UTF-8?-*-
import?cv2
import?os
import?time
def?get_pay_keyboard_number_location(impath?target?screenw?screenh?val):
????print(“start?find?pic“)
????start?=?time.time()
????img_src?=?cv2.imread(impath)
????template?=?cv2.imread(target)
????if?(img_src?is?not?None)?and?(template?is?not?None):
????????#?獲取小圖片的高和寬
????????imgtmh?=?template.shape[0]
????????imgtmw?=?template.shape[1]
????????#?獲取大圖片的高和寬
????????img_srch?=?img_src.shape[0]
????????img_srcw?=?img_src.shape[1]
????????#?匹配圖片
????????res?=?cv2.matchTemplate(img_src?template?cv2.TM_CCOEFF_NORMED)
評論
共有 條評論