1 /* image-proc.h: image processing routines */
2 
3 #ifndef IMAGE_PROC_H
4 #define IMAGE_PROC_H
5 
6 #include "bitmap.h"
7 #include "color.h"
8 
9 
10 /* Threshold for binarizing a monochrome image */
11 #define GRAY_THRESHOLD 225
12 
13 /* RGB to grayscale */
14 #define LUMINANCE(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11 + 0.5)
15 
16 
17 typedef struct
18 {
19   unsigned height, width;
20   float **weight;
21   float **d;
22 } distance_map_type;
23 
24 
25 /* Allocate and compute a new distance map. */
26 extern distance_map_type new_distance_map(bitmap_type,
27     unsigned char target_value, at_bool padded,
28 					  at_exception_type * exp);
29 
30 /* Free the dynamically-allocated storage associated with a distance map. */
31 extern void free_distance_map(distance_map_type*);
32 
33 
34 extern void medial_axis(bitmap_type *bitmap, distance_map_type *dist,
35     const color_type *bg_color);
36 
37 
38 /* Binarize a grayscale or color image. */
39 extern void binarize(bitmap_type*);
40 
41 
42 /* Thin a binary image, replacing the original image with the thinned one. */
43 extern bitmap_type ip_thin(bitmap_type);
44 
45 #endif /* not IMAGE_PROC_H */
46 
47