element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Sci-Pi Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Sci-Pi Design Challenge
  • More
  • Cancel
Sci-Pi Design Challenge
Blog Any Measurement to Pi - Blog #6: Finding Best ORC Technique for Raspberry Pi (Part 2)
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Sci-Pi Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: taifur
  • Date Created: 19 Jun 2023 3:54 AM Date Created
  • Views 1614 views
  • Likes 7 likes
  • Comments 5 comments
  • image processing
  • open cv
  • python
  • ocr
  • camera
  • raspberry pi 4 b
  • sci-pi design challenge
Related
Recommended

Any Measurement to Pi - Blog #6: Finding Best ORC Technique for Raspberry Pi (Part 2)

taifur
taifur
19 Jun 2023
Any Measurement to Pi - Blog #6: Finding Best ORC Technique for Raspberry Pi (Part 2)

In my previous blog I illustrated the OCR result for any display that contains seven segment display like multimeter, digital weight scale, blood pressure meter. I foud that tesseract OCR engine is not good enough for reading seven segment display. Maybe customized training can improve the result (I will try later if time permits). After getting the frustrating result from tesseract I was looking for another alternate OCR engine that can read seven segment display better. I came to know the ssocr (seven segment OCR), a OCR tools design to read only the seven segment display. So, I installed the tool in my Raspberry Pi and did some test with some sample images of multimeter and weight scale. In this blog I will represent the test result and compare with the previous result.

Installing SSOCR to Raspberry Pi

SSOCR does not provide ready to use binaries. You need to build it from source. In order to build ssocr from its source code, you will need some of the functionalities of the xlib (libx11) library in your system and the libimlib2 as well (library for image loading, rendering, saving images). You can install them easily with the following commands:

sudo apt-get update
sudo apt-get install libx11-dev
sudo apt-get install libimlib2-dev

After installing, you can proceed with the build of the ssocr library without any issue.

Best way to install from the latest version on github using the following command:

git clone https://github.com/auerswal/ssocr.git
cd ssocr
sudo make install

You will get the following message in the terminal if it goes correctly.

image

You can also install by downloading tar file.

wget http://www.unix-ag.uni-kl.de/~auerswal/ssocr/ssocr-2.23.1.tar.bz2
bzip2 -d ssocr-2.23.1.tar.bz2
tar xvf ssocr-2.23.1.tar
cd ssocr-2.23.1/
sudo make

To test that it works, download the following sample image and give it a try.

image

Use the following command to download the above test image and run the OCR tool:

wget http://www.unix-ag.uni-kl.de/~auerswal/ssocr/six_digits.png
./ssocr -T six_digits.png

If everything works well you will get the following output:

image

Testing ssocr using sample images

As my environment is ready I can now test the ssocr to understand how correctly it can determine the number from a seven segment display image. These are some sample images of multimeter and weight scale I am going to test using ssocr.

image

I then pre-processed those images using OpenCV to separate the text part. Following images shows the separated portion on which we are interested.

image

From the terminal screenshot above we can see the OCR result for each image but the result is not still satisfactory. One thing I realized that the image which contains any text or symbol at the beginning has bad ocr result. But the image that started only with the seven segment digit and have some symbol or text above or after the image can show a approximate ocr result. The image that contains only the digit without any symbol or text get accurately ocr result. For giving a clear proof I removes the beginning symbols from some of the images manually and test those again and the following terminal shows a better result that previous.

image

This is the operation result in a table:

Preprocessed image OCR result
image 12.03_
image 121.260
image 236.
image 06_0
image _38
image 0021.1
image 008_1
image .982
image 1u1
image 135.21

So, from two experiment first with tesseract ocr and the second with ssocr it is clear that no ocr is perfect. Tesseract is good for text ocr not for seven segment but ssocr is specially designed for detecting number from seven segment display. So, it gives better result from a seven segment display without any symbol or text on the display.

So, as no one is good for all situation I am going to use both of them in my project based on the display. I will add an extra button with the raspberry pi so that user can select the display type using the button. Based on the user input the suitable ocr engine will be applied for ocr operation.

  • Sign in to reply
  • taifur
    taifur over 2 years ago

    Some pre-trained model of tesseract for reading 7 segment display are available in the following GitHub link: https://github.com/Shreeshrii/tessdata_ssd

    Another: github.com/.../digital-display-character-rec

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taifur
    taifur over 2 years ago in reply to mp2100

    Yes, tesseract is very good in simple text without any noise but shows very inaccurate result for seven segment display. Though you can train tesseract for seven segment display you can use ssocr if you want to save your time. I tried with some pre-trained model for reading 7 segment display using tesseract but not better than ssocr. If you only want to read a specific type of font in that case you can train the tesseract with that font and can get very accurate result. As I am going to read different type of display with different font the situation is tough for me.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • taifur
    taifur over 2 years ago in reply to DAB

    Getting accurate result is challenging specially in the case where most of the cases meter's reading contains some symbol like unit and others with the value.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • mp2100
    mp2100 over 2 years ago

    Good to know. I’ve played with tesseract and text. It worked very well. I hadn’t considered 7 segment display recognition. I wanted to trend radon readings in my house with tesseract looking at my radon detector but it has a 7 segment display. I will read up on ssocr, new to me.  

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 2 years ago

    As I said earlier, OCR results can be very interesting, but incorrect.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube