Matlab R2014a supports visionSupportPackages in Computer Vision Toolbox

Whaether visionSupportPackages in Computer Vision Toolbox will support only in R2014b or it will also support R2014a. I had Matlab R2014a. But I can't able to install visionSupportPackages. It gives the error message as 'Undefined function or variable 'visionSupportPackages'. How to solve it. Thanks

 Accepted Answer

The support packages for the Computer Vision System Toolbox are only available for the release R2014b or later. There are only two support packages: Computer Vision System Toolbox OCR Language Data, and Computer Vision System Toolbox OpenCV Interface.
If you are interested in the OCR Language Data package, please check the documentation for the ocr function in the R2014a release for instructions on how to download Tesseract language data files.

7 Comments

Hi Dima, Actually I need a ocr for Tamil language. From the Mathworks r2014b help its states that the language was available. I download tam.Tesseract from Google. But I can't able to install it. I also check the Matlab 2014a installation direcory. It contains only English and Japanese Tesseract language data files. Please help to how to download and install other language files in matlab r2014a. Thanks in advance
Hi Brindha,
First of all, please always look at the documentation for the release that you have. The Computer Vision System Toolbox is under heavy development, and every release adds lots of new features. Please, either use the documentation that comes with your installation, or look for "Older Releases" on the Mathworks documentation web site.
If you look at the R2014a documentation for the ocr() function you will see the following instructions for installing a custom language file:
You can use the ocr function with trained data files to perform text recognition with custom languages. To use a custom language, specify the path to the trained date file as the language string. You must name the file in the format, language.traineddata. The file must be located in a folder named ‘tessdata'. For example:
txt = ocr(img,'Language','path/to/tessdata/eng.traineddata');
You can load multiple custom languages as a cell array of strings:
txt = ocr(img, 'Language', ...
{'path/to/tessdata/eng.traineddata',...
'path/to/tessdata/jpn.traineddata'});
The containing folder must always be the same for all the files specified in the cell array. In the preceding example, all of the traineddata files in the cell array are contained in the folder ‘path/to/tessdata' . Because the following code points to two different containing folders, it does not work.
txt = ocr(img, 'Language', ...
{'path/one/tessdata/eng.traineddata',...
'path/two/tessdata/jpn.traineddata'});
Some language files have a dependency on another language. For example, Hindi training depends on English. If you want to use Hindi, the English traineddata file must also exist in the same folder as the Hindi traineddata file. You can download Tesseract 3.02 language data files to use with the ocr function from the tesseract-ocr website.
Note: To use the ocr function with the downloaded language zipped files, you must unzip all files.
Hi Dima, Thanks for your reply. I already read this doc and try to implement it. But it does not produce the correct result. that is the letters are not recognized correctly.(Even a single character). Herewith I attached my code.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%Matlab code grayImage = rgb2gray(handles.S);
txt = ocr(grayImage, 'Language', ... {'C:/Program Files/MATLAB/R2014a/toolbox/vision/visionutilities/tessdata/eng.traineddata',... 'C:/Program Files/MATLAB/R2014a/toolbox/vision/visionutilities/tessdata/tam.traineddata'});
regularExpr = '\w'; bboxes = locateText(txt, regularExpr, 'UseRegexp', true); chars = regexp(txt.Text, regularExpr, 'match'); Ichars = insertObjectAnnotation(handles.S, 'rectangle', bboxes, chars);
set(handles.ttext,'String','Character Detection'); axes(handles.Image); imshow(Ichars); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1. I download tam.traineddata from "https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.tam.tar.gz" and copy it into matlab-testdata folder. Whether is it correct? For English the installation folder contains lot of files like eng.cube.bigrams, eng.cube.fold etc. Is it necessary or available for tamil?
2. While searching I download "tam_latha_image_box.tar" which contains tam.latha.box and tam.latha.tif. A tif file contains the sequence of images contains tamil characters. But i am not clear how to install it and whether it is needed.
3. Whether is it needed to install Tesseract in my system?
Thanks Brindha.S
Hi Brindha,
1) you do not need to put the tam.traineddata file into the visionutilties folder. You could have just unzipped the file to any directory, e.g.
c:\tessdata\tam.traineddata
And then used it like this:
txt = ocr(I, 'Language', 'c:\tessdata\tam.traineddata')
2) You should only need whatever was in the zip file you downloaded from tesseract-ocr.googlecode.com. You do not need tam_latha_image_box.tar.
3) You do not need to install Tesseract on your system.
If you're not getting good recognition results, you may need to clean up your image prior to running the OCR function. Take a look at the following examples for some techniques to pre-process your images for OCR:
If possible, upload your image. There might be some easy pre-processing steps that will help improve recognition results.
Hi Birju Patel, Thank you for your reply. It will be very useful to me. But it shows some error. I will try with and without preprocessing steps. But both methods producing the same error as "Unable to load language data". But I am sure on path. Its correct. The files I used are uploaded here: %%%%%%%%%%%% Method 1- Without preprocessing I = imread('images/amma.jpg'); results = ocr(I, 'Language', 'E:/Brindha/PhaseII/SourceCode/Source Code/trained/tam.traineddata');
% Display one of the recognized words word = results.Words{2}
% Location of the word in I wordBBox = results.WordBoundingBoxes(2,:)
%%%%%%%%%%%%%%%%%%%%% Method 2 - with preprocessing I = imread('images/amma.jpg'); Icorrected = imtophat(I, strel('disk', 15));
th = graythresh(Icorrected); BW1 = im2bw(Icorrected, th);
figure; imshowpair(Icorrected, BW1, 'montage');
% Perform morphological reconstruction and show binarized image. marker = imerode(Icorrected, strel('line',10,0)); Iclean = imreconstruct(marker, Icorrected);
th = graythresh(Iclean); BW2 = im2bw(Iclean, th);
figure; imshowpair(Iclean, BW2, 'montage'); results = ocr(BW2, 'TextLayout', 'Block','Language', 'E:/Brindha/PhaseII/SourceCode/Source Code/trained/tam.traineddata' );
results.Text %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Both the files show the error as Error using tesseractWrapper Unable to load language data for from . A valid path to the tessdata folder must be provided.
Error in ocr>tesseract (line 131) [txt, ocrMetadata] = tesseractWrapper(tessOpts, Iu8, hasROI, roi);
Error in ocr (line 114) [rawtext, metadata] = tesseract(params, img, roi, hasROI);
Error in mainTamil (line 2) results = ocr(I, 'Language', 'E:/Brindha/PhaseII/SourceCode/Source Code/trained/tam.traineddata');
------------------------ I also uploaded my text images. Please help to solve this problem Thanks Brindha.S
Hi Brindha,
You'll need to put tam.traineddata in a folder named tessdata, for example:
c:/Brindha/PhaseII/SourceCode/Source Code/tessdata/tam.traineddata
That is the only way it will work.
I tried out amma.jpg and got the following results:
>> img = imread('amma.jpg');
>> r = ocr(img, 'lang', 'tessdata/tam.traineddata')
r =
ocrText with properties:
Text: 'அம்மஈ
'
CharacterBoundingBoxes: [7x4 double]
CharacterConfidences: [7x1 single]
Words: {'அம்மஈ'}
WordBoundingBoxes: [21 42 115 32]
WordConfidences: 0.8365
If you run this in MATLAB command window you might get weird looking results because your system isn't setup to render Tamil fonts. For my quick test, I launched MATLAB in -nodesktop mode in Linux so that the Tamil fonts would render correctly in the Linux terminal.
You can check out the following to see how to setup your machine to render Tamil text if you don't already have that working:
Thanks a lot Birju Patel. I had a windows vista. All the ocrText Properties except Words was working well and also the same values as yours. I also check your link for change the local settings also. I will check it further. Thanks for your kind and timely reply. Thanks a lot. Brindha.S

Sign in to comment.

More Answers (0)

Asked:

on 4 Feb 2015

Commented:

on 13 Feb 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!