~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/tools/segment/seg_infr.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <tina/sys.h>
  4 #include <tina/sysfuncs.h>
  5 #include <tina/math.h>
  6 #include <tina/mathfuncs.h>
  7 #include <tina/vision.h>
  8 #include <tina/visionfuncs.h>
  9 
 10 #define LEFT_DATA       0
 11 #define RIGHT_DATA      1
 12 #define MONO_DATA       2
 13 
 14 /**
 15 
 16 working image (LEFT, RIGHT, MONO)
 17 **/
 18 
 19 static  image_data = LEFT_DATA;
 20 
 21 int     seg_image_data_get(void)
 22 {
 23     return (image_data);
 24 }
 25 
 26 void    seg_image_data_set(int new_image_data)
 27 {
 28     image_data = new_image_data;
 29 }
 30 
 31 /**
 32 segment image
 33 **/
 34 
 35 static Imrect *image;
 36 
 37 Imrect *seg_image_get(void)
 38 {
 39     return (image);
 40 }
 41 
 42 void    seg_image_set(Imrect * newim)
 43 {
 44     image = newim;
 45 }
 46 
 47 /**
 48 list of segment edge strings
 49 **/
 50 
 51 static List *es = NULL;
 52 
 53 List   *seg_es_get(void)
 54 {
 55     return (es);
 56 }
 57 
 58 void    seg_es_set(List * newes)
 59 {
 60     es = newes;
 61 }
 62 
 63 /**
 64 recursive list of segment geometry
 65 **/
 66 
 67 static List *geom = NULL;
 68 
 69 List   *seg_geom_get(void)
 70 {
 71     return (geom);
 72 }
 73 
 74 void    seg_geom_set(List * newgeom)
 75 {
 76     void    seg_select_geom_set(List * newgeom);
 77 
 78     seg_select_geom_set((List *) NULL); /** keeps consistency **/
 79     (void) reclist_list_free(geom, geom_free, (int)NULL, NULL);
 80     geom = newgeom;
 81 }
 82 
 83 void    seg_geom_null(void)
 84 {
 85     geom = NULL;
 86 }
 87 
 88 /**
 89 segment edge string index utilities
 90 **/
 91 
 92 static Windex *index = NULL;
 93 
 94 void    seg_es_build_index(void)
 95 {
 96     wx_free(index, list_rm_links);
 97     index = es_list_build_wx(es);
 98 }
 99 
100 List   *seg_es_get_from_index(Vec2 v)
101 {
102     Ipos    p = {Ipos_id};
103     int     i, j;
104 
105     if (index == NULL)
106         return (NULL);
107 
108     p = wx_get_index(index, v);
109     i = ipos_y(p);
110     j = ipos_x(p);
111     if (i < 0 || i >= index->m || j < 0 || j >= index->n)
112         return (NULL);
113 
114     return (index->index[i][j]);
115 }
116 
117 void    seg_es_index_delete(List * es)
118 /* delete edge es from index */
119 {
120     while (es != NULL)
121     {
122         wx_delete_entry(index, es->to);
123         es = es->next;
124     }
125 }
126 
127 void    seg_es_index_replace(List * es, List * es_list)
128 {
129     while (es != NULL)
130     {
131         wx_replace_entry(index, es->to, es_list);
132         es = es->next;
133     }
134 }
135 
136 void    seg_es_index_duplicate(Tstring * es1, Tstring * es2)
137 {
138     wx_duplicate_entry(index, (void *) es1, (void *) es2, STRING);
139 }
140 
141 /**
142 list of selected positions on edge strings
143 **/
144 
145 static List *select_pos = NULL;
146 
147 List   *seg_select_pos_get(void)
148 {
149     return (select_pos);
150 }
151 
152 void    seg_select_pos_set(List * newpos)
153 {
154     list_rm_links(select_pos);
155     select_pos = newpos;
156 }
157 
158 /**
159 list of selected edge strings
160 **/
161 
162 static List *select_es = NULL;
163 
164 List   *seg_select_es_get(void)
165 {
166     return (select_es);
167 }
168 
169 void    seg_select_es_set(List * newes)
170 {
171     list_rm_links(select_es);
172     select_es = newes;
173 }
174 
175 /**
176 list of selected geometry
177 **/
178 
179 
180 static List *select_geom = NULL;
181 
182 List   *seg_select_geom_get(void)
183 {
184     return (select_geom);
185 }
186 
187 void    seg_select_geom_set(List * newgeom)
188 {
189     list_rm_links(select_geom);
190     select_geom = newgeom;
191 }
192 
193 /**
194 Low segmentation threshold
195 **/
196 
197 static double lo_thres = 1.0;
198 
199 double  seg_lo_thres_get(void)
200 {
201     return (lo_thres);
202 }
203 
204 void    seg_lo_thres_set(double newthres)
205 {
206     lo_thres = newthres;
207 }
208 
209 /**
210 High segmentation threshold
211 **/
212 
213 static double hi_thres = 2.0;
214 
215 double  seg_hi_thres_get(void)
216 {
217     return (hi_thres);
218 }
219 
220 void    seg_hi_thres_set(double newthres)
221 {
222     hi_thres = newthres;
223 }
224 
225 /**
226 Maximum divergence at high threshold
227 **/
228 
229 static int max_div = 5;
230 
231 int     seg_max_div_get(void)
232 {
233     return (max_div);
234 }
235 
236 void    seg_max_div_set(int newdiv)
237 {
238     max_div = newdiv;
239 }
240 
241 /**
242 Conic confidence threshold
243 **/
244 
245 static double conf_thres = 0.1;
246 
247 double  seg_conf_thres_get(void)
248 {
249     return (conf_thres);
250 }
251 
252 void    seg_conf_thres_set(double newthres)
253 {
254     conf_thres = newthres;
255 }
256 
257 /**
258 Plane fit threshold
259 **/
260 
261 static double plane_thres = 2.0;
262 
263 double  seg_plane_thres_get(void)
264 {
265     return (plane_thres);
266 }
267 
268 void    seg_plane_thres_set(double newthres)
269 {
270     plane_thres = newthres;
271 }
272 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.