Template matching is the process of finding a smaller known template image in another larger image.
Questions tagged [template-matching]
363 questions
0
votes
0 answers
Template matching for rotated images using a fast Fourier transform
I want to find a rotated fragment taken from a large image using a fast Fourier transform.
I know how to do this in case the image is not rotated. To do this, it is enough to calculate the similarity function of two images in the frequency domain…
0
votes
0 answers
(Python) Recreating Effects applied to Image for Template Matching
I've been working with Python's opencv library, and am having some trouble getting it to recognize some images.
To summarize the issue, I have hundreds of images pulled from a game. I am attempting to use matchTemplate() to find these images on the…

Moses
- 43
- 1
- 7
0
votes
0 answers
python Opencv template match error with win32api
So i have been trying to use this code to get a screenshot from a window, with this screenshot i will use opencv to match template, but every time that i try to match template i always get the same error, i have tried with a few other things like…
0
votes
0 answers
Can someone help me with this OpenCV error? I'm trying to use openCV's matchTemplate to match a screenshot from a live capture to a local .jpg image
Here is the error message:
error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function 'cv::matchTemplate'
This is the function that the error occurred in, in line
result =…
0
votes
1 answer
Template matching a smaller (cropped) image from a larger whole image
I am attempting to template match a cropped template image from the image it was cropped from.
Here's my attempt:
import cv2
import numpy as np
def main()
img_rgb = cv2.imread('whole_image.jpg')
img_gray = cv2.cvtColor(img_rgb,…

Meghar
- 25
- 4
0
votes
1 answer
OpenCV template ghosting when template matching
I am trying to locate QR position squares withing a QR code. QR position squares are the three boxes in the corners of a QR code:
I am template matching these to an image provided to me. I have discovered that there are significant 'ghosts' which…

mfergus9
- 23
- 2
0
votes
0 answers
Template Matching Java without opencv or 3rd party
I am trying to do template matching in java:
This is the code:
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.awt.image.DataBufferByte;
public class pro {
public static…

quadri quadri
- 1
- 1
0
votes
0 answers
Most 'fitting' placement of shape in silhouette
I apologize in advance for the lack of code, but I have been looking at this problem for some days now and couldn't proceed much.
I am trying to find a method that, given a template shape and a figure, finds the most fitting (edges-wise) placement…
0
votes
1 answer
Multiple template matching with Scikit-image
I want to find the middle of a coin and find the radii. The radii can tell me if the coin is 5 cents of 50 cents. After finding the image, I must be able to detect the middle of the circles so I can give them a color
I already made a beginning with…

Paul Engelbert
- 97
- 7
0
votes
1 answer
How to perform template matching between matrix and image?
I've been working on a simple machine learning on Matlab
My dataset looks like:
There are 10 pictures in a folder, 5 for training, and 5 for testing.
Totally 40 folders, or 400 pictures in my dataset.
First, I read 200 images(32*32pixel) into a…

Nightysky
- 37
- 6
0
votes
1 answer
How to template match inside a contour?
In an image I have retrieved some rectangular contours of areas that I am interested in and now I would like to match what is inside that area with a template. I have multiple templates but each rectangle would contain at most 3 matching templates…

Nicholas Bissessar
- 51
- 6
0
votes
0 answers
The correct way to define a ROI
I'm currently working on a image processing project opencv python based, and essentially it's quite simple, it uses cv2.matchTemplate and a database to make all the matches, but I think something is done wrong.
The images are get from a few cameras,…

Sapo
- 1
0
votes
1 answer
Matlab: Find pattern in an image given a skeletonized template
I am stuck at a current project:
I have an input picture showing the ground with some shapes on it. I have to find a specific shape with a given template.
I have to use distance transformation into skeletonization. My question now is: How can I…

Larry
- 1
0
votes
0 answers
If Statement based on SIFT Key Point Matches in Python
I'm in the process of developing a Flask Python application that's able to find a logo within different background images. The goal is to have a solution that states "yes, the logo is in the background", or "no, it doesn't look like the logo is in…

CJ All
- 1
0
votes
3 answers
Template Matching using FFT
Can anyone please explain how to perform template matching using FFT. The template is smaller than the original image.
1. Everywhere it states that the template has to be padded with zeros. How it is done. Is it added to the bottom and right of the…

Karthik
- 1
- 1
- 1