logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Allan  
#1 Posted : Wednesday, July 12, 2017 4:05:19 AM(UTC)
Allan

Rank: Newbie

Groups: Registered
Joined: 7/12/2017(UTC)
Posts: 3

Hi,

I wanted to try out your software, before buying a license, for a project. However I encounter a problem that seems to be out of my hands.

When executing GetTextFromImage with a path to a simple tiff file, a starting point and a size of the area to scan, I get an AccessViolationException.

For testing I made a simple forms project, with just a single button that's hardcoded for a specific file.

Code:

private void button1_Click(object sender, EventArgs e)
{
            Bitmap test = new Bitmap(Path.Combine(@"C:\ScannedDocuments\", "image_0_back.tif"));

            var ocr = OcrApi.Create();

            ocr.Init(Patagames.Ocr.Enums.Languages.English);
            try
            {
                string str = ocr.GetTextFromImage(Path.Combine(@"C:\ScannedDocuments\", "image_0_back.tif"), new Point(95, 160), new Size(320, 30));
                
                button1.Name = str;
            }
            catch (AccessViolationException ex)
            {
                throw new Exception(ex.Message);
            }
}


If you could supply a solution or an idea to why this is happening, I would appreciate it alot!

Regards,
Allan Larsen
Paul Rayman  
#2 Posted : Friday, July 14, 2017 4:54:46 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Since I can't reproduce it could you please create a sample app that reproduces your problem? Thanks.
did you setup your project like described here https://tesseract.patagames.com/help/

Edited by user Friday, July 14, 2017 4:57:32 PM(UTC)  | Reason: Not specified

Allan  
#3 Posted : Tuesday, July 18, 2017 3:35:37 AM(UTC)
Allan

Rank: Newbie

Groups: Registered
Joined: 7/12/2017(UTC)
Posts: 3

I followed every step of that guide, yes.

I couldn't post the test project I made (The dialogue got stuck)

Codesnippet:

Code:
static void Main(string[] args)
        {
            OcrApi.PathToEngine = @"C:\Users\abl\Documents\visual studio 2017\Projects\OCR_Test\OCR_Test\x64\tesseract.dll";
            var ocr = OcrApi.Create();

            ocr.Init(Patagames.Ocr.Enums.Languages.English);

            FileInfo file = new FileInfo("image_0_back.tif");
            var test = new Bitmap(Image.FromFile(@"C:\Users\abl\Documents\visual studio 2017\Projects\OCR_Test\OCR_Test\image_1_back.jpg"));

            try
            {
                string str = ocr.GetTextFromImage(test, new Point(95, 160), new Size(320, 30));

                if (string.IsNullOrEmpty(str))
                    throw new Exception("Blah!");
            }
            catch (AccessViolationException ex)
            {
                throw new Exception(ex.Message);
            }
        }


I've attached the image I'm doing this with to this post. Otherwise it's basic. I get the corrupted memory exception from this.
Allan  
#4 Posted : Tuesday, July 18, 2017 3:36:39 AM(UTC)
Allan

Rank: Newbie

Groups: Registered
Joined: 7/12/2017(UTC)
Posts: 3

image_1_back.jpg (127kb) downloaded 30 time(s). - Here's the picture!
Paul Rayman  
#5 Posted : Sunday, July 23, 2017 5:45:04 PM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
there is a some bug was found.
I hope it will be fixed in the next release.

Currently I can suggest a following workaround

Code:

using (var pix = OcrPix.FromFile(@"D:\3\image_1_back.jpg"))
{
	string str = ocr.GetTextFromImage(pix, new Point(95, 160), new Size(320, 30));
	if (string.IsNullOrEmpty(str))
		throw new Exception("Blah!");
	Console.WriteLine(str);
}



Fixed!
​https://forum.patagames.com/posts/t431-Version-1-14-341-was-released-on-Feb-08--2018

Edited by user Thursday, February 8, 2018 2:06:32 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.