Rank: Newbie
Groups: Registered
Joined: 4/4/2016(UTC) Posts: 4  Location: Munic
|
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? Edited by user Tuesday, April 5, 2016 4:55:45 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Guest
Groups: Guests
Joined: 1/5/2016(UTC) Posts: 162
Was thanked: 5 time(s) in 5 post(s)
|
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. Edited by user Tuesday, April 5, 2016 6:55:59 AM(UTC)
| Reason: Not specified
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,131
Thanks: 10 times Was thanked: 132 time(s) in 129 post(s)
|
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;
}
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can 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