Dumb thermometer gets digital output

6 Comments

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.

Setup

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.

Digitizing process

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

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:

  1. Top of PCB
  2. Below PCB on drawer bed
  3. Bottom oven wall
  4. Drawer handle

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

Code is really sketchy, but as usual I uploaded it to Github, feel free to explore.

Comments ( 6 )

  1. ReplyFrank
    This is a really neat project and ties in with some of the OCR work I've been doing. I have to ask though- why not just buy a logging unit, or use an Arduino or something to give nice digital output?
    • Replysaulius
      Good point, Frank. It was a good excuse to spend a day with Python and OpenCV.
      • ReplyWalms
        A day! This only took you a day! Wow that's impressive. Also cool project.
        • Replysaulius
          Thank you, Walms!
  2. Replyagilob
    You were not happy with results from pytesseract, but have you tried training tesseract with custom font? You can just download "digital clock font", train tesseract database with custom range of characters, in your case only with numbers.
    • Replysaulius
      Indeed I have not trained it. I think tesseract deserves second chance!

Leave a reply

Your email address will not be published.