By Saulius from Kurokesu blog
Some time ago I purchased 4 channel thermometer. Soon after tried few optical character recognition (OCR) techniques on 7 segment symbols including pytesseract, they worked but I was not happy with results. Few days ago pyimagesearch published article detailing his approach. So I pushed it a bit forward and made solution more robust. Also added possibility to analyze video instead of single frame.
Not much was needed – camera, thermometer and bracket to keep them mechanically connected.
Attaching C-clamp directly to instrument is kind of cruel, but this is quick and dirty setup. Additional light was not needed, camera and algorithm worked fine with regular room lights.
First we need to find where useful information is located. Algorithm searches for approximated polygon with 4 edges. If your device has rectangular high contrast frame there is a chance that LCD boundaries will be detected automatically, otherwise mask remaining frame except LCD itself with white trapezoid.
Then we need to find out where our digits are located. Take frame where where most of the segments are on (initial frame from power-up when all segments are turned on would be perfect) and process it with another script.
Two configuration files will be saved to disk. These files will be used during normal OCR operation.
Below is an animation how each segment is being located and recognized. Red highlighted clip is debug output to confirm correct segment location, threshold and identification. Green boundaries with recognized numbers is debug output of video stream.
Results are saved to CSV file and ready to be imported into LibreOffice. Graph below visualizes two cycles of reflow oven. Sensors were placed on:
If you zoom-in graphic, some artifacts will be seen. This is an issue with cheap thermometer, seems like it has calculation problems when temperature ramp is too steep.
Code is really sketchy, but as usual I uploaded it to Github, feel free to explore.