Reading Seven Segment Displays
IntroductionMany sensors do not have a simple way to plug directly into them -- and even when there is a way to hack it, it often involves mad-surface-mount soldering skills. Simply reading a seven segment diplay allows one to share one's tools with the robot and have the "hey, can you do this for me?" kind of feel. While normal black-and-white text is easy, seven-segment displays are super hard for bots! Thankfully and thanks to the creators of ssocr, there is a way we can give our bots this essential skill.
Installation Of Seven-Segment-Optical-Character-Recognition (ssocr)First we must install the dependencies:
sudo apt-get install libimlib2 libimlib2-devNext we download the ssocr binary from the following site: http://www.unix-ag.uni-kl.de/~auerswal/ssocr/ Extract it, cd into the directory, then make the project with a simple:
make...that was simple. For good measure let's also install it into our system for use outside the folder:
sudo make install
ssocr crop 190 73 80 100 -d 2 image.jpg -t 20The code above resulted in
19being placed into standard-out.
UsageYou will need to make sure that the number of digits is known, and the bounding box for the digits.
- Bounding Box
- grab x and y of top-left corner (pixels measured from top-left as per usual)
- get the width and height in pixels respectively
ssocr crop top_left_x top_left_y width height -d number of digits expected the_image_name.jpg -t black_white_threshold_percent
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.