Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,075
Thanks: 6 times Was thanked: 124 time(s) in 121 post(s)
|
QuestionHey, I was wondering, if there is an automated way to detect the rotation of a scanned page? AnswerPlease 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 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