Store Image: https://drive.google.com/open?id=1uNx_6KeQaNtKNj1Y2Npd-vOvJ4Pf-X4m Product Image: https://drive.google.com/open?id=1bev8AjajqbaceUPxVs2Z3iuqUOZaeoE-
I have to find a product image in store image If you look carefully, the appy is different. The product image is 2D while the store image is 3D
Any another approach?
I have tried Template matching function of opencv
import cv2
import numpy as np
img_rgb = cv2.imread('C:\\Users\\ambuj\\Desktop\\NIFLR\\store1.png')
img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY)
template = cv2.imread('C:\\Users\\ambuj\\Desktop\\NIFLR\\appy1.png',0)
template= cv2.resize(template,(25,65))
w,h = template.shape[::-1]
res = cv2.matchTemplate(img_gray,template,cv2.TM_SQDIFF)
threshold = 0.1
loc = np.where( res >= threshold)
for pt in zip(*loc[::-1]):
cv2.rectangle(img_rgb, pt, (pt[0] + w, pt[1] + h), (0,0,255), 2)
break
cv2.imshow('Detected',img_rgb)
cv2.waitKey(0)
cv2.destroyAllWindows()
Expected Result: In the image where there is appy there should be a rectangle
Actual result: https://drive.google.com/open?id=18QiX4MWa90jIGdvhfRn5dEOwIA6SHYlx
There is red rectangle at top left most corner.