piuspatch
v0.1
USB addition to PIE backend
|
00001 00021 #ifndef SANEI_IR_H 00022 #define SANEI_IR_H 00023 00024 #include <stdint.h> 00025 00026 #define SAMPLE_SIZE 40000 00028 #define HISTOGRAM_SHIFT 8 00029 #define HISTOGRAM_SIZE (1 << HISTOGRAM_SHIFT) 00030 00031 #define SAFE_LOG(x) ( ((x) > 0.0) ? log ((x)) : (0.0) ) 00033 #define MAD_WIN2_SIZE(x) ( (((x) * 4) / 3) | 1 ) 00038 typedef union 00039 { 00040 uint8_t *b8; 00041 uint16_t *b16; 00042 } 00043 SANEI_IR_bufptr; 00044 00045 00050 extern void sanei_ir_init (void); 00051 00066 extern SANE_Status 00067 sanei_ir_create_norm_histogram (const SANE_Parameters * params, 00068 const SANEI_IR_bufptr img_data, 00069 double ** histogram); 00070 00093 extern SANE_Status 00094 sanei_ir_threshold_yen (const SANE_Parameters * params, 00095 double * norm_histo, int *thresh); 00096 00113 extern SANE_Status 00114 sanei_ir_threshold_otsu (const SANE_Parameters * params, 00115 double * norm_histo, int *thresh); 00116 00136 extern SANE_Status 00137 sanei_ir_threshold_maxentropy (const SANE_Parameters * params, 00138 double * norm_histo, int *thresh); 00139 00157 SANE_Status 00158 sane_ir_RGB_luminance (SANE_Parameters * params, const SANEI_IR_bufptr * in_img, 00159 SANEI_IR_bufptr * out_img, SANE_Bool scale8); 00160 00179 extern SANE_Status 00180 sane_ir_to_8bit (SANE_Parameters * params, const SANEI_IR_bufptr in_img, 00181 SANE_Parameters * out_params, SANEI_IR_bufptr *out_img); 00182 00195 SANE_Status sane_ir_ln_table (int len, double **lut_ln); 00196 00221 extern SANE_Status 00222 sane_ir_spectral_clean (const SANE_Parameters * params, double *lut_ln, 00223 const SANEI_IR_bufptr red_data, 00224 SANEI_IR_bufptr ir_data); 00225 00244 extern SANE_Status 00245 sanei_ir_filter_mean (const SANE_Parameters * params, 00246 const SANEI_IR_bufptr in_img, SANEI_IR_bufptr out_img, 00247 int win_rows, int win_cols); 00248 00249 00281 extern SANE_Status 00282 sanei_ir_filter_madmean (const SANE_Parameters * params, 00283 const SANEI_IR_bufptr in_img, 00284 SANE_Byte ** out_img, int win_size, 00285 int a_val, int b_val); 00286 00287 00296 void 00297 sanei_ir_add_threshold (const SANE_Parameters * params, 00298 const SANEI_IR_bufptr in_img, 00299 SANE_Byte * mask_img, int threshold); 00300 00301 00321 void 00322 sane_ir_manhattan_dist (const SANE_Parameters * params, 00323 const SANE_Byte * mask_img, unsigned int *dist_map, 00324 unsigned int *idx_map, unsigned int erode); 00325 00326 00338 void 00339 sane_ir_dilate (const SANE_Parameters * params, SANE_Byte * mask_img, 00340 unsigned int *dist_map, unsigned int *idx_map, int by); 00341 00356 void 00357 sanei_ir_find_crop (const SANE_Parameters * params, 00358 unsigned int * dist_map, int inner, int * edges); 00359 00383 SANE_Status 00384 sanei_ir_dilate_mean (const SANE_Parameters * params, 00385 SANEI_IR_bufptr * in_img, 00386 SANE_Byte * mask_img, 00387 int dist_max, int expand, int win_size, 00388 SANE_Bool smooth, int inner, 00389 int *crop); 00390 00391 00392 #endif /* not SANEI_IR_H */ 00393