I am trying to create custom pattern for special symbol, but has following error:

An attempt was made to access /opt/ABBYY/FREngine11/Samples/Java/TrainUserPatternSample2/costa_rica_currency.pattern past its end.

Code:

            //create pattern
        ITrainingImagesCollection imagesCollection = engine.CreateTrainingImagesCollection();
        ITrainingImage image = engine.CreateTrainingImage();
        image.setBaseLine(31);
        image.setSmallCharsHeight(22);
        IImageDocument imageDoc = engine.OpenImageFile("costa_rica_currency.bmp", null, null, null);
        IImage bwImage = imageDoc.getBlackWhiteImage();
        IRegion region = engine.CreateRegion();
        region.AddRect(0, 0, bwImage.getWidth(), bwImage.getHeight());
        image.SetImageData(imageDoc, region);
        imagesCollection.Add(image);

        String filename = "costa_rica_currency.pattern";
        createPatternFile(filename);
        engine.TrainUserPattern(filename, imagesCollection, "₡", 0, TextTypeEnum.TT_Normal);

asked 14 Jan '16, 11:30

Andrei's gravatar image

Andrei
111


Fixed by replacing

createPatternFile(filename); //creating a new file

to

engine.CreateEmptyUserPattern(filename);
link

answered 14 Jan '16, 12:55

Andrei's gravatar image

Andrei
111

edited 14 Jan '16, 12:55

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6
×3
×2

Asked: 14 Jan '16, 11:30

Seen: 402 times

Last updated: 14 Jan '16, 12:55

© 2016 ABBYY. All rights Reserved. www.ABBYY.com | Privacy Policy | Legal