Given a base image, I would like to search it for multiple sub-images.
To accomplish this, I built an array with all of my .jpg filenames, and called cv.matchTemplate on each sub-image against the base image.
Run synchronously, the code works perfectly, but slowly due to the large volume of sub-images. Therefore, I called the ThreadPoolExecutor to speed things up. (I also tried multiprocessing, but both had the same problem)
Using threading for this task, I got a bunch of errors, specifically:
Premature end of JPEG file
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: bad Huffman code
Corrupt JPEG data: extraneous bytes before marker 0xd9
It’s like the code runs “too quickly,” not accurately reading the file then going onto the next one, and then matchTemplate doesn’t work as a result. Is there a better way to do this?
In general, what would be the best approach to quickly scan a base image for a high volume of sub-images and get the coordinates of each?