Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

zmq_video_client_file.py 786B

1234567891011121314151617181920212223242526
  1. from imutils.video import FileVideoStream
  2. import imagezmq
  3. import argparse
  4. import socket
  5. import time
  6. # construct the argument parser and parse the arguments
  7. ap = argparse.ArgumentParser()
  8. ap.add_argument("-s", "--server-ip", required=True,
  9. help="ip address of the server to which the client will connect")
  10. args = vars(ap.parse_args())
  11. # initialize the ImageSender object with the socket address of the
  12. # server
  13. sender = imagezmq.ImageSender(connect_to="tcp://{}:5555".format(
  14. args["server_ip"]))
  15. rpi_name = socket.gethostname() # send RPi hostname with each image
  16. video_file = FileVideoStream("run.mp4").start()
  17. time.sleep(2.0) # allow camera sensor to warm up
  18. while True:
  19. image = video_file.read()
  20. if image is None:
  21. break
  22. sender.send_image(rpi_name, image)