Read a seven-segment display (SSD) using OpenCV and the Raspberry Pi Camera
Install OpenCV and required modules on Raspbian:
sudo apt-get install python-opencv python-numpy python-picamera python-matplotlib python-scipy
Run the script:
Run the script: python SSD_Reader.py
Alternatively, use a python command line:
After running python SSD_Reader.py
with calibration_image = True
and modifying calibration values to locate SSD:
from SSD_Reader import read_SSD
read_SSD()
Screenshot:
Method:
- Take a photo with the Raspberry Pi Camera
- Crop image to the seven-segment display (SSD)
- Process and filter image to binary (black and white)
- Calculate average pixel value over segment regions
- Display segment regions whose average pixel values exceed a threshold
- Convert to a number and return the value
- (Optional) Plot the value over time along with the SSD and processing images
- (Optional) Save the value with timestamp to file for later manipulation