SANEI 1.3.1.76-0750
|
This file provides an interface to simple image post-processing functions. More...
Go to the source code of this file.
Functions | |
void | sanei_magic_init (void) |
Initialize sanei_magic. More... | |
SANE_Status | sanei_magic_despeck (SANE_Parameters *params, SANE_Byte *buffer, SANE_Int diam) |
Update the image buffer, replacing dots with surrounding background color. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
SANE_Status | sanei_magic_isBlank (SANE_Parameters *params, SANE_Byte *buffer, double thresh) |
Determine if image is blank. More... | |
SANE_Status | sanei_magic_isBlank2 (SANE_Parameters *params, SANE_Byte *buffer, int dpiX, int dpiY, double thresh) |
Determine if image is blank, enhanced version. More... | |
SANE_Status | sanei_magic_findTurn (SANE_Parameters *params, SANE_Byte *buffer, int dpiX, int dpiY, int *angle) |
Determine coarse image rotation (90 degree increments) More... | |
SANE_Status | sanei_magic_turn (SANE_Parameters *params, SANE_Byte *buffer, int angle) |
Coarse image rotation (90 degree increments) More... | |
This file provides an interface to simple image post-processing functions.
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 |
SANE_Status sanei_magic_isBlank | ( | SANE_Parameters * | params, |
SANE_Byte * | buffer, | ||
double | thresh | ||
) |
Determine if image is blank.
params | describes image |
buffer | contains image data |
thresh | maximum % density for blankness (0-100) |
SANE_Status sanei_magic_isBlank2 | ( | SANE_Parameters * | params, |
SANE_Byte * | buffer, | ||
int | dpiX, | ||
int | dpiY, | ||
double | thresh | ||
) |
Determine if image is blank, enhanced version.
params | describes image |
buffer | contains image data |
dpiX | horizontal resolution |
dpiY | vertical resolution |
thresh | maximum % density for blankness (0-100) |
SANE_Status sanei_magic_findTurn | ( | SANE_Parameters * | params, |
SANE_Byte * | buffer, | ||
int | dpiX, | ||
int | dpiY, | ||
int * | angle | ||
) |
Determine coarse image rotation (90 degree increments)
params | describes image | |
buffer | contains image data | |
dpiX | horizontal resolution | |
dpiY | vertical resolution | |
[out] | angle | amount of rotation recommended |
SANE_Status sanei_magic_turn | ( | SANE_Parameters * | params, |
SANE_Byte * | buffer, | ||
int | angle | ||
) |
Coarse image rotation (90 degree increments)
params | describes image |
buffer | contains image data |
angle | amount of rotation requested (multiple of 90) |