I am trying to use this for detecting cracks on metal surfaces. I am getting this error (copied in the end). I have attached the code and images to reproduce this error. Can you please help out?
Error:
Traceback (most recent call last):
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/tutorials/SampleError.py", line 41, in
Hits = matchTemplates(listTemplate, im1, score_threshold=0.9, method=5, maxOverlap=0)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 271, in matchTemplates
tableHit = findMatches(listTemplates, image, method, N_object, score_threshold, searchBox)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 149, in findMatches
_ = future.result()
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/Users/pallavidubey/mambaforge/envs/mtm/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 201, in _multi_compute
corrMap = computeScoreMap(template, image, method, mask=mask)
File "/Users/pallavidubey/Documents/MultiTemplateMatching-Python/MTM/init.py", line 87, in computeScoreMap
return cv2.matchTemplate(image, template, method, mask=mask)
cv2.error: OpenCV(4.7.0) /Users/xperience/GHA-OCV-Python/_work/opencv-python/opencv-python/opencv/modules/imgproc/src/templmatch.cpp:588: error: (-215:Assertion failed) corr.rows <= img.rows + templ.rows - 1 && corr.cols <= img.cols + templ.cols - 1 in function 'crossCorr'
SampleError.zip