Go to the source code of this file.
Functions | |
| void | sanei_magic_init (void) |
| Initialize sanei_magic. | |
| SANE_Status | sanei_magic_despeck (SANE_Parameters *params, SANE_Byte *buffer, SANE_Int diam) |
| Update the image buffer, replacing dots with surrounding background color. | |
| SANE_Status | sanei_magic_findSkew (SANE_Parameters *params, SANE_Byte *buffer, int dpiX, int dpiY, int *centerX, int *centerY, double *finSlope) |
| Find the skew of the media inside the image, via edge detection. | |
| SANE_Status | sanei_magic_rotate (SANE_Parameters *params, SANE_Byte *buffer, int centerX, int centerY, double slope, int bg_color) |
| Correct the skew of the media inside the image, via simple rotation. | |
| SANE_Status | sanei_magic_findEdges (SANE_Parameters *params, SANE_Byte *buffer, int dpiX, int dpiY, int *top, int *bot, int *left, int *right) |
| Find the edges of the media inside the image, parallel to image edges. | |
| SANE_Status | sanei_magic_crop (SANE_Parameters *params, SANE_Byte *buffer, int top, int bot, int left, int right) |
| Crop the image, parallel to image edges. | |
Currently, three operations are provided:
Note that these functions are simplistic, and are expected to change. Patches and suggestions are welcome.
| void sanei_magic_init | ( | void | ) |
Initialize sanei_magic.
Call this before any other sanei_magic function.
| SANE_Status sanei_magic_despeck | ( | SANE_Parameters * | params, | |
| SANE_Byte * | buffer, | |||
| SANE_Int | diam | |||
| ) |
Update the image buffer, replacing dots with surrounding background color.
| params | describes image | |
| buffer | contains image data | |
| diam | maximum dot diameter to remove |
| SANE_Status sanei_magic_findSkew | ( | SANE_Parameters * | params, | |
| SANE_Byte * | buffer, | |||
| int | dpiX, | |||
| int | dpiY, | |||
| int * | centerX, | |||
| int * | centerY, | |||
| double * | finSlope | |||
| ) |
Find the skew of the media inside the image, via edge detection.
| params | describes image | |
| buffer | contains image data | |
| dpiX | horizontal resolution | |
| dpiY | vertical resolution | |
| [out] | centerX | horizontal coordinate of center of rotation |
| [out] | centerY | vertical coordinate of center of rotation |
| [out] | finSlope | slope of rotation |
| SANE_Status sanei_magic_rotate | ( | SANE_Parameters * | params, | |
| SANE_Byte * | buffer, | |||
| int | centerX, | |||
| int | centerY, | |||
| double | slope, | |||
| int | bg_color | |||
| ) |
Correct the skew of the media inside the image, via simple rotation.
| params | describes image | |
| buffer | contains image data | |
| centerX | horizontal coordinate of center of rotation | |
| centerY | vertical coordinate of center of rotation | |
| slope | slope of rotation | |
| bg_color | the replacement color for edges exposed by rotation |
| SANE_Status sanei_magic_findEdges | ( | SANE_Parameters * | params, | |
| SANE_Byte * | buffer, | |||
| int | dpiX, | |||
| int | dpiY, | |||
| int * | top, | |||
| int * | bot, | |||
| int * | left, | |||
| int * | right | |||
| ) |
Find the edges of the media inside the image, parallel to image edges.
| params | describes image | |
| buffer | contains image data | |
| dpiX | horizontal resolution | |
| dpiY | vertical resolution | |
| [out] | top | vertical offset to upper edge of media |
| [out] | bot | vertical offset to lower edge of media |
| [out] | left | horizontal offset to left edge of media |
| [out] | right | horizontal offset to right edge of media |
| SANE_Status sanei_magic_crop | ( | SANE_Parameters * | params, | |
| SANE_Byte * | buffer, | |||
| int | top, | |||
| int | bot, | |||
| int | left, | |||
| int | right | |||
| ) |
Crop the image, parallel to image edges.
| params | describes image | |
| buffer | contains image data | |
| top | vertical offset to upper edge of crop | |
| bot | vertical offset to lower edge of crop | |
| left | horizontal offset to left edge of crop | |
| right | horizontal offset to right edge of crop |
1.5.6