Image.deskew

Straightens an image. A threshold of 40% works for most images.

Skew is an artifact that occurs in scanned images because of the camera being misaligned, imperfections in the scanning or surface, or simply because the paper was not placed completely flat when scanned.

class Image
void
deskew
(
double threshold = 0.4
,
size_t autoCropWidth = 0
)

Parameters

threshold double

Specify an apsulute number of pixels or an percentage by passing a value between 1 and 0.

autoCropWidth size_t

Specify a value for this argument to cause the deskewed image to be auto-cropped. The argument is the pixel width of the image background (e.g. 40). A width of 0 disables auto cropping.

Meta