Git Product home page Git Product logo

seven-segment-digit-recognition's Introduction

Seven Segment Digit Recognition

This repository implements seven segment digit recognition in MATLAB®.

Open in MATLAB Online

Creator: MathWorks Development

Requirements

  • MATLAB R2022b or later
  • Deep Learning Toolbox™
  • Computer Vision Toolbox™
  • Computer Vision Toolbox™ Model for Text Detection

Note: Previous MATLAB release users can use this branch to download the pretrained models.

Overview

This repository implements seven segment digit recognition using two steps. The first step detects the location of image text using detectTextCRAFT function that requires Deep Learning Toolbox™ and Computer Vision Toolbox™ Model for Text Detection. The second stage uses the OCR function from the Computer Vision Toolbox™ to recognize the digits.

The two-step approach helps improve OCR by only processing image regions that contains text. This is useful in industrial automation applications where the digital displays are often surrounded by other objects and background content that can hinder the performance of OCR.

Recognize Seven Segment Digits

% Read image.
  orgImg = imread('sevenSeg.png');
  
% Detect seven segment digits.
  bboxes = detectTextCRAFT(orgImg);

% Binarizing the image before using OCR for better results.
  I = rgb2gray(orgImg);
  BW = imbinarize(I, 'adaptive');
  BW = ~BW;
  
% Recognize seven segment digit using ocr.
  output = ocr(BW,bboxes,Model="seven-segment");
 
% Display results.
  recognizedWords = cat(1,output(:).Words);
  Iocr = insertObjectAnnotation(orgImg, 'rectangle',bboxes,recognizedWords);
  figure; imshow(Iocr);

image

Note: To improve OCR results, see Troubleshoot ocr Function Results.

References

[1] Baek, Y., Lee, B., Han, D., Yun, S. and Lee, H., 2019. Character region awareness for text detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (pp. 9365-9374).

Copyright 2021-2024 The MathWorks, Inc.

seven-segment-digit-recognition's People

Contributors

anshika-mw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

seven-segment-digit-recognition's Issues

Error while Testing with New Image

Hi,
I am Newbee to this environment..
I have cloned the repo and opened in matlab and tried the commands as it in readme file it works well.
When i place a new pic .jpg in images folder and tried with steps had mentioned i am getting the error

addpath('src','images');
>> orgImg = imread('new.jpg');
>> [image, imageScale] = helper.preprocess(orgImg);
>> boundingBoxes = helper.textDetection(image,imageScale);
Pretrained Text Detector already exists.

Index in position 1 exceeds array bounds. Index must not exceed 1.

Error in helper.getQuadBoxes (line 82)
        w = norm(boxes(k,[3 4]) - boxes(k,[1 2]));

Error in helper.textDetection (line 27)
    bboxes = helper.getQuadBoxes(regionScore, affinityScore, textThreshold, linkThreshold, lowText);

"I have one more question: Will this repository also work without MATLAB?"

Thank You

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.