문제

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

enter image description here

Futhermore, i have some small images, like this, which were cropped from the original image:

enter image description here

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top