26#define SAMPLE_SIZE 40000
28#define HISTOGRAM_SHIFT 8
29#define HISTOGRAM_SIZE (1 << HISTOGRAM_SHIFT)
31#define SAFE_LOG(x) ( ((x) > 0.0) ? log ((x)) : (0.0) )
33#define MAD_WIN2_SIZE(x) ( (((x) * 4) / 3) | 1 )
35typedef uint16_t SANE_Uint;
70 const SANE_Uint *img_data,
97 double * norm_histo,
int *thresh);
117 double * norm_histo,
int *thresh);
140 double * norm_histo,
int *thresh);
160 SANE_Uint **out_img);
182 SANE_Parameters * out_params, SANE_Uint **out_img);
224 const SANE_Uint *red_data,
247 const SANE_Uint *in_img, SANE_Uint *out_img,
248 int win_rows,
int win_cols);
284 const SANE_Uint *in_img,
285 SANE_Uint ** out_img,
int win_size,
286 int a_val,
int b_val);
299 const SANE_Uint *in_img,
300 SANE_Uint * mask_img,
int threshold);
324 const SANE_Uint * mask_img,
unsigned int *dist_map,
325 unsigned int *idx_map,
unsigned int erode);
341 unsigned int *dist_map,
unsigned int *idx_map,
int by);
359 unsigned int * dist_map,
int inner,
int * edges);
388 int dist_max,
int expand,
int win_size,
389 SANE_Bool smooth,
int inner,
SANE_Status sanei_ir_create_norm_histogram(const SANE_Parameters *params, const SANE_Uint *img_data, double **histogram)
Create the normalized histogram of a grayscale image.
void sanei_ir_add_threshold(const SANE_Parameters *params, const SANE_Uint *in_img, SANE_Uint *mask_img, int threshold)
Add dark pixels to mask from static threshold.
SANE_Status sanei_ir_threshold_maxentropy(const SANE_Parameters *params, double *norm_histo, int *thresh)
Implements a Maximum Entropy thresholding method.
void sanei_ir_dilate(const SANE_Parameters *params, SANE_Uint *mask_img, unsigned int *dist_map, unsigned int *idx_map, int by)
Dilate or erode a mask image.
SANE_Status sanei_ir_filter_mean(const SANE_Parameters *params, const SANE_Uint *in_img, SANE_Uint *out_img, int win_rows, int win_cols)
Optimized mean filter.
void sanei_ir_manhattan_dist(const SANE_Parameters *params, const SANE_Uint *mask_img, unsigned int *dist_map, unsigned int *idx_map, unsigned int erode)
Calculates minimal Manhattan distances for an image mask.
SANE_Status sanei_ir_threshold_otsu(const SANE_Parameters *params, double *norm_histo, int *thresh)
Implements Otsu's thresholding method.
SANE_Status sanei_ir_RGB_luminance(SANE_Parameters *params, const SANE_Uint **in_img, SANE_Uint **out_img)
Generate gray scale luminance image from separate R, G, B images.
SANE_Status sanei_ir_to_8bit(SANE_Parameters *params, const SANE_Uint *in_img, SANE_Parameters *out_params, SANE_Uint **out_img)
Convert image from >8 bit depth to an 8 bit image.
void sanei_ir_find_crop(const SANE_Parameters *params, unsigned int *dist_map, int inner, int *edges)
Suggest cropping for dark margins of positive film.
SANE_Status sanei_ir_spectral_clean(const SANE_Parameters *params, double *lut_ln, const SANE_Uint *red_data, SANE_Uint *ir_data)
Reduces red spectral overlap from an infrared image plane.
SANE_Status sanei_ir_dilate_mean(const SANE_Parameters *params, SANE_Uint **in_img, SANE_Uint *mask_img, int dist_max, int expand, int win_size, SANE_Bool smooth, int inner, int *crop)
Dilate clean image parts into dirty ones and smooth int inner,.
void sanei_ir_init(void)
Initialize sanei_ir.
SANE_Status sanei_ir_threshold_yen(const SANE_Parameters *params, double *norm_histo, int *thresh)
Implements Yen's thresholding method.
SANE_Status sanei_ir_ln_table(int len, double **lut_ln)
Allocate and initialize logarithmic lookup table.
SANE_Status sanei_ir_filter_madmean(const SANE_Parameters *params, const SANE_Uint *in_img, SANE_Uint **out_img, int win_size, int a_val, int b_val)
Find noise by adaptive thresholding.
Pointer to access values of different bit depths.
Definition: sanei_ir.h:41
uint16_t * b16
8, <= 16 bits
Definition: sanei_ir.h:43
uint8_t * b8
<= 8 bits
Definition: sanei_ir.h:42