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 /*XXX should dither */
20 typedef enum corner_status
{
27 typedef enum edges_state
{
36 #define USE_FLOAT_COORDS 1
39 typedef float coord_t
;
40 typedef float coord_sum_t
;
41 #define QUANTISE_DELTA(d)((d) / LINE_PERIOD)
44 /* the mesh is stored in a fixed point notation.*/
45 #define SPARROW_FIXED_POINT 9
48 typedef gint64 coord_sum_t
;
49 #define QUANTISE_DELTA(d)(((d) + LINE_PERIOD / 2) / LINE_PERIOD)
53 typedef struct sparrow_estimator_s
{
60 //int mul; /* estimate: x1,y1 + mul * diff */
61 } sparrow_estimator_t
;
63 typedef struct sparrow_corner_s
{
66 /*dyr -> dy to next point right
67 dxd ->dx to next point down */
72 corner_status_t status
;
75 typedef struct sparrow_voter_s
{
81 typedef struct sparrow_cluster_s
{
83 sparrow_voter_t voters
[8];
87 typedef union sparrow_signal_s
{
93 typedef struct sparrow_intersect_s
{
96 } sparrow_intersect_t
;
98 typedef struct sparrow_line_s
{
104 /*condensed version of <struct sparrow_find_lines_s> for saving: contains no
105 pointers or other unnecessary things that might vary in size across
107 typedef struct sparrow_fl_condensed
{
110 } sparrow_fl_condensed_t
;
112 typedef struct sparrow_find_lines_s
{
113 sparrow_line_t
*h_lines
;
114 sparrow_line_t
*v_lines
;
115 sparrow_line_t
**shuffled_lines
;
122 sparrow_intersect_t
*map
;
123 sparrow_corner_t
*mesh_mem
;
124 sparrow_corner_t
*mesh
;
125 sparrow_corner_t
*mesh_next
;
126 sparrow_cluster_t
*clusters
;
132 } sparrow_find_lines_t
;
135 #define DEBUG_FIND_LINES(fl)GST_DEBUG( \
137 " sparrow_line_t *h_lines: %p\n" \
138 " sparrow_line_t *v_lines: %p\n" \
139 " sparrow_line_t **shuffled_lines: %p\n" \
140 " int current: %d\n" \
141 " int n_lines: %d\n" \
142 " int n_vlines: %d\n" \
143 " int n_hlines: %d\n" \
144 " gint shift1: %d\n" \
145 " gint shift2: %d\n" \
146 " sparrow_intersect_t *map: %p\n" \
147 " sparrow_corner_t *mesh: %p\n" \
148 " sparrow_cluster_t *clusters: %p\n" \
149 " IplImage *debug: %p\n" \
150 " IplImage *threshold: %p\n" \
151 " IplImage *working: %p\n" \
152 " IplImage *input: %p\n" \
153 " edges_state_t state: %d\n" \
157 (fl)->shuffled_lines, \
173 //#undef debug_find_lines
174 //#define debug_find_lines(x) /* */
177 #endif /*have this .h*/