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

Linux Cross Reference
Tina5/tina-tools/tinatool/tlvision/tlvisEdge_tool.c

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

  1 /**********
  2 *
  3 *
  4  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  5  * University of Manchester, UK.  All rights reserved.
  6  * 
  7  * Redistribution and use in source and binary forms, with or without modification, 
  8  * are permitted provided that the following conditions are met:
  9  * 
 10  *   . Redistributions of source code must retain the above copyright notice, 
 11  *     this list of conditions and the following disclaimer.
 12  *    
 13  *   . Redistributions in binary form must reproduce the above copyright notice,
 14  *     this list of conditions and the following disclaimer in the documentation 
 15  *     and/or other materials provided with the distribution.
 16  * 
 17  *   . Neither the name of the University of Manchester nor the names of its
 18  *     contributors may be used to endorse or promote products derived from this 
 19  *     software without specific prior written permission.
 20  * 
 21  * 
 22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 32  * POSSIBILITY OF SUCH DAMAGE.
 33 **********
 34 *
 35 * Program :   TINA
 36 * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlvision/tlvisEdge_tool.c,v $
 37 * Date    :  $Date: 2009/03/27 16:01:50 $
 38 * Version :  $Revision: 1.8 $
 39 * CVS Id  :  $Id: tlvisEdge_tool.c,v 1.8 2009/03/27 16:01:50 paul Exp $
 40 *
 41 * Notes   :
 42 *
 43 *
 44 *
 45 *********
 46 */
 47 
 48 #include "tlvisEdge_tool.h"
 49 
 50 #if HAVE_CONFIG_H
 51   #include <config.h>
 52 #endif
 53 
 54 #include <tina/sys/sysDef.h>
 55 #include <tina/sys/sysPro.h>
 56 #include <tina/math/mathDef.h>
 57 #include <tina/math/mathPro.h>
 58 #include <tina/geometry/geomDef.h>
 59 #include <tina/geometry/geomPro.h>
 60 #include <tina/image/imgDef.h>
 61 #include <tina/image/imgPro.h>
 62 #include <tina/vision/visDef.h>
 63 #include <tina/vision/visPro.h>
 64 
 65 #include <tinatool/wdgts/wdgtsDef.h>
 66 #include <tinatool/wdgts/wdgtsPro.h>
 67 #include <tinatool/draw/drawDef.h>
 68 #include <tinatool/draw/drawPro.h>
 69 #include <tinatool/tlbase/tlbasePro.h>
 70 #include <tinatool/tlvision/tlvisCnr_pick.h>
 71 #include <tinatool/tlvision/tlvisEdge_pick.h>
 72 #include <tinatool/tlvision/tlvisEdge_geom_pick.h>
 73 #include <tinatool/tlvision/tlvisEdge_epi_mouse.h>
 74 
 75 
 76 /* Local parameters managed by the edge processing tool */
 77 static double sigma = 1.0, precision = 0.01;
 78 static double low_edge_thres = 3.0, up_edge_thres = 5.0;
 79 static int len_thres = 5;
 80 static double mid_point = 128.0;
 81 static double conf_thres = 0.1;
 82 static double low_fit_thres = 0.5;
 83 static double up_fit_thres = 1.0;
 84 static double rect_scale = 1.0;
 85 static int max_div = 5;         /* max divergence from fit */
 86 static int sample = 12;         /* initial sample frequency */
 87 static int  stereo_method = 0;       /* stereo matching method */
 88 static Bool use_TV_ROIs = false;
 89 static int kernel = 5;
 90 static double noise = 8.0;
 91 static Interp interp = sinc5_interp;
 92 
 93 /* Other local variables */
 94 static Bool edges_rectified = false;
 95 static double Disp = 0;         /* major component of disparity */
 96 static void *rsc;
 97 
 98 
 99 #define POLY_PROX 0
