Skip to content

Instantly share code, notes, and snippets.

@wwj718
Created July 26, 2019 03:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwj718/7a658bf66e10430c83f1cb53cdd8dc21 to your computer and use it in GitHub Desktop.
Save wwj718/7a658bf66e10430c83f1cb53cdd8dc21 to your computer and use it in GitHub Desktop.
import socket
import time
from imutils.video import VideoStream
import imagezmq
sender = imagezmq.ImageSender(connect_to='tcp://wwj-macbook.local:5555')
rpi_name = socket.gethostname() # send RPi hostname with each image
picam = VideoStream(usePiCamera=True).start()
time.sleep(2.0) # allow camera sensor to warm up
while True: # send images as stream until Ctrl-C
image = picam.read()
sender.send_image(rpi_name, image)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment