Template matching is used in order to find a smaller image (called template) in a bigger image. The tag must be used only for queries related to such tasks.
Questions tagged [matchtemplate]
53 questions
2
votes
1 answer
OpenCV MatchTemplate limited to roi
My question is related to the use of matchTemplate in OpenCV. I'm able to use the function to find a template within the whole image. It is possible to limit the "searching area" to a restricted region within the image, i.e. using the roi? I tried…

MarcHausmann
- 23
- 1
- 4
2
votes
1 answer
OpenCV: Match Template, combining close matches
Related to: OpenCv: Finding multiple matches
I am now able to mark where all my matches are. However, because some of the matches aren't perfect, I need to lower my threshold a little. This means that I have bunches of pixels that are all a match…

CaffGeek
- 21,856
- 17
- 100
- 184
1
vote
1 answer
How to matchtemplate a transparent image opencv
I tried the method in the answer of this: How do I find an image on screen ignoring transparent pixels, it is exactly what I'm looking for, but it didn't work out for me, I keep getting a black image after the alpha processing.
I tried
result =…

Eery
- 13
- 3
1
vote
0 answers
Is it possible to use matchTemplate from openCV to track a template region in a movie?
I have a .tif file (greyscale, 8-bit), which is essentially a sequence of images over time. I have an object that is moving over time, so has a different position in each frame, and I'd like to use matchTemplate to "follow" this object over the…

verianne
- 11
- 1
1
vote
0 answers
python cv2.matchTemplate stops working when I switch from image to video frame
import cv2
import numpy as np
from matplotlib import pyplot as plt
template = cv2.imread('templateGray.PNG', 0)
height, width = template.shape[::]
vidcap = cv2.VideoCapture('Vid.mp4')
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
out =…

DemonPotato4411
- 37
- 3
1
vote
1 answer
openCV - Using matchTemplate() from a window using hWND C++
I am running an infinite loop and every frame I'm taking a screenshot from a desired window and turning it into a Mat then searching that Mat for a template image using matchTemplate. If I read in the template image and the entire image, I can use…

Bobby Phlay
- 11
- 1
1
vote
0 answers
How to speed up cv.matchTemplate when matching multiple templates?
Im using openCV to do template matching. Im planning to use it to detect templates from a live feed. Currently Im working with 63 templates and the total time of matching averages at about 9ms for an image. This is too slow for the application i…

Pēteris Andrušaitis
- 23
- 3
1
vote
0 answers
OpenCV match template only on a specified grid of positions
I have a program where I get one image as input and I have to compare it with ~640 known images to see which one is the most similar. To do this I was thinking of using OpenCV's match template, as it seems very fast and effective in doing what I…

Fran314
- 31
- 3
1
vote
1 answer
Using Tesseract to OCR matchTemplate Regions of Interest (ROI)
This is my very first attempt at using Python. I normally use .NET, but to identify shapes in documents have turned to Python and OpenCV for image processing.
I am using OpenCV TemplateMatching (cv2.matchTemplate) to discover Regions of Interest…

GoodJuJu
- 1,296
- 2
- 16
- 37
1
vote
1 answer
Python OpenCV matchTemplate with Masking - Found Matches at All Locations
Problem:
The results I receive from matchTemplate indicate that I have matches at every location with a value of 1.0.
Expected Results:
I expected one location in results to have a much higher score than others locations.
Code:
def…

mtu
- 11
- 2
1
vote
1 answer
Use matchTemplate with colored images OpenCV
I am trying to detect certain COLORED images in a desktop screenshot, where I have equally shaped templates but different color (these are not distinguished from one another doing the normal matchTemplate method as it is done with greyscale images)…

Fabricio Yacques
- 79
- 2
- 7
1
vote
1 answer
cv2.matchTemplate gives an error: (-215:Assertion failed)
import cv2
import numpy as np
kamera = cv2.VideoCapture(0)
while True :
ret,kare = kamera.read()
gri_kare = cv2.cvtColor(kare,cv2.COLOR_BGR2GRAY)
nesne = cv2.imread("nesn.jpg",0)
w,h = nesne.shape
res =…

J.Doe
- 21
- 1
- 3
1
vote
1 answer
OpenCV imwrite() / imread() does either function modify the image in any way?
I have the following situation, my in-memory image and what gets stored to disk and then read back do not equal, and I'd like to understand why and also how to 'fix' the difference.
If anyone wants to know why I have both (in-memory and local disk)…

Sauraus
- 95
- 13
1
vote
1 answer
OpenCV fails to match template with image(matchTemplate)
So I have an image
and a template
and I want to find the template image inside the image but my code doesn't find anything. I tried down sizing but still no detection. Please help me with the example:
import cv2
import imutils
import glob,…

Ali SH
- 403
- 1
- 6
- 16
1
vote
0 answers
Match image template on image - cv2-python
I'm not sure is this possible in cv2 to look specific line print position if matched.
When I'm trying to compare template image it is comparing entire template image (whole block all whites and blacks) inside the main image. And because of that the…

Dragon.M
- 249
- 1
- 4
- 11