Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I solve this issue for this Multiscale Template Matching script?


I am trying to write a python script to analyze many still images that have different logos in them The logo is not always of a fixed size and clarity is not the same either (the logo's resolution in the image could be good or bad - it varies and size roughly changes too)

The script I have written so far uses a multiscale template matching method (opencv library) (inspired by - It accounts for only one template at a time and gives higher accuracy using a low resolution template

I tried using thresholds (using value returned from matchTemplate function) and also tried using the maxVal as an indicator of similarity but I keep getting really huge bizarre values (for those variables) I compared the values over different screenshot matches and I can't seem to be able find a correlation/pattern

Since thresholding doesn't work I tried setting a region where the logo was more likely to appear; And save the image if a logo match was found in that area. This doesn't always work because sometimes it matches similar logos or marks that area even when it couldn't find any logos.

Could you please advise on how to use maxVal as an indicator of similarity for the multiscale template matching method? Which measure of similarity would you recommend to ascertain that the multiscale template matching method return a valid result?

I could use any suggestions or methods to improve on the script



Script (Code):

To run the script, arguments have to be supplied in powershell or command prompt [cmd] (in the following way):

a)python --template /.../.../.../[Name].[EXT] --images /.../.../... python --template /Users/myusername/Pictures/LogoFolder/mylogo.png --images /Users/myusername/Pictures/StillImageFolder

b)python --template /.../.../.../[Name].[EXT] --images /.../.../... --visualize 1 python --template /Users/myusername/Pictures/LogoFolder/mylogo.png --images /Users/myusername/Pictures/StillImageFolder --visualize 1

I added some code (towards the end) to automate the script so the user does not have to manually close every window with the resulting match for all images. The window shows the match result for 10 seconds and then moves to the next image.