Questions tagged [template-matching]

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

363 questions
0
votes
0 answers

How to find several identical templates OpenCV Python

Sorry for the noob question. My problem is that multiscale finds only one of several templates in the image and I need all of them. How can i fix this? I am only beginner, I will be grateful for any help or criticism. for image in ims: gray =…
knowname
  • 29
  • 7
0
votes
0 answers

Are there ways to do some crops in an image based on a given pattern?

I have an image of pots of the same size, the user must crop an area (let's say he crops the first pot (top left corner)) of ​​the image and depending on the pattern designed or cropped by the user, I must automatically perform other cropping and…
0
votes
0 answers

Python OpenCV - certaincy score templateMatch

I have the following code for OpenCV templateMatch, a scan and a template (from a question I asked earlier here): import cv2 import numpy as np #load image into variable img_rgb = cv2.imread('example_scan.jpg') #load template template =…
Ganesh Gebhard
  • 453
  • 1
  • 7
  • 20
0
votes
1 answer

template matching with multiple objects opencv python

I have a scanned image document like this: That image was scanned using an ordinary scan engine so it is possible for the document to be skewed. the image has been carried out a binarization process, so there is still a little noise. I want to know…
ircham
  • 129
  • 13
0
votes
0 answers

Template matching at multi-scale, normed methods not working

I'm trying to do multi scale template matching for some signature segmatation, and I'm stuck because I want to get the "accuracy" rating of the best match it returns. The results return correctly when I use cv2.TM_CCOEFF and cv2.TM_CCORR, but once…
chiff
  • 1
  • 1
0
votes
0 answers

How to tell if matchTemplate succeeds?

I am writing a program that will take a screenshot every few seconds then attempt to template match this screenshot with a predetermined template. However, if I were to attempt to do an if statement, how would I write that? How can I determine…
Bran
  • 19
  • 6
0
votes
0 answers

TypeError: only size-1 arrays can be converted to Python scalars (cv2, template matching)

I'm trying to use cv2 for template matching on a screen recording, but am running into an error that is telling me: TypeError: only size-1 arrays can be converted to Python scalars Source Code: import numpy as np from PIL import ImageGrab import…
Bran
  • 19
  • 6
0
votes
0 answers

Template matching two 3D numpy array

I have an 3D numpy array, start_array, I do some processing to it by applying some random translations and rotations to get transform_arry. I have access to both the arrays only. I want to identify the random transforms done to the arrays. What…
a_parida
  • 606
  • 1
  • 7
  • 26
0
votes
0 answers

openCV cv::matchTemplate running twice slower on a "better/newer" intel cpu

I am using cv::matchTemplate to track a moving object in a video. However, running the template matching of open cv with a small picture can be slower on a better/newer intel's CPU. The code snippet below run typically 2 times slower on a i9-7920x…
pepece
  • 360
  • 5
  • 17
0
votes
1 answer

Template Matching of a single template with multiple source images

I have a template "X"(symbol) which is cropped out of "Image1". I am using OpenCV's matchTemplate() method to match the template "X" with "Image1" and it does that successfully. However, I have another image called "Image2" which has contains the…
Ashlin Karkada
  • 1,320
  • 1
  • 12
  • 20
0
votes
1 answer

Python cv2 not matching template with main image

I have my main image: And my template: However, the cv2 code that i am using is not generating the rectangle to show that there is a match, but I am also receiving 0 errors. Here is the code: # Read the main image img_rgb =…
hanz
  • 49
  • 6
0
votes
2 answers

Python 3.x - TypeError: unhashable type: 'numpy.ndarray'

I have this code: templates = { '1.png': 0.7, '2.png': 0.7, '4.png': 0.7, } img_rgb = cv2.imread('mta-screen_2020-01-01_12-07-24.png') img_speed = img_rgb[983:1000, 1464:1510] cv2.imwrite('cropped.png', img_speed) img_speed_gray =…
0
votes
0 answers

Image matching not working for unknown reason

I'm using PyAutoGUI's built in OpenCV image matching like this and it returns None every time: pyautogui.locateOnScreen('img.png', greyscale=True, confidence=0.5) I've tried many different confidences I've confirmed that python-opencv is installed…
Holabola
  • 143
  • 1
  • 3
  • 11
0
votes
3 answers

How to adjust the threshold for template matching in openCV (java)?

I am running template matching using openCV 3.4.7 Android SDK (java). The code work almost perfectly; when the template is match, it draws a rectangle on the matching area. The problem is that even when there is no match, it draws a random…
DeborahAnn
  • 191
  • 1
  • 11
0
votes
1 answer

Template matching for time series using dask

I would like to use template matching with time-series, and I would like to be able to port this to very large datasets. The objective is to look for many relatively short 1d pattern in a relatively long time-series. Any suggestion on how to do this…