Rank: Newbie
Groups: Registered
Joined: 2/9/2025(UTC) Posts: 1 
|
Hi folks, I am a new user to Tessaract and just wanted to try it out. I have installed the .Net SDK and added the following class: I have tried adding the Ocrapi.PathToEngine which I saw on another post but this did not work. I also tried using a local image instead of my Azure Blob image in case there was an issue there. Code:using Azure;
using Azure.AI.Vision.ImageAnalysis;
using Patagames.Ocr.Enums;
using Patagames.Ocr;
using System.Diagnostics;
namespace myapp.Areas.FunctionalLogic
{
public class AnalyzeImage
{
public async Task ExtractTextFromImage(string imageUri)
{
OcrApi.PathToEngine = @"C:\Users\xxxxx\source\repos\xxxxxxxxxx\bin\Debug\net9.0\x64\tesseract.dll";
using (var api = OcrApi.Create())
{
api.Init(Languages.English);
string plainText = api.GetTextFromImage("/images/cardimage.png");
}
}
}
}
The above is being called from my controller: Code: try
{
Uri uri = await _uploadBlobs.uploadBlobToAzure(images, uniqueReferenceValue, "Blob");
Debug.WriteLine("************** uri: " + uri.ToString());
await OCRscan(uri.ToString());
}
catch (Exception ex)
{
Debug.WriteLine("************** Catch to Home");
return RedirectToAction(actionName: "Index", controllerName: "Home");
}
Code: public async Task<string> OCRscan(string blobUri)
{
Debug.WriteLine("************** uri 1: " + blobUri.ToString());
if (blobUri != null)
{
Debug.WriteLine("Call Tessaract");
await analyzeImage.ExtractTextFromImage(blobUri);
Debug.WriteLine("Complete Tessaract");
}
return null;
}
The error is being thrown at Code:api.Init(Languages.English);
Error: Code:'xxxxxxxxxx.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\9.0.0\System.IO.FileSystem.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Exception thrown: 'System.IO.DirectoryNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.DirectoryNotFoundException' in System.Private.CoreLib.dll
************** Catch to Home
Any advice on what to try would be appreciated?
|
|
|
|
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