Open ColdenHaulfield opened 6 years ago
Switching PageSegmentationMode.AUTO_ONLY on OSD_ONLY and changing rus data on osd legacy data helps me
UPDATE. I was wrong and the change of PSM did not help. How can I detect the orientation of the image?
Will look into this
I am sure u may have moved on. I also was not able to use this with success. For me the function Orientation in the PageIterator worked "beautifully":
tessBaseApi.SetImage(pix);
Orientation orientation;
WritingDirection direction;
TextlineOrder order;
float deskewAngle = 0;
using (var pageIter = tessBaseApi2.AnalyseLayout())
{
pageIter.Begin();
pageIter.Orientation(out orientation, out direction, out order, out deskewAngle);
}
Hey, have this exception when trying run this code. Can you help me?
TessBaseAPI tessBaseAPI = new TessBaseAPI(); tessBaseAPI.Init(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "tessdata"), "rus", OcrEngineMode.DEFAULT); tessBaseAPI.SetPageSegMode(PageSegmentationMode.AUTO_ONLY);
Bitmap image = new Bitmap(path); MemoryStream byteStream = new MemoryStream(); image.Save(byteStream, System.Drawing.Imaging.ImageFormat.Tiff); var pix = Pix1.pixReadFromMemoryStream(byteStream);