CODE:if (runpython()==0){messagebox ("Не удалось запустить Python"); goto er;}
__python_sync
import cv2
from multiprocessing import Process, Pipe
import threading
def find_image(template_path, target_path):
(4 пробела)template = cv2.imread(template_path, cv2.IMREAD_GRAYSCALE)
(4 пробела)target = cv2.imread(target_path, cv2.IMREAD_GRAYSCALE)
(4 пробела)result = cv2.matchTemplate(target, template, cv2.TM_CCOEFF_NORMED)
(4 пробела)_, max_val, _, max_loc = cv2.minMaxLoc(result)
(4 пробела)threshold = 0.8
(4 пробела)if max_val >= threshold:
(8 пробелов)top_left = max_loc
(8 пробелов)return top_left
(4 пробела)else:
(8 пробелов)return -1
__end_python
string result = sendgetpython("find_image(r^'C:\small.png^', r^'C:\big.png^')");
messagebox(result);
closepython();
er:; |