OpenCV имеет функцию поиска и замены изображения, как показано ниже.
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
img_rgb = cv.imread('images/input.png')
img_gray = cv.cvtColor(img_rgb, cv.COLOR_BGR2GRAY)
template = cv.imread('images/minus.png', 0)
w, h = template.shape[::-1]
res = cv.matchTemplate(img_gray, template, cv.TM_CCOEFF_NORMED)
threshold = 0.8
loc = np.where(res >= threshold)
for pt in zip(*loc[::-1]):
cv.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (255, 255, 255), -1)
cv.line(img_rgb, (pt[0], pt[1] + int(h / 2)),
(pt[0] + w, pt[1] + int(h / 2)), (0, 0, 0), 2)
cv.imwrite('out/detected-minus.png', img_rgb)
# tesseract out/detected-minus.png stdout -l eng --psm 4
— 2,196,193
https://docs.opencv.org/master/d4/dc6/tutorial_py_template_matching.html