Answer the question
In order to leave comments, you need to log in
How to find specific text in an OpenCV image?
Here is the code, I'm trying to find the text in the picture, but it doesn't work, as I understand it, the comparison method is not suitable.
Tk, he finds the picture in the picture easily. Please tell me how to fix
import cv2
#TM_SQDIFF_NORMED
method = cv2.TM_SQDIFF_NORMED
small_image = cv2.imread('shab.png', 0) # что ищу
large_image = cv2.imread('output.png', 0) # где ищу
result = cv2.matchTemplate(small_image, large_image, method)
mn,_,mnLoc,_ = cv2.minMaxLoc(result)
MPx,MPy = mnLoc
trows,tcols = small_image.shape[:2]
cv2.rectangle(large_image, (MPx,MPy),(MPx+tcols,MPy+trows),(0,0,255),10)
res = cv2.resize(large_image, dsize=(2500,2500))
cv2.namedWindow("Resized", cv2.WINDOW_NORMAL)
cv2.imshow("Resized", res)
cv2.waitKey(0)
Answer the question
In order to leave comments, you need to log in
Solved the issue with: pdfminer, pdf2image, PIL
Found the coordinates of the desired text using pdfminer, converted it to an image using pdf2image and using PIL cropped the desired area (added values to the coordinates)
Here is the code, I'm trying to find the text in the picture, but it doesn't work, as I understand it, the method is not suitableNeed tesseract for this and opencv
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question