简体   繁体   中英

Find image inside another in SimpleCV

I'm using Python and SimpleCV (but is ok to use OpenCV too) and i have an image:

在此处输入图片说明

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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