Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. http://10.5.5.9/gp/gpControl/execute?p1=gpStream&a1=proto_v2&c1=restart
  2.  
  3. udp://10.5.5.9:8554
  4.  
  5. cap = cv2.VideoCapture("udp://:8554", cv2.CAP_FFMPEG)
  6. sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  7. last_message = time.time()
  8.  
  9. while some_condition():
  10.  
  11. # Get an image
  12. ret, img = cap.read()
  13.  
  14. # Do something with img
  15. cv2.imshow("My Window", img)
  16. cv2.waitKey(1)
  17.  
  18. # Keep alive.
  19. current_time = time.time()
  20. if current_time - last_message >= keep_alive_period/1000:
  21. logger.info("Sending keep alive message to %s.", self.host)
  22. sock.sendto(message, ("10.5.5.9", 8554))
  23. last_message = current_time
  24.  
  25. cv2.destroyWindow(window_name)
  26. cap.release()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement