Commit adf5c87c authored by anonym's avatar anonym
Browse files

Test suite: always save OpenCV's last match on disk.

I am about to implement a feature where the last match can be used to
"bump" the image after allowing more fuzziness.
parent 3f9b3ad7
......@@ -32,9 +32,12 @@ def match(image, candidate, sensitivity):
w, h = template.shape[::-1]
res = cv2.matchTemplate(image_gray, template, cv2.TM_CCOEFF_NORMED)
_, val, _, pos = cv2.minMaxLoc(res)
x, y = pos
if val < sensitivity:
raise FindFailed
return list(pos) + [w, h]
cv2.imwrite(os.environ['TMPDIR'] + '/last_opencv_match.png',
image_rgb[y:y+h, x:x+w])
return [x, y, w, h]
try:
print(*match("#{screen}", "#{image}", #{sensitivity}))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment