How are you doing?
Could you help me, please?
I am using the OCR version 3.1.0 dll, using the Portuguese language and it is not working, the result I am getting is quite strange.
Thank you very much.
Code that is running in C #:
protected void Send_Click(object sender, EventArgs e)
{
if(FileUploadInput.PostedFile != null)
{
try
{
string fullpath = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, “files”, string.Concat(DateTime.Now.ToString(“yyyyMMddHHmmss”), Path.GetExtension(FileUploadInput.PostedFile.FileName)));
string directory = Path.GetDirectoryName(fullpath);if (!Directory.Exists(directory)) Directory.CreateDirectory(directory); FileUploadInput.PostedFile.SaveAs(fullpath); // Initialize an instance of OcrEngine OcrEngine ocrEngine = new OcrEngine(); // Ignore everything else on the image other than the user defined recognition blocks ocrEngine.Config.DetectTextRegions = true; // Clear notifier list ocrEngine.ClearNotifies(); // set image ocrEngine.Image = Aspose.OCR.ImageStream.FromFile(fullpath); ocrEngine.LanguageContainer.Clear(); ILanguage portuguese = LanguageFactory.Load(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "Languages", "Portuguese_language_resource_file_for_Aspose.OCR_for_.NET_2.3.0.zip")); ocrEngine.LanguageContainer.AddLanguage(portuguese); // do processing if (ocrEngine.Process()) { TextBox.Text = ocrEngine.Text.ToString(); } else { TextBox.Text = "Don't process"; } } catch (Exception ex) { TextBox.Text = ex.ToString(); } } }
Image I’m using test:
modelo-de-contrato-internacional-2-638.jpg (117.9 KB)
Result of extracting the text:
elámola nxoex-a Ç criez de eleseue tzr\vc\z e c elestricc de euverce
nsmixclizc des ezv eclie de mM~rAW ceoMMVAMe de ccreuxtevic técricc e
cesesselcmertz ccoelixcl dertle de eux clec de etuctre eccremicc ecle couxertec
de meligdz/Iti rc mielIzl
oa-M-Ma hn)co ccoçveerdese çav ccriultzvxc e cesesselcmervi ccoelixcl c
elzerectre de cliertes e %/recedeves me dvillmnee fectroertz de ccrivrice de
fevrecimeMz coclicicc de elzdace e xr%Çetcz de ouclidrae celesertercz de
cozetles curtec recircicc ccozlc xr%Çetcz de melicaclice eléemtgloue e
ceelcices c ducrexlce rc emeliz/ ecle c eoMMVAMe
w Wmo
elácola seunda c eleserte tzMIK\z éceletlede ecle digilcl eelz elczz de m
XouctleX cres c expri de euc ces)rciulc ezderdc eel elzllegruz crucluerte ee fev
ccruerrerte ce expes cc tecl de oue eleccrizc c c higi egh de tzdxgz truxl
W dbR\tdRX!WO!! bella E daMolorM(IIWWE
elámola reemi-a e eoM-rAMev cens e ces)rciulc de eleserte xr%\vMmertz rcz
ezdeve de ouclouel fevoc rem ezv xr\evezetc ensecc - ezr eerc de vesecruel ezv
derci movcx% metevicie eferdcoerte mellidas e IMcIze cessertes - vezc%%cv
xr~zvmc tzes scrie fevrecedeves decumertzi feldevi cciclegis c mestle e ccrictes
ccoelixers elides dideze tos mbos ec cligrrevize des ccrictes de murmenW e
de tuc c eeu ezv-cliz de fevrecedeves rc mieliz/ tudz rc ccrocluxdcde de oue
eleccrizc c chigi Euz de tzdxgz truxl
elácula mana ce eclies ccruercicrem ezr ci eerce de Iex oue elzerciclec ume c
cutle tzdze ce esfevize ccours cco c crietruz eseecificc ecle c ccreecurcz de
eleserte mrtletc rem ccoz ccriederdc ume c cutle elerc II\vdcde de ctuctre
desde oue dertle des escres tevoce e II=x\e% de eleserte cnric