Template matching is the process of finding a smaller known template image in another larger image.
Questions tagged [template-matching]
363 questions
7
votes
1 answer
Why does an unspecialised template win over a partially specialised one?
I am trying to create a templated can_stream struct that inherits from
std::false_type or std::true_type depending on whether operator<< is defined for type T.
#include
struct S {
int i;
};
std::ostream& operator<< (std::ostream&…

az5112
- 590
- 2
- 11
7
votes
1 answer
openCV template matching error: (-215)
I am using opencv template matching in real time camera capture, and got the error message:
error: (-215) _img.size().height <= _templ.size().height && _img.size().width <= _templ.size().width in function matchTemplate
enviroment:
OpenCV:…

JeffChen
- 173
- 2
- 10
7
votes
4 answers
What is the OpenCV template matching Max Min value range ? Need to be used as a theshold / c++/java
I am creating a simple openCV application using template matching where I need to compare find a small image in a big image and return the result as true(if match found) or false( no matches found).
Imgproc.matchTemplate(largeImage, smallImage,…

Emily Webb
- 325
- 2
- 6
- 16
6
votes
2 answers
Template matching behavior on Color
I am evaluating template matching algorithm to differentiate similar and dissimilar objects. What I found is confusing, I had an impression of template matching is a method which compares raw pixel intensity values. Hence when the pixel value varies…

Karthik
- 390
- 1
- 4
- 18
6
votes
3 answers
Maxvalue in cv2.minMaxLoc()?
I'm having a bit of trouble with opencv and template matching, so I was hoping someone here could help a lost soul out.
So as part of the code I'm using, I've got the following 2 lines which I don't quite understand as well as I should.
result =…

Jason Law
- 61
- 1
- 1
- 2
6
votes
1 answer
Fast template matching using Pyramids in Python
I am trying to implement in Python the following C++ code: https://opencv-code.com/tutorials/fast-template-matching-with-image-pyramid/
If you check the C++ code, you'll see this loop:
for (int i = 0; i < contours.size(); i++)
{
cv::Rect r =…

Daniel Ramírez Torres
- 103
- 1
- 9
6
votes
1 answer
Matching template imge(scaled) to Main/larger image
I want to find/check subImage/template image in main image and want to know its coordinates,
I have used code given at following link to implement it,
Check presence of subimage in image in iOS
It is working fine, if the size of the template image…

Mehul Thakkar
- 12,440
- 10
- 52
- 81
6
votes
2 answers
numpy template matching using matrix multiplications
I am trying to match a template with a binary image (only black and white) by shifting the template along the image. And return the minimum distance between the template and the image with the corresponding position on which this minimum distance…

Semi
- 448
- 1
- 5
- 16
5
votes
2 answers
Java openCV - after using Imgproc.matchTemplate method, how do i examine the result?
i am calling:
Imgproc.matchTemplate(image, templ, result, 0);
and the result of the match is in a Mat instance.
I couldn't find any documentation for this class.
If i understand right, the result contains a matrix of probabilities.
How can i find…

Eyal
- 1,748
- 2
- 17
- 31
5
votes
3 answers
Template matching with multiple objects in OpenCV Python
I'm trying to find multiple templates in an image using opencv python, according to this link.
But the problem is that multiple points returned for a single object with a slightly difference in position.
Something like this:
I dont want to use…

Salman
- 924
- 1
- 7
- 20
5
votes
2 answers
Fast(er) way of matching feature to database
I'm working on a project where I have a feature in an image described as a set of X & Y coordinates (5-10 points per feature) which are unique for this feature. I also have a database with thousands of features where each have the same type of…

Mikael
- 91
- 4
5
votes
3 answers
Algorithm for matching position and size of two rectangles
I'm looking for a algorithm that computes the following: I have an image with a predefined area (the green one on the attached image). The user draws the red rectangle and the algorithm should compute whether the red rectangle matches approximately…

Rose Nettoyeur
- 885
- 1
- 16
- 29
5
votes
0 answers
Template Matching using GPUimage
I am developing a iOS Application which is processing an image to find a part of an image which match a template image. The same is implemented using OpenCV but current implementation of OpenCV doesn't supports iOS GPU.
I am new to GPUImage…

Vineeth Raveendran
- 51
- 2
5
votes
2 answers
Aligning multiple images into one image?
What is a good method to align images together that may have different rotations, exposures, etc, but have the same background or other fixed reference?
Adobe Photoshop can do this with its "Photomerge" feature.
How can I do this programatically? Is…

gak
- 32,061
- 28
- 119
- 154
5
votes
1 answer
Template Matching with tolerance in OpenCV
I'm using OpenCV and C++. I want to check if an image is part of another image and already have found a function called matchTemplate which is working. But what if the template image is a little bit differently? Is there a function or a way like…

Mickey
- 943
- 1
- 19
- 41