Questions tagged [template-matching]

Template matching is the process of finding a smaller known template image in another larger image.

363 questions
5
votes
1 answer

OpenCV Template Matching: Restrict search area

I have working OpenCV template matching code made with python. Now I am searching for a way to tell OpenCV to search only in a supplied area (x, y, w, h), is that possible? Regards, Philip
5
votes
1 answer

How can I perform Template Matching process in SUB-IMAGE extracted from ORIGINAL-IMAGE and Display the results in Original Image

One whole day I have tried a lot to get all the related matches (with matchtemplate function) in sub-Image , which is ROI i have already extracted from the original image with the mousecallback function. So my code is below for the…
Sharath
  • 99
  • 3
  • 7
5
votes
1 answer

how to detect known objects in OpenCV?

I am try to draw shapes in the window in real time. The shapes are like tangle ,rectangle ,circle , half or circle and "Z" in the screen using yellow color. The size and the shape may not be same to the original image. But Program know all the…
doree007
  • 89
  • 2
  • 12
5
votes
4 answers

3D template matching by opencv

I have a 3D matrix (very large, let call it L) and a 3D small one (very small, let call it S) and want to use OpenCV to find the closest pattern in L. Does OpenCV do it for me? If yes, how I should use it? Thanks.
Nicole
  • 477
  • 3
  • 9
  • 19
4
votes
4 answers

image matching, affine warp

My problem is shown here: problem statement. I have one template image, which i have to detect in the camera image. After it is detected i have to normalize the camera image by using an affine transformation. The goal of my work is to identify the…
4
votes
0 answers

Template Matching with Python 3.9.1, opencv.python 4.5.1.48 and mask (transparency)

I had the same problem as this question since 2J, but none of the answers worked with Python 3, so today I took all day to solve the problem: python opencv cv2 matchTemplate with transparency (graphics taken from the question) I finally managed to…
4
votes
2 answers

How to automatically adjust the threshold for template matching with opencv?

so I am using opencv to do template matching like below. I constantly need to fiddle with the visual similarity #THRESHOLD, because it fails to discover matches sometimes or it returns way too many matches. It's a trial and error until it matches…
user299709
  • 4,922
  • 10
  • 56
  • 88
4
votes
1 answer

Mask Issue With Python OpenCV ORB Image Alignment

I am trying to implement a Python (3.7) OpenCV (3.4.3) ORB image alignment. I normally do most of my processing with ImageMagick. But I need to do some image alignment and am trying to use Python OpenCV ORB. My script is based upon one from Satya…
fmw42
  • 46,825
  • 10
  • 62
  • 80
4
votes
1 answer

Template match - different sizes of template and image

I have an image, which I can obtain at better quality (e.g. higher size). The problem is that I can't do template match on default size, only on a higher one. And the higher one is not fixed - it can be anything from 1.0 to 2.5x of original image. I…
mnn
  • 1,952
  • 4
  • 28
  • 51
4
votes
1 answer

OpenCV matchTemplate threshold values for different methods

I searched a lot for finding the threshold values for the below mention methods. methods = ['cv2.TM_CCOEFF', 'cv2.TM_CCOEFF_NORMED', 'cv2.TM_CCORR', 'cv2.TM_CCORR_NORMED', 'cv2.TM_SQDIFF', cv2.TM_SQDIFF_NORMED'] I also tried to figure…
Charan
  • 1,051
  • 3
  • 12
  • 32
4
votes
1 answer

Explain difference between opencv's template matching methods in non-mathematical way

I'm trying to use opencv to find some template in images. While opencv has several template matching methods, I have big trouble to understand the difference and when to use which by looking at their mathematic…
Aaron Shen
  • 8,124
  • 10
  • 44
  • 86
4
votes
1 answer

Improving Template Matching Algorithm for OpenCV

Car detection using OpenCV I am working on a small personal project where i have to know wether an image shown is a car or not. I am using the basic OpenCV python based template matching. Positive Image / Template Image Car Top View :-…
4
votes
1 answer

template matching with two images that differ in color

I'm looking to 1: detect a button 2: determine a winner based on color of the button It seems like template matching is what I should be doing, but that works in greyscale. The buttons im detecting are green and red, but look pretty much identical…
2c2c
  • 4,694
  • 7
  • 22
  • 33
4
votes
2 answers

How to align two images based on a common feature with matchTemplate

I have two images which overlap. I'd like to align these two images. My current approach is to find a common feature (a marking) in both images. I'd then like to align these two images according to the place where the feature overlaps. The images…
Jason
  • 4,346
  • 10
  • 49
  • 75
4
votes
3 answers

Finding the image with best matches from multiple images for SIFT BF-Match

I have read many questions about matching one image with a number of images using SIFT and Brute-Force matching like this and this. Is it possible to do many-with-one kind of matching? What I would like to do is the following. loop through query…
gaya
  • 463
  • 2
  • 6
  • 22
1 2
3
24 25