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.py 780B

1234567891011121314151617181920212223
  1. from imutils.video import VideoStream
  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://{}:63128".format(
  14. args["server_ip"]))
  15. rpi_name = socket.gethostname() # send RPi hostname with each image
  16. picam = VideoStream(usePiCamera=True).start()
  17. time.sleep(2.0) # allow camera sensor to warm up
  18. while True: # send images as stream until Ctrl-C
  19. image = picam.read()
  20. sender.send_image(rpi_name, image)