change in_x, iny to x, y, and remove unused lut types
[sparrow.git] / edges.h
blob9e1f67d7eb83975187441325faf012f537748ecd
1 #ifndef __SPARROW_EDGES_H__
2 #define __SPARROW_EDGES_H__
4 #define SAFETY_LAG 3;
5 #define SIG_WEIGHT 2
7 /* for discarding outliers */
8 #define OUTLIER_RADIUS 7
9 #define OUTLIER_THRESHOLD (OUTLIER_RADIUS * OUTLIER_RADIUS)
11 #define BAD_PIXEL 0xffff
13 #define FL_DUMPFILE "/tmp/edges.dump"
15 #define COLOUR_QUANT 1
16 #define COLOUR_MASK (0xff >> COLOUR_QUANT)
18 /*XXX should dither */
19 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
22 typedef enum corner_status {
23 CORNER_UNUSED,
24 CORNER_PROJECTED,
25 CORNER_EXACT,
26 } corner_status_t;
28 typedef enum edges_state {
29 EDGES_FIND_NOISE,
30 EDGES_FIND_LINES,
31 EDGES_FIND_CORNERS,
32 EDGES_WAIT_FOR_PLAY,
34 EDGES_NEXT_STATE,
35 } edges_state_t;
37 typedef struct sparrow_corner_s {
38 int x;
39 int y;
40 /*dyr -> dy to next point right
41 dxd ->dx to next point down */
42 int dxr;
43 int dyr;
44 int dxd;
45 int dyd;
46 corner_status_t status;
47 } sparrow_corner_t;
49 typedef struct sparrow_voter_s {
50 int x;
51 int y;
52 guint32 signal;
53 } sparrow_voter_t;
55 typedef struct sparrow_cluster_s {
56 int n;
57 sparrow_voter_t voters[8];
58 } sparrow_cluster_t;
61 typedef union sparrow_signal_s {
62 guint16 v_signal;
63 guint16 h_signal;
64 } sparrow_signal_t;
67 typedef struct sparrow_intersect_s {
68 guint16 lines[2];
69 guint16 signal[2];
70 } sparrow_intersect_t;
72 typedef struct sparrow_line_s {
73 gint offset;
74 sparrow_axis_t dir;
75 gint index;
76 } sparrow_line_t;
78 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
79 pointers or other unnecessary things that might vary in size across
80 architectures. */
81 typedef struct sparrow_fl_condensed {
82 gint32 n_vlines;
83 gint32 n_hlines;
84 } sparrow_fl_condensed_t;
86 typedef struct sparrow_find_lines_s {
87 sparrow_line_t *h_lines;
88 sparrow_line_t *v_lines;
89 sparrow_line_t **shuffled_lines;
90 int current;
91 int n_lines;
92 int n_vlines;
93 int n_hlines;
94 gint shift1;
95 gint shift2;
96 sparrow_intersect_t *map;
97 sparrow_corner_t *mesh;
98 sparrow_cluster_t *clusters;
99 IplImage *debug;
100 IplImage *threshold;
101 IplImage *working;
102 IplImage *input;
103 edges_state_t state;
104 } sparrow_find_lines_t;
107 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
108 "fl:\n" \
109 " sparrow_line_t *h_lines: %p\n" \
110 " sparrow_line_t *v_lines: %p\n" \
111 " sparrow_line_t **shuffled_lines: %p\n" \
112 " int current: %d\n" \
113 " int n_lines: %d\n" \
114 " int n_vlines: %d\n" \
115 " int n_hlines: %d\n" \
116 " gint shift1: %d\n" \
117 " gint shift2: %d\n" \
118 " sparrow_intersect_t *map: %p\n" \
119 " sparrow_corner_t *mesh: %p\n" \
120 " sparrow_cluster_t *clusters: %p\n" \
121 " IplImage *debug: %p\n" \
122 " IplImage *threshold: %p\n" \
123 " IplImage *working: %p\n" \
124 " IplImage *input: %p\n" \
125 " edges_state_t state: %d\n" \
127 (fl)->h_lines, \
128 (fl)->v_lines, \
129 (fl)->shuffled_lines, \
130 (fl)->current, \
131 (fl)->n_lines, \
132 (fl)->n_vlines, \
133 (fl)->n_hlines, \
134 (fl)->shift1, \
135 (fl)->shift2, \
136 (fl)->map, \
137 (fl)->mesh, \
138 (fl)->clusters, \
139 (fl)->debug, \
140 (fl)->threshold, \
141 (fl)->working, \
142 (fl)->input, \
143 (fl)->state \
145 //#undef debug_find_lines
146 //#define debug_find_lines(x) /* */
149 #endif /*have this .h*/