sleep ( 2.0 ) # allow camera sensor to warm up 12 while True : # send images as stream until Ctrl-C 13 image = picam. gethostname () # send RPi hostname with each image 10 picam = VideoStream ( usePiCamera = True ). ImageSender ( connect_to = 'tcp://jeff-macbook:5555' ) 8 9 rpi_name = socket. Then, on each Raspberry Pi, run: 1 # run this program on each RPi to send a labelled image stream 2 import socket 3 import time 4 from import VideoStream 5 import imagezmq 6 7 sender = imagezmq. imshow ( rpi_name, image ) # 1 window for each RPi 8 cv2. ImageHub () 5 while True : # show streamed images until Ctrl-C 6 rpi_name, image = image_hub. Pi and with 8 lines of Python on the Mac.įirst, run this code on the Mac (or other display computer): 1 # run this program on the Mac to display image streams from multiple RPis 2 import cv2 3 import imagezmq 4 image_hub = imagezmq. Using imagezmq, this is possible with 11 lines of Python on each Raspberry
Mac computer showing simultaneous video streams from 8 Raspberry Pi cameras: Imagezmq is a set of Python classes that transport OpenCV images from oneĬomputer to another using PyZMQ messaging.