100 #define LINEAR_PROX 1
101 #define CONIC_PROX 2
102 #define LINEAR_CONIC_PROX 3
103 #define STEREO_PMF  0
104 #define STEREO_SC   1
105 
106 #define DEFAULT 0
107 #define JOIN    1
108 
109 static int stereo_images = 1;
110 static int feature_type = 0;
111 static int approx_type = LINEAR_CONIC_PROX;
112 static int options = DEFAULT;
113 
114 /* Make the major component of disparity, ie that produced by the
115  * rectification process, available to other modules */
116 double  edge_Disp_get(void)
117 {
118     return (Disp);
119 }
120 
121 /* External check to see if edge rectification has been applied */
122 Bool    edge_edges_rectified_get(void)
123 {
124     return (edges_rectified);
125 }
126 
127 /* External setting of stereo method to SC */
128 int    edge_stereo_method(void)
129 {
130 
131     return stereo_method;
132 }
133 
134 
135 /********** Callback functions **********/
136 
137 static void rank_proc(void)
138 {
139   Imrect *left_im = left_image_get(), *right_im = right_image_get();
140   Tv *tvl = NULL, *tvr = NULL;
141 
142   if ((tvl = left_tv_get()) != NULL && (use_TV_ROIs == true))
143     {
144       left_im = im_subim(left_im, tv_get_im_roi(tvl));
145       left_image_set(left_im);
146     }
147 
148   if ((tvr = right_tv_get()) != NULL && (use_TV_ROIs == true))
149     {
150       right_im = im_subim(right_im, tv_get_im_roi(tvr));
151       right_image_set(right_im);
152     }
153 
154   left_image_set(im_rank(left_image_get(), kernel, noise));
155   right_image_set(im_rank(right_image_get(), kernel, noise));
156 }
157 
158 void stereo_rectify_proc(void)
159 {
160   Imrect *left_im = left_image_get(), *right_im = right_image_get();
161   Tv *tv;
162   Imrect *im;
163   Parcam *pcam;
164   double (*interp_func)(Imrect *image, float x, float y,
165                         float *px, float *py);
166 
167   pcam = pcam_get();
168 
169   if (left_im == NULL || right_im == NULL || pcam == NULL)
170     return;
171 
172   if (interp == sinc5_interp)
173     interp_func = im_get_sinc5interpf;
174   else if (interp == sinc3_interp)
175     interp_func = im_get_sinc3interpf;
176   else
177     interp_func = im_get_quadinterpf;
178 
179   tv = left_tv();
180   if ((tv != NULL) && (use_TV_ROIs == true))
181     im = imf_left_rectify(left_im, roi_inter(tv_get_im_roi(tv),
182                                              left_im->region),
183                           pcam, interp_func);
184   else
185     im = imf_left_rectify(left_im, NULL, pcam, interp_func);
186   left_image_set(im);
187 
188   tv = right_tv();
189   if ((tv != NULL) && (use_TV_ROIs == true))
190     im = imf_right_rectify(right_im, roi_inter(tv_get_im_roi(tv),
191                                                right_im->region),
192                            pcam, interp_func);
193   else
194     im = imf_right_rectify(right_im, NULL, pcam, interp_func);
195   right_image_set(im);
196 
197   stereo_method = STEREO_SC;
198 }
199 
200 /**** canny callback ****/
201 
202 static void mono_canny_proc(void)
203 {
204     Tv     *tv;
205     Imrect *im;
206 
207     tv = mono_tv_get();
208     im = mono_image_get();
209     if (tv != NULL && tv->tv_screen != NULL)    /* get roi from tv */
210         im = im_subim(im, tv_get_im_roi(tv));
211     if (feature_type == 0)
212         mono_edges_set(canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
213     else if (feature_type == 1)
214         mono_edges_set(var_canny(im, 0.718*sigma, precision, low_edge_thres, up_edge_thres, len_thres));
215     else if (feature_type == 2)
216         mono_edges_set(iso_canny(im, sigma, precision, low_edge_thres/20.0, up_edge_thres/20.0, len_thres, -mid_point));
217     else 
218         mono_edges_set(im_canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
219     if (tv != NULL && tv->tv_screen != NULL)
220         im_free(im);
221     tv_edges_conn(tv, mono_edges_get());
222     tv_flush(tv);
223     mono_geom_set((List *) NULL);       /* now out of date */
224 }
225 
226 static unsigned int block_label = 0;    /* no block is labeled 0 */
227 
228 static void stereo_canny_proc(void)
229 {
230     Tv     *tv;
231     Imrect *im;
232 
233     left_edges_null();
234     right_edges_null();
235     ralloc_free_blocked(block_label);   /* actually free up majority */
236     block_label = ralloc_new_blocked(1024);
237     (void) ralloc_end_blocked();
238 
239     tv = left_tv_get();
240     im = left_image_get();
241     if (tv != NULL && tv->tv_screen != NULL)    /* get roi from tv */
242         im = im_subim(im, tv_get_im_roi(tv));
243     (void) ralloc_start_blocked(block_label);
244     if (feature_type == 0)
245         left_edges_set(canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
246     else if (feature_type == 1)
247         left_edges_set(var_canny(im, 0.718*sigma, precision, low_edge_thres, up_edge_thres, len_thres));
248     else if (feature_type ==2)
249         left_edges_set(iso_canny(im, sigma, precision, low_edge_thres/20.0, up_edge_thres/20.0, len_thres, -mid_point));
250     else
251         left_edges_set(im_canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
252     (void) ralloc_end_blocked();
253     if (tv != NULL && tv->tv_screen != NULL)
254         im_free(im);
255     tv_edges_conn(tv, left_edges_get());
256     tv_flush(tv);
257 
258     tv = right_tv_get();
259     im = right_image_get();
260     if (tv != NULL && tv->tv_screen != NULL)    /* get roi from tv */
261         im = im_subim(im, tv_get_im_roi(tv));
262     (void) ralloc_start_blocked(block_label);
263     if (feature_type == 0)
264         right_edges_set(canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
265     else if (feature_type == 1)
266         right_edges_set(var_canny(im, 0.718*sigma, precision, low_edge_thres, up_edge_thres, len_thres));
267     else if (feature_type == 2)
268         right_edges_set(iso_canny(im, sigma, precision, low_edge_thres/20.0, up_edge_thres/20.0, len_thres, -mid_point));
269     else
270         right_edges_set(im_canny(im, sigma, precision, low_edge_thres, up_edge_thres, len_thres));
271 
272     (void) ralloc_end_blocked();
273     if (tv != NULL && tv->tv_screen != NULL)
274         im_free(im);
275     tv_edges_conn(tv, right_edges_get());
276     tv_flush(tv);
277 
278     Disp = 0;
279     edges_rectified = false;
280     left_geom_set((List *) NULL);       /* now out of date */
281     right_geom_set((List *) NULL);      /* now out of date */
282 }
283 
284 static void canny_proc(void)
285 {
286     if (stereo_images)
287         stereo_canny_proc();
288     else
289         mono_canny_proc();
290 }
291 
292 /**** rectify edges callback ****/
293 
294 static void rectify_edges_proc(void)
295 {
296     Imrect *left_er;
297     Imrect *right_er;
298     Camera *lcam;
299     Camera *rcam;
300     Parcam *pcam;
301     Vec2    cleft =
302     {Vec2_id};
303     Vec2    cright =
304     {Vec2_id};
305 
306     if (!stereo_images)
307     {
308         error("edge tool: not in stereo mode", warning);
309         return;
310     }
311     if (edges_rectified == true)
312     {
313         error("edge tool: edges already rectified", warning);
314         return;
315     }
316     left_er = left_edges_get();
317     right_er = right_edges_get();
318     lcam = left_camera();
319     rcam = right_camera();
320 
321     if (left_er == NULL || right_er == NULL)
322     {
323         error("no edges", warning);
324         return;
325     }
326     if (lcam == NULL || rcam == NULL)
327     {
328         error("no camera data", warning);
329         return;
330     }
331     pcam = pcam_get();
332     (void) ralloc_start_blocked(block_label);
333     er_apply_to_all_edges(left_er, edge_save_pos_prop, (void *) IMPOS);
334     er_apply_to_all_edges(right_er, edge_save_pos_prop, (void *) IMPOS);
335     if (lcam->correct_func != NULL)
336         er_correct(left_er, lcam);
337     if (rcam->correct_func != NULL)
338         er_correct(right_er, rcam);
339     er_rectify(left_er, pcam->rect1);
340     er_rectify(right_er, pcam->rect2);
341     (void) ralloc_end_blocked();
342     cleft = rectify_pos(pcam->rect1, vec2(lcam->cx, lcam->cy));
343     cright = rectify_pos(pcam->rect2, vec2(rcam->cx, rcam->cy));
344     Disp = vec2_x(cright) - vec2_x(cleft);
345     edges_rectified = true;
346     stereo_method = STEREO_PMF;
347 }
348 
349 /**** derectify edges callback ****/
350 
351 static void derectify_edges_proc(void)
352 {
353     Imrect *left_er;
354     Imrect *right_er;
355     Parcam *pcam;
356 
357     if (!stereo_images)
358     {
359         error("edge tool: not in stereo mode", warning);
360         return;
361     }
362     if (edges_rectified == false)
363     {
364         error("edge tool: edges not rectified", warning);
365         return;
366     }
367     left_er = left_edges_get();
368     right_er = right_edges_get();
369 
370     if (left_er == NULL || right_er == NULL)
371     {
372         error("no edges", warning);
373         return;
374     }
375     pcam = pcam_get();
376     if (pcam == NULL)
377     {
378         error("no camera data", warning);
379         return;
380     }
381     er_apply_to_all_edges(left_er, edge_get_pos_prop, (void *) IMPOS);
382     er_apply_to_all_edges(right_er, edge_get_pos_prop, (void *) IMPOS);
383 
384     /* old de-rectification without distortion correction NAT 12/5/92
385      * er_derectify(left_er, pcam->derect1); er_derectify(right_er,
386      * pcam->derect2); */
387     edges_rectified = false;
388 }
389 
390 /**** geom2 callback ****/
391 
392 static void stereo_geom2_proc(void)
393 {
394     Imrect *er;
395     Tv     *tv;
396     List   *strings;
397     double  low_th, up_th;
398 
399     if ((er = left_edges_get()) == NULL)
400         return;
401 
402     low_th = (edges_rectified == true) ? low_fit_thres * rect_scale : low_fit_thres;
403     up_th = (edges_rectified == true) ? up_fit_thres * rect_scale : up_fit_thres;
404 
405     strings = (List *) prop_get(er->props, STRING);
406 
407     switch (approx_type)
408     {
409     case POLY_PROX:
410         strings = poly_strings(strings, low_th);
411         break;
412     case LINEAR_PROX:
413         strings = linear_strings(strings, low_th);
414         break;
415     case CONIC_PROX:
416         conic_filter_set(conic_bckf);   /* set bias corrected filter */
417         strings = conic_strings(strings, sample, low_th, up_th, max_div);
418         break;
419     case LINEAR_CONIC_PROX:
420         conic_filter_set(conic_bckf);   /* set bias corrected filter */
421         strings = linear_strings(strings, low_th);
422         poly_strings_find_conics(strings, sample, low_th, up_th, max_div);
423         break;
424     }
425 
426     if (options & JOIN)
427     {
428         Imregion *roi;
429 
430         if (edges_rectified == true)
431         {
432             Rindex *sx = (Rindex *) prop_get(er->props, SINDEX);
433 
434             if (sx != NULL)
435                 roi = roi_copy(sx->region);
436             else
437                 roi = er_bounding_region(er);
438             roi->lx -= 10;
439             roi->ly -= 10;
440             roi->ux += 10;
441             roi->uy += 10;
442         } else
443             roi = roi_copy(er->region);
444 
445         strings = conic_join(strings, roi, conf_thres, low_th, up_th, max_div);
446         rfree((void *) roi);
447     }
448     if (edges_rectified == true)
449     {
450         Parcam *pcam = pcam_get();
451 
452         reclist_list_apply(strings, geom_add_image_pos_prop, 0, (void *) &pcam->derect1);
453     }
454     left_geom_set(strings);
455     tv = left_tv_get();
456     tv_repaint(tv);
457     reclist_list_draw(tv, strings, 0, geom_col_draw, NULL);
458 }
459 
460 static void mono_geom2_proc(void)
461 {
462     Imrect *er;
463     Tv     *tv;
464     List   *strings;
465     double  low_th, up_th;
466 
467     if ((er = mono_edges_get()) == NULL)
468         return;
469 
470     low_th = low_fit_thres;
471     up_th = up_fit_thres;
472 
473     if((strings = (List *) prop_get(er->props, STRING))==NULL)
474     {
475         er_find_edge_strings(er);
476         er_rm_edges(er, EDGE_GET_CONN_MASK, EDGE_NOLINK);
477         er_edge_strings_thres(er, len_thres, up_edge_thres);
478         er_set_row_index(er);
479         strings = (List *) prop_get(er->props, STRING);
480     }
481 
482     switch (approx_type)
483     {
484     case POLY_PROX:
485         strings = poly_strings(strings, low_th);
486         break;
487     case LINEAR_PROX:
488         strings = linear_strings(strings, low_th);
489         break;
490     case CONIC_PROX:
491         conic_filter_set(conic_bckf);   /* set bias corrected filter */
492         strings = conic_strings(strings, sample, low_th, up_th, max_div);
493         break;
494     case LINEAR_CONIC_PROX:
495         conic_filter_set(conic_bckf);   /* set bias corrected filter */
496         strings = linear_strings(strings, low_th);
497         poly_strings_find_conics(strings, sample, low_th, up_th, max_div);
498         break;
499     }
500 
501     if (options & JOIN)
502         strings = conic_join(strings, er->region, conf_thres, low_th, up_th, max_div);
503 
504     mono_geom_set(strings);
505     tv = mono_tv_get();
506     tv_repaint(tv);
507     reclist_list_draw(tv, strings, 0, geom_col_draw, NULL);
508 }
509 
510 static void geom2_proc(void)
511 {
512     if (stereo_images)
513         stereo_geom2_proc();
514     else
515         mono_geom2_proc();
516 }
517 
518 /**** Pick function callbacks ****/
519 
520 static void mono_edge_pick_proc(Tv_pick(*func) ( /* ??? */ ))
521 {
522     Tv     *tv = mono_tv_get();
523 
524     tv_set_pick(tv, (*func) ());
525     (void) tv_set_activity(tv, PICK);
526 }
527 
528 static void left_edge_pick_proc(Tv_pick(*func) ( /* ??? */ ))
529 {
530     Tv     *tv = left_tv_get();
531 
532     tv_set_pick(tv, (*func) ());
533     (void) tv_set_activity(tv, PICK);
534 }
535 
536 static void right_edge_pick_proc(Tv_pick(*func) ( /* ??? */ ))
537 {
538     Tv     *tv = right_tv_get();
539 
540     tv_set_pick(tv, (*func) ());
541     (void) tv_set_activity(tv, PICK);
542 }
543 
544 static void left_geom_pick_proc(Tv_pick(*func) ( /* ??? */ ))
545 {
546     Tv     *tv = left_tv_get();
547 
548     tv_set_pick(tv, (*func) ());
549     (void) tv_set_activity(tv, PICK);
550 }
551 
552 /**** Mouse function callbacks ****/
553 
554 static void mono_mouse_proc(Tv_mouse(*func) ( /* ??? */ ))
555 {
556     Tv     *tv = mono_tv_get();
557 
558     tv_set_mouse(tv, (*func) ());
559     (void) tv_set_activity(tv, MOUSE);
560 }
561 
562 static void left_mouse_proc(Tv_mouse(*func) ( /* ??? */ ))
563 {
564     Tv     *tv = left_tv_get();
565 
566     tv_set_mouse(tv, (*func) ());
567     (void) tv_set_activity(tv, MOUSE);
568 }
569 
570 static void right_mouse_proc(Tv_mouse(*func) ( /* ??? */ ))
571 {
572     Tv     *tv = right_tv_get();
573 
574     tv_set_mouse(tv, (*func) ());
575     (void) tv_set_activity(tv, MOUSE);
576 }
577 
578 /********** Choice item callbacks **********/
579 
580 /**** Image choice callback ****/
581 
582 static void image_choice_proc(int val)
583 {
584     stereo_images = val;
585 }
586 
587 /**** disparity range choice callback ****/
588 
589 /*
590 static void disp_range_choice_proc(int val)
591 {
592     use_disp_histogram = val;
593 }
594 */
595 
596 /**** geom2 choice callback ****/
597 
598 static void geom2_choice_proc(int val)
599 {
600     approx_type = val;
601 }
602 
603 /**** geom2 option callback ****/
604 
605 static void geom2_option_proc(int val)
606 {
607     options = val;
608 }
609 
610 /********** Paramter dialog callbacks **********/
611 
612 void   *tw_fglobal();
613 void   *tw_iglobal();
614 void   *tw_ivalue();
615 
616 /**** Edge parameter dialog box callback ****/
617 
618 static void *sig, *pre, *th1, *th2, *lth;       /* callback handles */
619 
620 static void edge_param_refresh(void)
621 {
622      
623     (void) tw_fglobal_reset(sig);
624     (void) tw_fglobal_reset(pre);
625     (void) tw_fglobal_reset(th1);
626     (void) tw_fglobal_reset(th2);
627     (void) tw_iglobal_reset(lth);
628 }
629 
630 static void edge_choice_proc(int val)
631 {
632     feature_type = val;
633 }
634 
635 static void edge_param_dialog(void)
636 {
637     static void *dialog = NULL;
638 
639     if (dialog)
640     {
641         tw_show_dialog(dialog);
642         return;
643     }
644     dialog = tw_dialog("Edge Parameters");
645 
646     tw_choice("Feature:",
647            edge_choice_proc, 0, "step", "var", "iso", "image", NULL);
648     tw_help_button("edge_tool_parms");
649     tw_newrow();
650     sig = tw_fglobal("Sigma        :", &sigma, 12);
651     tw_newrow();
652     pre = tw_fglobal("Precision    :", &precision, 12);
653     tw_newrow();
654     th1 = tw_fglobal("Lower Thres  :", &low_edge_thres, 12);
655     tw_newrow();
656     th2 = tw_fglobal("Upper Thres  :", &up_edge_thres, 12);
657     tw_newrow();
658     lth = tw_iglobal("Length Thres :", &len_thres, 12);
659     tw_newrow();
660     tw_fglobal("Iso value :", &mid_point, 12);
661 
662     tw_end_dialog();
663 }
664 
665 /**** Stereo paramter dialog callback ****/
666 
667 static void stereo_param_dialog(void)
668 {
669     static void *dialog = NULL;
670 
671     if (dialog)
672     {
673         tw_show_dialog(dialog);
674         return;
675     }
676     dialog = tw_dialog("Rectify Parameters");
677 
678     tw_newrow();
679     rsc = tw_fglobal("Rect scale :", &rect_scale, 20);
680     tw_fglobal("  noise:", &noise, 10);
681 
682     tw_end_dialog();
683 }
684 
685 /**** Geom paramter dialog callback ****/
686 
687 static void *ct, *lft, *uft, *ft3;
688 
689 static void geom_param_refresh(void)
690 {
691     (void) tw_fglobal_reset(ct);
692     (void) tw_fglobal_reset(lft);
693     (void) tw_fglobal_reset(uft);
694     (void) tw_fglobal_reset(ft3);
695 }
696 
697 static void geom_param_dialog(void)
698 {
699     static void *dialog = NULL;
700 
701     if (dialog)
702     {
703         tw_show_dialog(dialog);
704         return;
705     }
706     dialog = tw_dialog("Geom Parameters");
707 
708     ct = tw_fglobal("Confidence thres :", &conf_thres, 20);
709     tw_newrow();
710     lft = tw_fglobal("Low fit thres :", &low_fit_thres, 20);
711     tw_newrow();
712     uft = tw_fglobal("Up  fit thres :", &up_fit_thres, 20);
713 
714     tw_end_dialog();
715 }
716 
717 void    edge_tool_refresh(void)
718 {
719     edge_param_refresh();
720     geom_param_refresh();
721 }
722 
723 /********** Tool creation **********/
724 
725 void    edge_tool(int x, int y)
726 {
727     static void *tool = NULL;
728 
729     if (tool)
730     {
731         tw_show_tool(tool);
732         return;
733     }
734     tool = tw_tool("Edge Geom Tool", x, y);
735 
736     tw_menubar("Pick :",
737                "Mono",
738                "null", mono_edge_pick_proc, null_pick,
739                "edge", mono_edge_pick_proc, mono_print,
740                NULL,
741                "Left",
742                "null", left_edge_pick_proc, null_pick,
743                "edge", left_edge_pick_proc, left_edge_print,
744                NULL,
745                "Geoml",
746                "print", left_geom_pick_proc, left_geom_print,
747                "choose", left_geom_pick_proc, left_geom_choose,
748                "delete", left_geom_pick_proc, left_geom_delete,
749                NULL,
750                "Right",
751                "null", right_edge_pick_proc, null_pick,
752                "edge", right_edge_pick_proc, right_edge_print,
753                NULL,
754                NULL);
755 
756     tw_newrow();
757     tw_menubar("Mouse:",
758                "Mono",
759                "null", mono_mouse_proc, null_mouse,
760                NULL,
761                "Left",
762                "null", left_mouse_proc, null_mouse,
763                "epi", left_mouse_proc, left_epi_mouse,
764                "rast", left_mouse_proc, left_raster_mouse,
765                NULL,
766                "Right",
767                "null", right_mouse_proc, null_mouse,
768                "epi", right_mouse_proc, right_epi_mouse,
769                "rast", right_mouse_proc, right_raster_mouse,
770                NULL,
771                NULL);
772 
773     tw_help_button("edge_geom_tool");
774     tw_newrow();
775     tw_choice("Image Select:",
776            image_choice_proc, 1, "mono image", "stereo images", NULL);
777 
778     tw_newrow();
779     tw_choice("2D Geom Fit:",
780     geom2_choice_proc, 3, "poly", "linear", "conic", "lin/con", NULL);
781 
782     tw_newrow();
783     tw_check("2D Options :", geom2_option_proc, 0, "join", NULL);
784 
785     tw_newrow();
786     tw_button("im rank", rank_proc, NULL);
787     tw_button("im rectify", stereo_rectify_proc, NULL);
788     tw_newrow();
789     tw_button("canny", canny_proc, NULL);
790     tw_button("edge rectify", rectify_edges_proc, NULL);
791     tw_button("edge derect", derectify_edges_proc, NULL);
792 
793     tw_newrow();
794     tw_button("geom2", geom2_proc, NULL);
795 
796     tw_newrow();
797     tw_button("Edge Params", edge_param_dialog, NULL);
798     tw_button("Rectify Params", stereo_param_dialog, NULL);
799     tw_button("Geom Params", geom_param_dialog, NULL);
800 
801     tw_end_tool();
802 }
803 

~ [ 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.