本文整理汇总了Python中SimpleCV.Image.findTemplate方法的典型用法代码示例。如果您正苦于以下问题:Python Image.findTemplate方法的具体用法?Python Image.findTemplate怎么用?Python Image.findTemplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.findTemplate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import findTemplate [as 别名]
from SimpleCV import Image
import time
# Get the template and image
goBoard = Image('go.png')
black = Image('go-black.png')
black.show()
time.sleep(3)
goBoard.show()
time.sleep(3)
# Find the matches and draw them
matches = goBoard.findTemplate(black)
matches.draw()
# Show the board with matches print the number
goBoard.show()
print str(len(matches)) + " matches found."
# Should output: 9 matches found.
time.sleep(3)
示例2: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import findTemplate [as 别名]
import cv2
import cv2.cv as cv
from SimpleCV import Image
logo = Image('/Users/hackreactor/code/sheltowt/PIXLEE/coke_recognition/red_back.jpg')
machine = Image('/Users/hackreactor/code/sheltowt/PIXLEE/coke_recognition/coke_photos/93.png')
matches = machine.findTemplate(logo)
matches.draw(width=3)
machine.show()
cv.WaitKey(5000)
count = 0
for match in matches:
count = count + 1
print(matches)
print(count)