TIEVisionImage.findSkewAngle
Declaration
function findSkewAngle(maxAngle: Double = 7.0; confidence: double_p = nil): Double; safecall;
Description
Measures the skew of the text lines in a document image (via Leptonica) without changing the image.
Returns the angle, in degrees, that the image needs to be rotated clockwise to make the text lines horizontal (negative values mean counter-clockwise). Returns 0 if no skew could be measured.
The image should contain dark text on a light background. It is binarized with Otsu for the measurement.
| Parameter | Description |
| maxAngle | Largest skew to search for, in degrees (greater than 0 and at most 45) |
| confidence | Optional. Receives the confidence of the measurement. A value of 3 or more is reliable. 0 means no skew could be measured |
Note: This only measures small skews. Use
getOrientation to detect pages rotated by 90, 180 or 270 degrees.
Examples
var
angle, conf: Double;
begin
angle := ImageEnView1.IEBitmap.GetIEVisionImage().findSkewAngle( 7.0, @conf );
if conf >= 3 then
ShowMessage( Format( 'Skew: %.2f deg', [ angle ] ));
end;
// Measure the skew of the text lines of a document
angle := ImageEnView1.IEBitmap.GetIEVisionImage().findSkewAngle( 7, @conf );
s := Format( 'Skew: %.2f deg (Confidence: %.1f)', [ angle, conf ]);
For the following image, the result is "Rotate -1.31 deg clockwise to correct (Confidence: 5.1)"
See Also
◼deskew
◼getTextAngle
◼SkewDetection
◼SkewDetectionFine
◼RotateAndCrop