Aligment
This module is dedicated to algorithms that performs document spatial aligment correction.
All the methods has a pattern to be an image filter, i.e. all the method must have an image as input and offer at least one image as output.
Additional data can be provided, depending on the method, which can be seen in the dedicated documentation.
inplane_deskew(input, max_skew=10)
In-plane deskew method to correct the image rotation using the plane orientation (bi-dimensional images)
This method uses the global Hough Lines transform, given by OpenCV to generate and estimated angle to correct the image orientation to the zero degrees (i.e. to be parallel to the x-axis)
Note
This is the usual orientation for text-formatt document. However, if your document presents a different text orientation, then this technique will not perform properly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input
|
ndarray
|
The text-document image with a skewness |
required |
max_skew
|
int
|
Maxium angle adopted for the orientation correction. Defaults to 10. |
10
|
Returns:
| Type | Description |
|---|---|
(ndarray, dict)
|
The output image with inplane orientation correct. It is also give the angle value (key: |
Source code in cucaracha/tasks/aligment.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |