Tejendhu

Untitled

Oct 18th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. from __future__ import division
  2. import cv2
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5. import hikvision.api
  6. import time
  7. # cap = cv2.VideoCapture("rtsp://admin:192.168.1.64@10.162.1.49")
  8. cap = cv2.VideoCapture("rtsp://admin:admin@10.12.4.115/1/h264minor")
  9. # fgbg = cv2.createBackgroundSubtractorMOG2()
  10. cam = hikvision.api.CreateDevice('192.168.2.5', username='admin', password='admin')
  11. to_change = True
  12. if __name__ == '__main__':
  13. i =0
  14. start_time = time.time()
  15. while True:
  16. i += 1
  17. current_time = time.time()
  18. if current_time - start_time > 5:
  19. if to_change:
  20. # Do
  21. response = cam.System.deviceInfo(method='get')
  22. print(response)
  23. to_change = False
  24. ret, img = cap.read()
  25. # print ret
  26. cv2.imshow('original', img)
  27. if cv2.waitKey(1)>0:
  28. break
  29. cv2.destroyAllWindows()
Add Comment
Please, Sign In to add comment