ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIEVisionOCR.getOrientation Issue
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jeffp

USA
66 Posts

Posted - Jan 14 2025 :  12:25:07  Show Profile  Reply
I'm using the code below to get the rotation angle or orientation of a scanned document image. However, the issue is some documents scanned upside down are giving a result of ievOCROrientPAGE_UP instead of ievOCROrientPAGE_DOWN.

Here is an example. It seems documents with lots of text are fine. But the more sparse the text it fails.

Attached is an example.


function TEnOCR.GetRotation(ABitmap: TIEBitmap): Integer;
var
  AOCR: TIEVisionOCR;
  AStr: String;
begin
  Result := 0;

  try //Seems to crash on a blank page

    if not Assigned(ABitmap) and Assigned(FViewer) then ABitmap := FViewer.IEBitmap;
    if not Assigned(ABitmap) then exit;

    AOCR := GetVisionOCR;
    try
      AOCR.setSegmentationMode(ievOCRAUTO_OSD); //Must be ievOCRAUTO_OSD
      FTextAngle := AOCR.getTextAngle(ABitmap.GetIEVisionImage) * 180 / PI; //From Radians to Degree
      AOCR.getOrientation(FOrientation, FWritingDirection, FTextlineOrder, FDeskewAngle);
    finally
      AOCR := nil;
    end;

    case FOrientation of
      ievOCROrientPAGE_UP:    Result := 0;
      ievOCROrientPAGE_RIGHT: Result := 90;
      ievOCROrientPAGE_DOWN:  Result := 180;
      ievOCROrientPAGE_LEFT:  Result := 270;
    end;
  except end;
end;



attach/jeffp/2025114123143_Orientation-Down2.tif

xequte

38730 Posts

Posted - Jan 14 2025 :  18:22:52  Show Profile  Reply
Hi Jeff

Please confirm what version of ImageEn and IEVision you are using.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

jeffp

USA
66 Posts

Posted - Jan 14 2025 :  18:42:02  Show Profile  Reply
IEVision 8.1.5

ImageEn 13.7.1 Beta 0112

jp
Go to Top of Page

xequte

38730 Posts

Posted - Jan 15 2025 :  21:23:09  Show Profile  Reply
Hi Jeff

Thanks, we'll need to investigate that further.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: