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
{
44 EDGES_WAIT_FOR_LINES_LOCK
,
52 #define USE_FLOAT_COORDS 1
55 typedef float coord_t
;
56 typedef float coord_sum_t
;
57 #define QUANTISE_DELTA(d)((d) / LINE_PERIOD)
60 /* the mesh is stored in a fixed point notation.*/
61 #define SPARROW_FIXED_POINT 9
64 typedef gint64 coord_sum_t
;
65 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
69 typedef struct sparrow_estimator_s
{
76 //int mul; /* estimate: x1,y1 + mul * diff */
77 } sparrow_estimator_t
;
79 typedef struct sparrow_corner_s
{
82 /*dyr -> dy to next point right
83 dxd ->dx to next point down */
88 corner_status_t status
;
91 typedef struct sparrow_voter_s
{
97 typedef struct sparrow_point_s
{
102 typedef struct sparrow_cluster_s
{
104 sparrow_voter_t voters
[8];
108 typedef union sparrow_signal_s
{
114 typedef struct sparrow_intersect_s
{
117 } sparrow_intersect_t
;
119 typedef struct sparrow_line_s
{
125 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
126 pointers or other unnecessary things that might vary in size across
128 typedef struct sparrow_fl_condensed
{
131 } sparrow_fl_condensed_t
;
133 typedef struct sparrow_find_lines_s
{
134 sparrow_line_t
*h_lines
;
135 sparrow_line_t
*v_lines
;
136 sparrow_line_t
**shuffled_lines
;
143 sparrow_intersect_t
*map
;
144 sparrow_corner_t
*mesh_mem
;
145 sparrow_corner_t
*mesh
;
146 sparrow_corner_t
*mesh_next
;
147 sparrow_cluster_t
*clusters
;
154 } sparrow_find_lines_t
;
157 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
159 " sparrow_line_t *h_lines: %p\n" \
160 " sparrow_line_t *v_lines: %p\n" \
161 " sparrow_line_t **shuffled_lines: %p\n" \
162 " int current: %d\n" \
163 " int n_lines: %d\n" \
164 " int n_vlines: %d\n" \
165 " int n_hlines: %d\n" \
166 " gint shift1: %d\n" \
167 " gint shift2: %d\n" \
168 " sparrow_intersect_t *map: %p\n" \
169 " sparrow_corner_t *mesh: %p\n" \
170 " sparrow_cluster_t *clusters: %p\n" \
171 " double *dither: %p \n" \
172 " IplImage *debug: %p\n" \
173 " IplImage *threshold: %p\n" \
174 " IplImage *working: %p\n" \
175 " IplImage *input: %p\n" \
176 " edges_state_t state: %d\n" \
180 (fl)->shuffled_lines, \
197 //#undef debug_find_lines
198 //#define debug_find_lines(x) /* */
201 #endif /*have this .h*/