move some defines to edges.h
[sparrow.git] / edges.h
blob79b9c8fc1b5bfca62f0a5d2b32704b30cde31291
1 #ifndef __SPARROW_EDGES_H__
2 #define __SPARROW_EDGES_H__
4 #define SIG_WEIGHT 2
6 /* for discarding outliers */
7 #define OUTLIER_RADIUS 7
8 #define OUTLIER_THRESHOLD (OUTLIER_RADIUS * OUTLIER_RADIUS)
10 #define SPARROW_MAP_LUT_SHIFT 1
11 #define SPARROW_FP_2_LUT (SPARROW_FIXED_POINT - SPARROW_MAP_LUT_SHIFT)
15 #define FL_DUMPFILE "/tmp/edges.dump"
18 typedef enum corner_status {
19 CORNER_UNUSED,
20 CORNER_PROJECTED,
21 CORNER_EXACT,
22 } corner_status_t;
24 typedef enum edges_state {
25 EDGES_FIND_NOISE,
26 EDGES_FIND_LINES,
27 EDGES_FIND_CORNERS,
29 EDGES_NEXT_STATE,
30 } edges_state_t;
32 typedef struct sparrow_corner_s {
33 int in_x;
34 int in_y;
35 /*dyr -> dy to next point right
36 dxd ->dx to next point down */
37 int dxr;
38 int dyr;
39 int dxd;
40 int dyd;
41 corner_status_t status;
42 } sparrow_corner_t;
44 typedef struct sparrow_voter_s {
45 int x;
46 int y;
47 guint32 signal;
48 } sparrow_voter_t;
50 typedef struct sparrow_cluster_s {
51 int n;
52 sparrow_voter_t voters[8];
53 } sparrow_cluster_t;
56 typedef union sparrow_signal_s {
57 guint16 v_signal;
58 guint16 h_signal;
59 } sparrow_signal_t;
62 typedef struct sparrow_intersect_s {
63 guint16 lines[2];
64 guint16 signal[2];
65 } sparrow_intersect_t;
67 typedef struct sparrow_line_s {
68 gint offset;
69 sparrow_axis_t dir;
70 gint index;
71 } sparrow_line_t;
73 typedef struct sparrow_find_lines_s {
74 //sparrow_line_t *lines;
75 sparrow_line_t *h_lines;
76 sparrow_line_t *v_lines;
77 sparrow_line_t **shuffled_lines;
78 int current;
79 int n_lines;
80 int n_vlines;
81 int n_hlines;
82 gint shift1;
83 gint shift2;
84 sparrow_intersect_t *map;
85 sparrow_corner_t *mesh;
86 sparrow_cluster_t *clusters;
87 IplImage *debug;
88 IplImage *threshold;
89 IplImage *working;
90 IplImage *input;
91 int counter;
92 edges_state_t state;
93 } sparrow_find_lines_t;
96 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
97 "fl:\n" \
98 " sparrow_line_t *h_lines: %p\n" \
99 " sparrow_line_t *v_lines: %p\n" \
100 " sparrow_line_t **shuffled_lines: %p\n" \
101 " int current: %d\n" \
102 " int n_lines: %d\n" \
103 " int n_vlines: %d\n" \
104 " int n_hlines: %d\n" \
105 " gint threshold: %d\n" \
106 " gint shift1: %d\n" \
107 " gint shift2: %d\n" \
108 " sparrow_intersect_t *map: %p\n" \
109 " sparrow_corner_t *mesh: %p\n" \
110 " sparrow_cluster_t *clusters: %p\n" \
112 (fl)->h_lines, \
113 (fl)->v_lines, \
114 (fl)->shuffled_lines, \
115 (fl)->current, \
116 (fl)->n_lines, \
117 (fl)->n_vlines, \
118 (fl)->n_hlines, \
119 (fl)->threshold, \
120 (fl)->shift1, \
121 (fl)->shift2, \
122 (fl)->map, \
123 (fl)->mesh, \
124 (fl)->clusters) \
126 //#undef debug_find_lines
127 //#define debug_find_lines(x) /* */
130 #endif /*have this .h*/