1 #ifndef __SPARROW_EDGES_H__
2 #define __SPARROW_EDGES_H__
4 /* CAMERA_ADJUST_TIME to wair for iris to adjust after find screen flash */
5 #define CAMERA_ADJUST_TIME 10
9 /* for discarding outliers */
10 #define OUTLIER_RADIUS 7
11 #define OUTLIER_THRESHOLD (OUTLIER_RADIUS * OUTLIER_RADIUS)
13 #define BAD_PIXEL 0xffff
15 #define FL_DUMPFILE "/tmp/edges.dump"
17 #define COLOUR_QUANT 1
18 #define COLOUR_MASK (0xff >> COLOUR_QUANT)
20 /*if squared error between observed error and predicted error exceeds this,
21 ignore the observation */
22 #define CORNER_EXACT_THRESHOLD 16
24 /*a corner based on fewer than this number of projects cannot be considered
26 #define MIN_CORNER_ESTIMATES 5
28 /* nice big word. acos(1.0 - MAX_NONCOLLINEARITY) = angle of deviation. This
29 is used when lining up known points to estimte the position of lost ones.
30 0.005: 5.7 degrees, 0.01: 8.1, 0.02: 11.5, 0.04: 16.3, 0.08: 23.1
31 1 pixel deviation in 32 -> ~ 1/33 == 0.03 (if I understand correctly)
33 #define MAX_NONCOLLINEARITY 0.02
35 typedef enum corner_status
{
42 typedef enum edges_state
{
51 #define USE_FLOAT_COORDS 1
54 typedef float coord_t
;
55 typedef float coord_sum_t
;
56 #define QUANTISE_DELTA(d)((d) / LINE_PERIOD)
59 /* the mesh is stored in a fixed point notation.*/
60 #define SPARROW_FIXED_POINT 9
63 typedef gint64 coord_sum_t
;
64 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
68 typedef struct sparrow_estimator_s
{
75 //int mul; /* estimate: x1,y1 + mul * diff */
76 } sparrow_estimator_t
;
78 typedef struct sparrow_corner_s
{
81 /*dyr -> dy to next point right
82 dxd ->dx to next point down */
87 corner_status_t status
;
90 typedef struct sparrow_voter_s
{
96 typedef struct sparrow_point_s
{
101 typedef struct sparrow_cluster_s
{
103 sparrow_voter_t voters
[8];
107 typedef union sparrow_signal_s
{
113 typedef struct sparrow_intersect_s
{
116 } sparrow_intersect_t
;
118 typedef struct sparrow_line_s
{
124 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
125 pointers or other unnecessary things that might vary in size across
127 typedef struct sparrow_fl_condensed
{
130 } sparrow_fl_condensed_t
;
132 typedef struct sparrow_find_lines_s
{
133 sparrow_line_t
*h_lines
;
134 sparrow_line_t
*v_lines
;
135 sparrow_line_t
**shuffled_lines
;
144 sparrow_intersect_t
*map
;
145 sparrow_corner_t
*mesh_mem
;
146 sparrow_corner_t
*mesh
;
147 sparrow_corner_t
*mesh_next
;
148 sparrow_cluster_t
*clusters
;
155 } sparrow_find_lines_t
;
158 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
160 " sparrow_line_t *h_lines: %p\n" \
161 " sparrow_line_t *v_lines: %p\n" \
162 " sparrow_line_t **shuffled_lines: %p\n" \
163 " int current: %d\n" \
164 " int n_lines: %d\n" \
165 " int n_vlines: %d\n" \
166 " int n_hlines: %d\n" \
167 " gint shift1: %d\n" \
168 " gint shift2: %d\n" \
169 " gint unshift1: %d\n" \
170 " gint unshift2: %d\n" \
171 " sparrow_intersect_t *map: %p\n" \
172 " sparrow_corner_t *mesh: %p\n" \
173 " sparrow_cluster_t *clusters: %p\n" \
174 " double *dither: %p \n" \
175 " IplImage *debug: %p\n" \
176 " IplImage *threshold: %p\n" \
177 " IplImage *working: %p\n" \
178 " IplImage *input: %p\n" \
179 " edges_state_t state: %d\n" \
183 (fl)->shuffled_lines, \
202 //#undef debug_find_lines
203 //#define debug_find_lines(x) /* */
206 #endif /*have this .h*/