1 #ifndef __SPARROW_EDGES_H__
2 #define __SPARROW_EDGES_H__
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 /*if squared error between observed error and predicted error exceeds this,
19 ignore the observation */
20 #define CORNER_EXACT_THRESHOLD 16
22 /*a corner based on fewer than this number of projects cannot be considered
24 #define MIN_CORNER_ESTIMATES 5
26 /* nice big word. acos(1.0 - MAX_NONCOLLINEARITY) = angle of deviation. This
27 is used when lining up known points to estimte the position of lost ones.
28 0.005: 5.7 degrees, 0.01: 8.1, 0.02: 11.5, 0.04: 16.3, 0.08: 23.1
29 1 pixel deviation in 32 -> ~ 1/33 == 0.03 (if I understand correctly)
31 #define MAX_NONCOLLINEARITY 0.02
33 typedef enum corner_status
{
40 typedef enum edges_state
{
49 #define USE_FLOAT_COORDS 1
52 typedef float coord_t
;
53 typedef float coord_sum_t
;
54 #define QUANTISE_DELTA(d)((d) / LINE_PERIOD)
57 /* the mesh is stored in a fixed point notation.*/
58 #define SPARROW_FIXED_POINT 9
61 typedef gint64 coord_sum_t
;
62 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
66 typedef struct sparrow_estimator_s
{
73 //int mul; /* estimate: x1,y1 + mul * diff */
74 } sparrow_estimator_t
;
76 typedef struct sparrow_corner_s
{
79 /*dyr -> dy to next point right
80 dxd ->dx to next point down */
85 corner_status_t status
;
88 typedef struct sparrow_voter_s
{
94 typedef struct sparrow_point_s
{
99 typedef struct sparrow_cluster_s
{
101 sparrow_voter_t voters
[8];
105 typedef union sparrow_signal_s
{
111 typedef struct sparrow_intersect_s
{
114 } sparrow_intersect_t
;
116 typedef struct sparrow_line_s
{
122 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
123 pointers or other unnecessary things that might vary in size across
125 typedef struct sparrow_fl_condensed
{
128 } sparrow_fl_condensed_t
;
130 typedef struct sparrow_find_lines_s
{
131 sparrow_line_t
*h_lines
;
132 sparrow_line_t
*v_lines
;
133 sparrow_line_t
**shuffled_lines
;
140 sparrow_intersect_t
*map
;
141 sparrow_corner_t
*mesh_mem
;
142 sparrow_corner_t
*mesh
;
143 sparrow_corner_t
*mesh_next
;
144 sparrow_cluster_t
*clusters
;
151 } sparrow_find_lines_t
;
154 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
156 " sparrow_line_t *h_lines: %p\n" \
157 " sparrow_line_t *v_lines: %p\n" \
158 " sparrow_line_t **shuffled_lines: %p\n" \
159 " int current: %d\n" \
160 " int n_lines: %d\n" \
161 " int n_vlines: %d\n" \
162 " int n_hlines: %d\n" \
163 " gint shift1: %d\n" \
164 " gint shift2: %d\n" \
165 " sparrow_intersect_t *map: %p\n" \
166 " sparrow_corner_t *mesh: %p\n" \
167 " sparrow_cluster_t *clusters: %p\n" \
168 " double *dither: %p \n" \
169 " IplImage *debug: %p\n" \
170 " IplImage *threshold: %p\n" \
171 " IplImage *working: %p\n" \
172 " IplImage *input: %p\n" \
173 " edges_state_t state: %d\n" \
177 (fl)->shuffled_lines, \
194 //#undef debug_find_lines
195 //#define debug_find_lines(x) /* */
198 #endif /*have this .h*/