Advertisement
Bernard0x01

Untitled

Apr 27th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. import numpy as np
  2. import skvideo.io
  3. import math
  4. import matplotlib
  5. import matplotlib.pyplot as plt
  6.  
  7. def sup(img1, img2):
  8.     img1 = img1.astype('int32')
  9.     img2 = img2.astype('int32')
  10.     return np.max(img1 - img2)
  11.  
  12. path1 = "/home/ivan/Downloads/IMG_1468_16.avi"
  13. video1 = skvideo.io.vread(path1)
  14.  
  15. path2 = "/home/ivan/Downloads/IMG_1468_16.ogv"
  16. video2 = skvideo.io.vread(path2)
  17.  
  18. # 973 frames
  19. # cnt = 1
  20. # for i in video2:
  21. #     print(cnt)
  22. #     cnt += 1
  23.  
  24. frames1 = []
  25. frames2 = []
  26.  
  27. for i in video1:
  28.     frames1.append(i)
  29.  
  30. for i in video2:
  31.     frames2.append(i)
  32.  
  33. print("Frames count from video {}".format(path1),len(frames1))
  34. print("Frames count from video {}".format(path2), len(frames2))
  35.  
  36. res = {
  37.     "step": [],
  38.     "sup": []
  39. }
  40.  
  41.  
  42.  
  43. print(frames2[1])
  44.  
  45. for i in range(0, len(video1)):
  46.     sp = sup(frames1[i], frames2[i])
  47.     print(i, " sup= ", sp)
  48.     res["step"].append(i)
  49.     res["sup"].append(sp)
  50.  
  51. plt.plot(res["step"], res["sup"])
  52. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement