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
|
|
|
|
|
|
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
|
|
|
|
|
|
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.
|
|
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/12/2017(UTC) Posts: 3
|
 image_1_back.jpg (127kb) downloaded 30 time(s). - Here's the picture!
|
|
|
|
|
|
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--2018Edited by user Thursday, February 8, 2018 2:06:32 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close