|
|
There is a another way to determine the page orientation. The following code works perfect for me. Please make sure that you have the osd.traindata data file in your output tessdata folder. Code:
var api = OcrApi.Create();
api.Init();
api.PageSegmentationMode = Patagames.Ocr.Enums.PageSegMode.PSM_AUTO_OSD;
api.SetImage(bmp);
api.Recognize();
var iterator = api.AnalyseLayout();
var orientation = iterator.Orientations;
switch(iterator.Orientations)
{
case Patagames.Ocr.Enums.Orientation.ORIENTATION_PAGE_DOWN:
//the image is rotated to 180
break;
case Patagames.Ocr.Enums.Orientation.ORIENTATION_PAGE_LEFT:
//the image is rotated to 270 clockwise
break;
case Patagames.Ocr.Enums.Orientation.ORIENTATION_PAGE_RIGHT:
//the image is rotated to 90 clockwise
break;
case Patagames.Ocr.Enums.Orientation.ORIENTATION_PAGE_UP:
//the image is rotated to 0
break;
}
|
|
|
well ... you can try to recognize the image four times at different angles, and choose the one of them where the most good result. To evaluate the result you can use the TextConfidences property.
|
|
|
Hey, I am currently searching for an alternative for our current rasterizing SDK and found Pdfium. I was wondering, if there is an automated way to detect the rotation of a pdf file? Lets say I have a document that is scanned upide down and sent to Pdfium as PDF file. Is it possible to detect the rotation of the content?
EDIT: Is it possible to output a deskewed and correctly oriented version of the page, maybe in combination with your tesseract SDK? I know that tesseract has OSD, so can you tell the renderer to rotate the output pdf accordingly?
|
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