OpenCV Compliance Pattern

I am trying to match the logo (template) that I have with some images. My images are colored by nature, and as I do, cvMatchTemplate () from openCV is used and runs a template (logo) on top of the original image. I scale the template to several levels to find the best match. Keep in mind that I just find digitally imprinted logos in the image, not the logos present on the scene. For example: detecting sky sports from this image http://i56.tinypic.com/2v3j3wx.jpg (Image is intended solely for the presentation and clarity of my task, and not for images that I work with

My images do not have a fixed resolution, so I scale it to the standard 800x600. Now that my original image resolution is very poor, say 300x300, the results are very ordinary. I use the = CV_TM_CCOEFF_NORMED method in the template parameter, and the estimates even for exact matches are quite low (only 0.4 from 0 to 1.0), which makes it difficult to determine if the logo is present or not. I have two questions:

1 - Compared to the opencv template, how it handles color images. I tried to understand from the document, and my conclusion was that it calculates the rating for each channel separately, and the best is taken. If so, I would better not consider all three channels to achieve better results.

2 - Any alternative approach! :)

Let me know if something is not clear!

EDIT (more info): As discussed in the comments, I am attaching my current match method, which is a scaled pattern matching. Please note that the attached images are for test purposes only and are not my actual set of images that I work with (they cannot be placed because the images are proprieotry) Original image A screen shot from youtube Logo Got from wikipedia Output Image Using Pattern Matching Red block indicating the best match wrt highest score

Although the pattern is matched, the score obtained here is 0.59 for this best match. Although a relatively good result for the match, it’s still not enough for me to say for sure that the logo you need exists or not. On my test images, when the logo on the screen is transparent, it would still detect the logo, but with a poor score of 0.3-0.4. Is it possible to get a better result with SURF / SIFT?

EDIT (attempt with SURF) I tried to run the SURF code already cited as an example in the official opencv documentation (minHessian = 2000). link here is the result. I'm not sure how to interpret it (2.3 points seem to be within the expected border. Is this considered good? enter image description here Thanks

+8
python image-processing opencv
source share
1 answer

Have you tried using Gaussian Blur on the original image before performing pattern matching? This may give you more accurate results, since I think the quality of the original image, which gives the worst fit.

Link to Gaussian Blur in OpenCV docs:

OpenCV Python Gaussian Blur

Alternatively, you can try using the histogram matching method when matching area patterns to further confirm that the correlation of the matching pattern has returned, even if it is small, is the correct value:

Histogram drawing

Bar charting is optional; it may be useful for your own application.

Histogram comparison

^ This method calculates the histograms of your images (source and pattern) and the correlation between them ... However, you do not need a histogram of the whole source, exactly where your pattern matching thinks the best correlation, or some other place on image, so you want to get a histogram of the region of interest (ROI), see the following C ++ code:

Mat OriginalImage = imread("source.jpg", 0); Rect RegionOfInterest = Rect(150, 150, 250, 250); Mat ROIImage = OriginalImage(RegionOfInterest); 

This allows you to calculate the histogram of the region of interest. You should get a histogram of your template and a histogram for the region where Template Matching considers your template to be in the source and compare them to confirm or deny the conclusion of template matching

+3
source share

All Articles