简体   繁体   English

在SimpleCV中查找另一个图像

[英]Find image inside another in SimpleCV

I'm using Python and SimpleCV (but is ok to use OpenCV too) and i have an image: 我正在使用Python和SimpleCV(但也可以使用OpenCV),并且我有一个图像:

在此处输入图片说明

Futhermore, i have some small images, like this, which were cropped from the original image: 此外,我有一些像这样的小图像,是从原始图像中裁剪出来的:

在此处输入图片说明

Assuming that the first image contains the second, I would like to get the second's image coordinates in regard of first, before cropping. 假设第一个图像包含第二个图像,我想在裁剪之前获取第二个图像相对于第一个图像的坐标。 How I can make this? 我该怎么做?

Use matchTemplate in OpenCV: 在OpenCV中使用matchTemplate

diff = cv2.matchTemplate(img1, img2, cv2.TM_CCORR_NORMED)
x, y = np.unravel_index(np.argmax(diff), diff.shape)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM