Tesseract for logos and Fonts - tesseract

There are some logos for which OCR needs to be run . Logos generally have different fonts. A sample is below. When tesseract was run with all possible psm values RITZ is not getting detected. Also tried converting to black and white using cv2.threshold(grayImage, 120, 255, cv2.THRESH_BINARY) still the R is not getting detected. Can someone tell what technique to be done for these strange fonts. ( I am using python)

It is a problem with tessaract it cant detect complex or handwritten characters. We can use tesseract for simple printed character detection. For complex or handwritten you can try CNN or KNN aalgorithm trained under dataset.(chars74k, A-Z Handwritting)

Related

How to display Unicode characters on Adafruit SSD1306 using Arduino IDE?

I am willing to display a non-ASCII character in Adafruit SSD1306. The corresponding character set is in Unicode. Their library does not show where actually the mapping between ASCII & pixel drawing is done. If it was there, I'd've written code to display the characters that I need.
The hardware library depends on Adafruit GFX library; even this library doesn't explain how the mapping is done.
So, which part of the actually maps an ASCII & pixels on display?
OR Any idea to display Unicodes directly?
OR How'd you get started if pixel by pixel configuration is needed?
I am using Arduino IDE, NodeMCU, Adafruit SSD1306 128x64 I2C monochrome LED display. The text that am trying to display is large and so, am not willing to it in BMP image way.
The mapping between ASCII & pixel drawing is done in the font files.
See:
Adafruit-GFX-Library/Fonts/
Adafruit-GFX-Library/fontconvert/
Adafruit-GFX-Library/gfxfont.h
Adafruit-GFX-Library/glcdfont.c
So maybe you can create your own characters or font to display what you need.

Tesseract training image by image

Is there any simple way to train tesseract by giving from command line image and letter that it corresponds to? I know that there are some application that make tesseract learning easier, but I need a custom one, one image - one letter. Of course there may be few images of same letter.

visualising l*a*b space values in matlab or any software

I have table of l,a,b values and want to visualise these colors in matlab (or any other suitable software). Is there any quick way like series of rectangles filled with color values from the table?
There are several versions of the Lab color space, but presumably you're referring to most common, CIELAB. You can use imwrite in Matlab to create a TIFF image with 'cielab' specified for the 'Colorspace' option. I wouldn't trust Matlab as a viewer for the resultant images though. Photoshop in lab mode (from the menu bar: Image > Mode > Lab Color) would be a good choice if you want work with and see the closest thing to the actual CIELAB space. Other viewers/editors may convert to RGB or CMYK before rendering to the screen (likely without warning you), but maybe you don't mind. If you just want to convert from CIELAB to RGB, you might find these functions useful.
After lots of research, I found out there is a plugin called 'color inspector' that can be used along with ImageJ (all opensource tools). Have excellent capacity to view and analyse different color space. Even it has some color tools that matlab yet to have. here is imageJ: http://rsbweb.nih.gov/ij/download.html
and the plugin
http://rsb.info.nih.gov/ij/plugins/color-inspector.html
Hope this is useful to someone

Tesseract Trained data

Am trying to extract data from reciepts and bills using Tessaract , am using tesseract 3.02 version .
am using only english data , Still the output accuracy is about 60%.
Is there any trained data available which i just replace in tessdata folder
This is the image nicky provided as a "typical example file":
Looking at it I'd clearly say: "Forget it, nicky! You cannot train Tesseract to recognize 100% of text from this type of image!"
However, you could train yourself to make better photos with your iPhone 3GS (that's the device which was used for the example pictures) from such type of receipts. Here are a few tips:
Don't use a dark background. Use white instead.
Don't let the receipt paper crumble. Straighten it out.
Don't place the receipt loosely on an uneven underground. Fix it to a flat surface:
Either place it on a white sheet of paper and put a glas platen over it.
Or use some glue and glue it flat on a white sheet of paper without any bend-up edges or corners.
Don't use a low resolution like just 640x480 pixels (as the example picture has). Use a higher one, such as 1280x960 pixels instead.
Don't use standard exposure. Set the camera to use extremely high contrast. You want the letters to be black and the white background to be really white (you don't need the grays in the picture...)
Try to make it so that any character of a 10-12 pt font uses about 24-30 pixels in height (that is, make the image to be about 300 dpi for 100% zoom).
That said, something like the following ImageMagick command will probably increase Tesseract's recognition rate by some degree:
convert \
http://i.stack.imgur.com/q3Ad4.jpg \
-colorspace gray \
-rotate 90 \
-crop 260x540+110+75 +repage \
-scale 166% \
-normalize \
-colors 32 \
out1.png
It produces the following output:
You could even add something like -threshold 30% as the last commandline option to above command to get this:
(You should play a bit with some variations to the 30% value to tweak the result... I don't have the time for this.)
Taking accurate info from a receipt is not impossible with tesseract. You will need to add image filters and some other tools such as OpenCV, NumPy ImageMagick alongside Tesseract. There was a presentation at PyCon 2013 by Franck Chastagnol where he describes how his company did it.
Here is the link:
http://pyvideo.org/video/1702/building-an-image-processing-pipeline-with-python
You can get a much cleaner post-processed image before using Tesseract to OCR the text. Try using the Background Surface Thresholding (BST) technique rather than other simple thresholding methods. You can find a white paper on the subject here.
There is an implementation of BST for OpenCV that works pretty well https://stackoverflow.com/a/22127181/3475075
i needed exactly the same thing and i tried some image optimisations to improve the output
you can find my experiment with tessaract here
https://github.com/aryansbtloe/ExperimentWithTesseract

Count horizontal And Vertical line In Image

Can Any One Help me For Counting Number of Horizontal And Vertical Line in Image
This is for Part of Feature Extraction Project For OCR
Thx a lot
More Information :
" My Project is Finding Number in Image So its OCR Project
im gona Use Neural Network in Matlab
But My Problem Is what Feature should i Send To Network "
If you are just starting out and have no idea what to do take a look at:
https://stackoverflow.com/questions/850717/what-are-some-popular-ocr-algorithms
This is implemented in C#.
Here is a project that does OCR, may also be useful to you:
http://www.codeproject.com/Articles/160868/A-C-Project-in-Optical-Character-Recognition-OCR-U
Or this may be some use, after searching a while Tesseracts seemed to be relevant:
http://code.google.com/p/tesseract-ocr/downloads/detail?name=tesseract-ocr-setup-3.01-1.exe&can=2&q=
Goodluck