yin-yang-ranch is a collection of Python programs and Rasperry Pi hardware to help manage a small urban permaculture farm. The 2 acre farm is an ongoing science project to build living soil, capture rain in barrels, and grow a
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 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.
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
# zmqimage.py -- classes to send, receive and display cv2 images via zmq | |
# based on serialization in pyzmq docs and pyzmq/examples/serialization | |
''' | |
PURPOSE: | |
These classes allow a headless (no display) computer running OpenCV code | |
to display OpenCV images on another computer with a display. | |
For example, a headless Raspberry Pi with no display can run OpenCV code | |
and can display OpenCV images on a Mac with a display. | |
USAGE: |
NewerOlder