The API for imagezmq consists of 2 classes with 2 methods each. The ImageSender class has 2 methods: one for sending an OpenCV image and one for sending a jpg compressed OpenCV image. The ImageHub class has 2 methods: one for receiving an OpenCV image and one for receiving a jpg compressed OpenCV image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#imagenode.py snippet | |
# (all the imports, logging setup hidden for now) | |
settings = Settings() # get settings for node cameras, ROIs, GPIO | |
node = ImageNode(settings) # start ZMQ, cameras and other sensors | |
# forever event loop | |
while True: | |
node.get_sensor_data() # grab camera images and other sensor data | |
node.process_sensor_data() # detect motion, etc. | |
while len(node.msg_q) > 0: | |
try: |
The test programs show how imagezmq can be used to capture images on Raspberry Pi computers, send them to a Mac via imagezmq and then display them on the Mac. The ability for one hub to gather and process images from multiple sources allows computer vision pipelines to distribute vision processing across multiple computers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""test sending a jpg buffer and check type & size of buffer | |
A simple test program that creates an image, then converts it to a | |
jpg_buffer and checks the type(), ndim, size and shape of the jpg_buffer. | |
This program tests some imports and some OpenCV functions, as well. | |
Open Source Licensed under MIT License (MIT) | |
Copyright (c) 2020, Jeff Bass, jeff@yin-yang-ranch.com | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#imagehub.py snippet | |
# (all the imports, logging setup hidden for now) | |
settings = Settings() # get settings from YAML file | |
hub = ImageHub(settings) # start ImageWriter, Timers, etc. | |
# forever event loop: receive & process images and text from imagenodes | |
while True: | |
try: | |
with Patience(hub.patience): | |
text, image = hub.receive_next() | |
except Patience.Timeout: # if no timely message from any node |
OlderNewer