sanei_magic.h File Reference

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.
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.


Detailed Description

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.


Function Documentation

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.

Parameters:
params describes image
buffer contains image data
diam maximum dot diameter to remove
Returns:
  • SANE_STATUS_GOOD - success
  • SANE_STATUS_INVAL - invalid image parameters

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.

Parameters:
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
Returns:
  • SANE_STATUS_GOOD - success
  • SANE_STATUS_NO_MEM - not enough memory
  • SANE_STATUS_INVAL - invalid image parameters
  • SANE_STATUS_UNSUPPORTED - slope angle too shallow to detect

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.

Parameters:
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
Returns:
  • SANE_STATUS_GOOD - success
  • SANE_STATUS_NO_MEM - not enough memory
  • SANE_STATUS_INVAL - invalid image parameters

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.

Parameters:
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
Returns:
  • SANE_STATUS_GOOD - success
  • SANE_STATUS_NO_MEM - not enough memory
  • SANE_STATUS_UNSUPPORTED - edges could not be detected

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.

Parameters:
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
Returns:
  • SANE_STATUS_GOOD - success
  • SANE_STATUS_NO_MEM - not enough memory
  • SANE_STATUS_INVAL - invalid image parameters


Generated on Mon Jan 31 21:43:30 2011 for SANEI by  doxygen 1.5.6