I used the opencv.TM_CCOEFF_NORMED
function for matching the invoice template. However, the template matching functionality does not yield accurate results. the matching accuracy is quite poor, at only 50%. Could you please advise on what I should include or change in the process to increase the accuracy?
templateMap = cv.matchTemplate(img_r, resized_template, cv.TM_CCOEFF_NORMED)
min_val, max_val, min_loc, max_loc = cv.minMaxLoc(templateMap)
threshold = 0.8
if max_val > threshold:
print(f"Template {template_name} found in {file_name}")
matched_files.append(file_name)
output_path = os.path.join(template_folder, os.path.basename(file_path))
imwrite(output_path, img)
OpenCV, EXpecting increase 100%