|
I have recently implement the extended deskew command for Image which falls more than 10 degrees.
DeskewCommand command = new DeskewCommand(); command.Flags = DeskewCommandFlags.DocumentImage | DeskewCommandFlags.ReturnAngleOnly;
command.Run(TheImage); if (command.Angle >= -1000 && command.Angle <= 1000) { //Only deskew within anticlockwise 10 degree and clockwise 10 degree command.Flags = DeskewCommandFlags.DeskewImage | DeskewCommandFlags.DocumentImage | DeskewCommandFlags.DoNotFillExposedArea; command.Run(TheImage); } else { DeskewExtendedCommand extCommand = new DeskewExtendedCommand(); RasterColor fillColor = new RasterColor(0, 0, 0); if (command.Angle < 0) { extCommand.AngleRange = command.Angle * -1; } else { extCommand.AngleRange = command.Angle; }
extCommand.AngleResolution = 2; extCommand.FillColor = fillColor; extCommand.Flags = DeskewExtendedCommandFlags.DeskewImage|DeskewExtendedCommandFlags.DoNotFillExposedArea | DeskewExtendedCommandFlags.RotateLinear | DeskewExtendedCommandFlags.DocumentImage; extCommand.Run(TheImage); }
I have did some testing and it shows that the performance is slow depends on the AngleResolution and AngleRange.
For the AngleRange i am using ReturnAngleOnly to get the angle detected from the API. However for AngleResolution it turn up slow if i am setting it to "2" , it takes about 12-15 sec to deskew the image. I am now using "10" it still takes about 5 sec.
Is there any recomendation for setting AngleResolution or maybe AngleRange to tune the performance ?
Also sometimes i notice that the ReturnAngleOnly from DeskewCommand is returning wrong angle for some image which don't need deskew. But if i run the image in ExtendedDeskewCommand it works good. Most of our document are scaned document with text only, is it because i am using DeskewCommandFlags.DocumentImage and it tend to return wrong angle ?
I have tried to use DeskewCommandFlags.DocumentAndPictures instead but it can't detect the scaned image with small angles like 5 degrees.
I am using Leadtools.dll version 15.0.1.3.
Regards,
David
|