Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. comp = cv2.compareHist(H1, H2, cv2.HISTCMP_CHISQR)
  2.  
  3. height, width = gray_image.shape
  4. while comp >= maxDist:
  5. for x in range(height):
  6. gray_image[x,0] = 255
  7. gray_image[x, width-1] = 255
  8.  
  9. for y in range(width):
  10. gray_image[0,y] = 255
  11. gray_image[height-1, y] = 255
  12.  
  13. cv2.imshow("image", gray_image)
  14.  
  15. H1 = cv2.calcHist( gray_image, [0], None, [256], [0,256])
  16. H2 = cv2.calcHist(gray_image, [0], None, [256], [0,256])
  17. comp = cv2.compareHist(H1, H2, cv2.HISTCMP_CHISQR)
  18. print(comp)
  19.  
  20. cv2.waitKey(0)
  21. camera.release()
  22. cv2.destroyAllWindows()
  23. else:
  24. camera.release()
  25. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement