Advertisement
Guest User

OpenCV Heatmap issue

a guest
May 23rd, 2019
845
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2. import numpy as np
  3. import cv2
  4.  
  5. heatmap = np.array([
  6.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  7.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  8.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  9.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  10.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99919313,0.99782705,0.99782705],
  11.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,1.00000000,0.99782705,0.99782705],
  12.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  13.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705],
  14.     [0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705,0.99782705]
  15. ])
  16.  
  17. img = cv2.imread("/home/mfb/Development/DLwithPython/data/dogscats/mini/test/cats/cat.1543.jpg")
  18. heatmap = cv2.resize(heatmap, (img.shape[1], img.shape[0]))
  19. plt.matshow(heatmap)
  20. plt.show()
  21. heatmap = cv2.applyColorMap(np.uint8(255 * heatmap), cv2.COLORMAP_JET)
  22. cv2.imshow("Heatmap", heatmap)
  23. cv2.waitKey(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement