Label Recognition provides a MATLAB application that is capable of recognising expiry dates within a natural image and displaying them back to the user.
The application utilises a fully documented class, LabelRecogniser
, that implements the expiry date detection and recognition algorithm that is provided with this repository.
This project requires MATLAB, a proprietary language developed by MathWorks, for execution.
It is recommended to use the latest stable release of MATLAB. The performance of releases preceding MATLAB 2018a is not guaranteed.
Please check with your institution/organisation to see if you are offered a free MATLAB license. Otherwise, see the licensing options available.
-
Navigate to the latest release of this repository.
-
Download the
Label-Recognition.mlappinstall
file. -
Open the file and follow the instructions until installation completes.
-
Extract the zip file or clone the repository into the desired directory.
-
Add the parent directory (Label-Recognition) to the path by:
- Going to Home → Environment → Set Path, or
- Running
addpath [directory]
in the Command Window, or - Having the parent directory selected as the Current Folder.
-
Use in your own MATLAB code.
Note: Separating the LabelRecogniser.m
file into its own directory may improve path performance.
Ensure that the current folder does not contain LabelRecognition.m
or LabelRecogniser.m
files since they could shadow the app entry point.
-
Go to Apps Tab → My Apps → Label Recognition.
-
Use the GUI window to perform actions such as:
- Selecting an image
- Performing date recognition
- Configuring detection parameters
- Viewing recognised dates
- Outputting dates to a file
Auto-Reflow is used to ensure that the app optimally scales to the desired screen size.
-
Initialise a
LabelRecogniser
object with an image. This can be either a file path or an image matrix.lr = LabelRecogniser('samples/good1.jpeg');
-
Call
recogniseDates()
on theLabelRecogniser
object to identify expiry datesdates = lr.recogniseDates() dates = "25 MAR"
Alternatively, candidate bounding boxes may be returned too.
[dates, bboxes] = lr.recogniseDates() dates = "25 MAR" bboxes = 252.8333 1.0000 106.3333 48.0000 374.1667 241.5000 165.0000 56.0000 ... ... ... ...
Further help is provided by using the Command Window to execute:
doc LabelRecogniser
Fig 1: MATLAB app successfully identifying the expiry date from an image.
Fig 2: MATLAB app automatically reflowing content to fit onto a smaller screen.
Fig 3: MATLAB app displaying Clear error messages that suggest possible fixes.
Alternatively, a demonstration of the LabelRecogniser
class functionality is provided by the main.m
script. Execute it in the Command Window using:
main
A standalone executable version of this project was planned to allow non-MATLAB users to make use of the system. However, due to unforeseen complications relating to C/C++ code generation, this task will take longer than expected.
This is due to several functions such as wiener2
, detectMSERFeatures
, imresize
, imcrop
and ocr
having quirks that will require a major rework of the LabelRecogniser
class due to incompatibilities with the MATLAB Compiler.
Additional details for this problem can be found on the issues page. Any contribution will be greatly appreciated.
Daniel Turner - turnerdaniel
Li, Y. and Lu, H. (2012) Scene Text Detection via Stroke Width. In: 21st International Conference on Pattern Recognition (ICPR 2012), Tsukuba, Japan, 11-15 November. IEEE, 681–684. Available from https://ieeexplore.ieee.org/document/6460226 [accessed February 2019].
MathWorks (2019) Automatically Detect and Recognize Text in Natural Images. Available from https://uk.mathworks.com/help/vision/examples/automatically-detect-and-recognize-text-in-natural-images.html [accessed February 2019].