Template matching is the process of finding a smaller known template image in another larger image.
Questions tagged [template-matching]
363 questions
2
votes
0 answers
Scale-invariant OpenCV image template matching in Python
The method cv2.matchTemplate gives a translation-invariant template matching on an image, but not scale-invariant.
How to do a scale-invariant (or even rotation-invariant) template matching with Open CV for Python?
Is there a way to use a log-polar…

Basj
- 41,386
- 99
- 383
- 673
2
votes
2 answers
How to detect if an image is in another image?
I am trying to detect if an image is a 100 % match to being in another image, and then set a variable to True if it is. But all the things I have read have turned up little to no results apart from one particular thread in which this code is…

GalacticSquirrel
- 29
- 1
- 3
2
votes
0 answers
Open CV: Identify cow based on its body pattern
I want to identify a cow based on its body pattern. I am attempting to use template matching as I can gather data and the camera is fairly constant as well as the cows position. However the results are not perfect as i the matching includes the…

Jameel Mukadam
- 21
- 1
2
votes
1 answer
Py script for fishing minigame cv2.matchTemplate
I am trying to make a script for fishing minigame, there is a post with a fishing script for albion online, the problem is that in this game the pointer is very thin and there are many different textures and colors, to the simple grayscale matching…

Exilion
- 21
- 2
2
votes
2 answers
OpenCV edge based object detection C++
I have an application where I have to detect the presence of some items in a scene. The items can be rotated and a little scaled (bigger or smaller). I've tried using keypoint detectors but they're not fast and accurate enough. So I've decided to…

mrid
- 5,782
- 5
- 28
- 71
2
votes
2 answers
Merging pairs of nodes based on attribute, new to template matching
Say I have the following XML:
blah
blabla
shovel
…

Spectraljump
- 4,189
- 10
- 40
- 55
2
votes
2 answers
Using cv.matchTemplate to find multiple best matches
I am using the function cv.matchTemplate to try to find template matches.
result = cv.matchTemplate(img, templ, match_method)
After I run the function I have a bunch of answers in list result. I want to filter the list to find the best n matches.…

Josh Sharkey
- 1,008
- 9
- 34
2
votes
1 answer
How to use the cv2.minMaxLoc() in template matching
Here is the code I used for template matching and what do min_val, max_val, min_loc, max_loc mean? what are they used for?
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('C:\\machineLearning\\positive\\1.jpg',…

Cherry
- 61
- 1
- 1
- 9
2
votes
0 answers
Detecting repeating pattern in image
Is it possible to detect pattern which is repeating in image? I have tried EmguCV and AForge's template matching. But that requires a template image to be provided. I want to identify the repeating template itself in the image.

AUser123
- 651
- 1
- 7
- 21
2
votes
1 answer
Color Intensity of Pixel(X,Y) on Image [OpenCV / Python]
I'm using Template Matching to detect for smaller images in a large image.
After detecting it , i would grab the center point(x y) of main picture of the detected image.
Could anyone advice how I could grab the shade/color of that particular center…

CodeGuru
- 3,645
- 14
- 55
- 99
2
votes
0 answers
Template Matching maximizing equal pixels
I am trying to find a template in an image and I am using OpenCV for that. The problem is that the TM_SQDIFF function is not exactly what I need and it fails in some cases, for example:
Template:
Image:
Result using SQDIFF:
I want the template to…

klaus
- 1,187
- 2
- 9
- 19
2
votes
2 answers
Python OpenCV - one function for template matching
I've looked into Template Matching and I understand the concept and have implemented it for my case already, and it works. This is the code given in the documentation:
import cv2 as cv
import numpy as np
img_rgb = cv.imread('mario.png')
img_gray =…

diatomym
- 163
- 1
- 2
- 11
2
votes
1 answer
Hausdorff Distance Object Detection
I have been struggling trying to implement the outlining algorithm described here and here.
The general idea of the paper is determining the Hausdorff distance of binary images and using it to find the template image from a test image.
For template…

eshirima
- 3,837
- 5
- 37
- 61
2
votes
0 answers
Android - OpenCV template matching with camera picture
I'm trying to make an application which compares a pictures taken from the camera with others stored in the SD card.
If I try to compare two images stored in SD card it works fine, but when I try to use the camera it freezes.
That's a part of my…

Mirco
- 75
- 1
- 5
2
votes
1 answer
Python vs. C++ OpenCV matchTemplate
I have a weird problem with OpenCV. I was doing template matching with OpenCV on both Python and C++, however, even though Python uses the C++ methods under the hood, I get very different results. Python method gives me really accurate place, C++ is…

Güngör Basa
- 628
- 2
- 9
- 27