Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. def methodHierarchical(image,template,minX,minY):
  2. #success,image = vidcap.read()
  3.  
  4.  
  5.  
  6. #template=cv2.imread('reference.jpg')
  7.  
  8.  
  9.  
  10. image_gray=image
  11. template_gray=template
  12.  
  13. width,height=image_gray.shape[::-1]
  14.  
  15. #image_blur=cv2.blur(image_gray,image_gray.shape)
  16. #=cv2.blur(template_gray,template_gray.shape)
  17.  
  18. imageSub=cv2.pyrDown(image_gray)
  19. tempSub=cv2.pyrDown(template_gray)
  20.  
  21. imageSub2=cv2.pyrDown(imageSub)
  22. tempSub2=cv2.pyrDown(tempSub)
  23.  
  24.  
  25. x2,y2,tx,ty=methodExhaustive(imageSub2,tempSub2,int(minX/4),int(minY/4),1,p)
  26.  
  27.  
  28. x1,y1,tx,ty=methodLog(imageSub,tempSub,x2*2,y2*2,1,3)
  29.  
  30.  
  31.  
  32. w,h=template.shape[::-1]
  33.  
  34. return x1*2,y1*2,x1*2+w,y1*2+h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement