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 typedef enum corner_status
{
25 typedef enum edges_state
{
34 #define USE_FLOAT_COORDS 1
37 typedef float coord_t
;
38 typedef float coord_sum_t
;
39 #define QUANTISE_DELTA(d)((d) / LINE_PERIOD)
42 /* the mesh is stored in a fixed point notation.*/
43 #define SPARROW_FIXED_POINT 9
46 typedef gint64 coord_sum_t
;
47 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
51 typedef struct sparrow_estimator_s
{
58 //int mul; /* estimate: x1,y1 + mul * diff */
59 } sparrow_estimator_t
;
61 typedef struct sparrow_corner_s
{
64 /*dyr -> dy to next point right
65 dxd ->dx to next point down */
70 corner_status_t status
;
73 typedef struct sparrow_voter_s
{
79 typedef struct sparrow_point_s
{
84 typedef struct sparrow_cluster_s
{
86 sparrow_voter_t voters
[8];
90 typedef union sparrow_signal_s
{
96 typedef struct sparrow_intersect_s
{
99 } sparrow_intersect_t
;
101 typedef struct sparrow_line_s
{
107 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
108 pointers or other unnecessary things that might vary in size across
110 typedef struct sparrow_fl_condensed
{
113 } sparrow_fl_condensed_t
;
115 typedef struct sparrow_find_lines_s
{
116 sparrow_line_t
*h_lines
;
117 sparrow_line_t
*v_lines
;
118 sparrow_line_t
**shuffled_lines
;
125 sparrow_intersect_t
*map
;
126 sparrow_corner_t
*mesh_mem
;
127 sparrow_corner_t
*mesh
;
128 sparrow_corner_t
*mesh_next
;
129 sparrow_cluster_t
*clusters
;
136 } sparrow_find_lines_t
;
139 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
141 " sparrow_line_t *h_lines: %p\n" \
142 " sparrow_line_t *v_lines: %p\n" \
143 " sparrow_line_t **shuffled_lines: %p\n" \
144 " int current: %d\n" \
145 " int n_lines: %d\n" \
146 " int n_vlines: %d\n" \
147 " int n_hlines: %d\n" \
148 " gint shift1: %d\n" \
149 " gint shift2: %d\n" \
150 " sparrow_intersect_t *map: %p\n" \
151 " sparrow_corner_t *mesh: %p\n" \
152 " sparrow_cluster_t *clusters: %p\n" \
153 " double *dither: %p \n" \
154 " IplImage *debug: %p\n" \
155 " IplImage *threshold: %p\n" \
156 " IplImage *working: %p\n" \
157 " IplImage *input: %p\n" \
158 " edges_state_t state: %d\n" \
162 (fl)->shuffled_lines, \
179 //#undef debug_find_lines
180 //#define debug_find_lines(x) /* */
183 #endif /*have this .h*/