1 /**********
2 *
3 * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
4 * University of Manchester, UK. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 *
9 * . Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * . Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * . Neither the name of the University of Manchester nor the names of its
17 * contributors may be used to endorse or promote products derived from this
18 * software without specific prior written permission.
19 *
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 **********
34 *
35 * Program : TINA
36 * File : $Source: /home/tina/cvs/tina-tools/tinatool/tlvision/tlvisCnr_tool.c,v $
37 * Date : $Date: 2009/03/27 16:01:50 $
38 * Version : $Revision: 1.4 $
39 * CVS Id : $Id: tlvisCnr_tool.c,v 1.4 2009/03/27 16:01:50 paul Exp $
40 *
41 * Notes :
42 *
43 *
44 *
45 *********
46 */
47
48 #include "tlvisCnr_tool.h"
49
50 #if HAVE_CONFIG_H
51 #include <config.h>
52 #endif
53
54 #include <stdio.h>
55 #include <float.h>
56 #include <limits.h>
57
58 #include <tina/sys/sysDef.h>
59 #include <tina/sys/sysPro.h>
60 #include <tina/math/mathDef.h>
61 #include <tina/math/mathPro.h>
62 #include <tina/geometry/geomDef.h>
63 #include <tina/geometry/geomPro.h>
64 #include <tina/image/imgDef.h>
65 #include <tina/image/imgPro.h>
66 #include <tina/file/fileDef.h>
67 #include <tina/file/filePro.h>
68 #include <tina/vision/visDef.h>
69 #include <tina/vision/visPro.h>
70
71 #include <tinatool/wdgts/wdgtsDef.h>
72 #include <tinatool/wdgts/wdgtsPro.h>
73 #include <tinatool/draw/drawDef.h>
74 #include <tinatool/draw/drawPro.h>
75 #include <tinatool/tlbase/tlbasePro.h>
76 #include <tinatool/tlvision/tlvisCnr_pick.h>
77 #include <tinatool/tlvision/tlvisEdge_pick.h>
78 #include <tinatool/tlvision/tlvisEdge_geom_pick.h>
79 #include <tinatool/tlvision/tlvisEdge_epi_mouse.h>
80
81
82 static double sigma = 1.0, precision = 0.01, thres = 6.0;
83 static double lowd = -0.5, upd = 0.5, width = 3.0;
84 static double disp = 0;
85 static double uniqueness = 0.004, correlate = 0.985, asymetry = 0.85;
86 static double tuniqueness = 0.001, tcorrelate = 0.980, tasymetry = 0.85;
87 static double theight = 20.0, twidth = 60.0;
88 static double patch_sigma = 3.0;
89 static int stereo_images = 1;
90 static int fixed_matches = 0;
91 static int good_matches = 0;
92
93 static Imrect *mono_im1 = NULL, *mono_im2 = NULL;
94
95 static void add_patch(Edgel * edge, int type, void *im)
96 {
97 Matrix *patch;
98
99 /* patches are 5*5 , so i (sam) have chosen a default sigma of 3.0 */
100 patch = add_patch_to_props(edge, im, patch_sigma);
101 }
102
103 static void mono_show_stored_corners(void)
104 {
105 Tv *tv = mono_tv_get();
106 int j, i;
107 Imrect *sc = stored_mono_corners();
108 Imregion *region;
109
110 if (!sc)
111 return;
112 region = sc->region;
113
114 tv_set_color(tv, red);
115 for (j = region->ly; j < region->uy; j++)
116 {
117 for (i = region->lx; i < region->ux; i++)
118 {
119 Ipos op;
120 Edgel *ej;
121
122 ej = IM_PTR(sc, j, i);
123 if (!ej)
124 continue;
125
126 op = tv_proj2(tv, vec2((double) i, (double) j));
127 tv_point(tv, op);
128 }
129 }
130
131 }
132
133 static void flip_mono_im(void)
134 {
135 Imrect *temp_ptr;
136 Tv *tv = mono_tv();
137 Imrect *new_mono;
138
139 temp_ptr = mono_im2;
140 mono_im2 = mono_im1;
141 mono_im1 = temp_ptr;
142 new_mono = im_copy(mono_im1);
143 mono_image_set(new_mono);
144
145 /*
146 temp_ptr = mono_corners_get();
147 mono_corners_set( stored_mono_corners() );
148 mono_corners_store( temp_ptr );
149 */
150 mono_corners_on(true);
151 mono_init(tv);
152 mono_show_stored_corners();
153 tv_flush(tv);
154
155 }
156
157 static void mono_corner_proc()
158 {
159 Tv *tv;
160 Imrect *im;
161
162 tv = mono_tv();
163 im = mono_image();
164
165 im_free(mono_im2);
166 mono_im2 = mono_im1;
167 mono_im1 = im_copy(im);
168
169 if (tv != NULL) /* get roi from tv */
170 im = im_subim(im, tv_get_im_roi(tv));
171 er_free(stored_mono_corners());
172 mono_corners_store(mono_corners_get());
173 mono_corners_null();
174 mono_corners_set(corner(im, sigma, precision, thres));
175
176 /*
177 * make a patch list and attach to the corner image - this will be
178 * used by the temporal matcher util
179 */
180 tv_edges_conn(tv, mono_corners_get());
181 er_apply_to_all_edges(mono_corners_get(), add_patch,
182 (void *) mono_image());
183 mono_show_stored_corners();
184 tv_flush(tv);
185 }
186
187 void stereo_corner_proc(Imrect * left_im, Imrect * right_im)
188 {
189 Tv *tv;
190 Imrect *im;
191 Imrect *er;
192 Vec2 ul, lr;
193 Imregion *roi;
194
195 if (left_im == NULL || right_im == NULL)
196 return;
197
198 tv = left_tv();
199 er_free(stored_left_corners());
200 left_corners_store(left_corners_get());
201 left_corners_null();
202 left_corners_set(corner(left_im, sigma, precision, thres));
203 if ((er = left_corners_get()) != NULL)
204 {
205 if ((roi = er->region) != NULL)
206 {
207 lr.el[0] = roi->lx;
208 lr.el[1] = roi->ly;
209 ul.el[0] = roi->ux;
210 ul.el[1] = roi->uy;
211 tv_edges_conn(tv, left_corners_get());
212 tv_set_overlay(tv);
213 tv_rect2(tv, ul, lr);
214 tv_reset_draw(tv);
215 tv_flush(tv);
216 }
217 }
218 tv = right_tv();
219 er_free(stored_right_corners());
220 right_corners_store(right_corners_get());
221 right_corners_null();
222 right_corners_set(corner(right_im, sigma, precision, thres));
223 if ((er = right_corners_get()) != NULL)
224 {
225 if ((roi = er->region) != NULL)
226 {
227 lr.el[0] = roi->lx;
228 lr.el[1] = roi->ly;
229 ul.el[0] = roi->ux;
230 ul.el[1] = roi->uy;
231 tv_edges_conn(tv, right_corners_get());
232 tv_set_overlay(tv);
233 tv_rect2(tv, ul, lr);
234 tv_reset_draw(tv);
235 tv_flush(tv);
236 }
237 }
238 disp = 0;
239 }
240
241
242 static void corner_proc()
243 {
244 Tv *tvl, *tvr;
245 Imrect *left_im, *right_im;
246 Imregion *leftroi, *rightroi;
247
248 if (stereo_images)
249 {
250 tvl = left_tv();
251 left_im = left_image();
252 if (tvl != NULL)
253 { /* get roi from tv */
254 leftroi = tv_get_im_roi(tvl);
255 left_im = im_subim(left_im, leftroi);
256 rfree(leftroi);
257 } else if (left_im)
258 left_im = im_copy(left_im);
259
260 tvr = right_tv();
261 right_im = right_image();
262 if (tvr != NULL)
263 { /* get roi from tv */
264 rightroi = tv_get_im_roi(tvr);
265 right_im = im_subim(right_im, rightroi);
266 rfree(rightroi);
267 } else if (right_im)
268 right_im = im_copy(right_im);
269
270 stereo_corner_proc(left_im, right_im);
271 if (left_im != NULL)
272 im_free(left_im);
273 if (right_im != NULL)
274 im_free(right_im);
275 } else
276 {
277 mono_corner_proc();
278 }
279 }
280
281 void rectify_corners_proc()
282 {
283 Imrect *left_er, *right_er;
284 Camera *lcam, *rcam;
285 Parcam *pcam;
286 Vec2 cleft, cright;
287 Imregion *lregion, *rregion;
288 float lcx, lcy, rcx, rcy;
289
290 if (!stereo_images)
291 {
292 error("edge tool: not in stereo mode", non_fatal);
293 return;
294 }
295 left_er = left_corners_get();
296 right_er = right_corners_get();
297 lcam = left_camera();
298 rcam = right_camera();
299
300 if (left_er == NULL || right_er == NULL)
301 {
302 error("no corners", non_fatal);
303 return;
304 }
305 lregion = left_er->region;
306 rregion = right_er->region;
307 lcx = (lregion->lx + lregion->ux) / 2.0;
308 rcx = (rregion->lx + rregion->ux) / 2.0;
309 lcy = (lregion->ly + lregion->uy) / 2.0;
310 rcy = (rregion->ly + rregion->uy) / 2.0;
311 cleft = vec2(lcx, lcy);
312 cright = vec2(rcx, rcy);
313
314 pcam = pcam_get();
315 if (pcam == NULL)
316 {
317 disp = vec2_x(cright) - vec2_x(cleft);
318 error("no camera data", non_fatal);
319 } else
320 {
321 er_apply_to_all_edges(left_er, edge_save_pos_prop, (void *) IMPOS);
322 er_apply_to_all_edges(right_er, edge_save_pos_prop, (void *) IMPOS);
323 er_correct(left_er, lcam);
324 er_correct(right_er, rcam);
325 er_add_rectpos_prop(left_er, pcam->rect1);
326 er_add_rectpos_prop(right_er, pcam->rect2);
327 er_apply_to_all_edges(left_er, edge_get_pos_prop, (void *) IMPOS);
328 er_apply_to_all_edges(right_er, edge_get_pos_prop, (void *) IMPOS);
329 cleft = cam_correct(cleft, lcam);
330 cright = cam_correct(cright, rcam);
331 cleft = rectify_pos(pcam->rect1, cleft);
332 cright = rectify_pos(pcam->rect2, cright);
333 disp = vec2_x(cright) - vec2_x(cleft);
334 er_set_findex(left_er, ER_FINDEX, rectpos);
335 er_set_findex(right_er, ER_FINDEX, rectpos);
336 }
337 }
338
339 static void display_stereo_match(Edgel * ledge, int type, void *data, int i, int j)
340 {
341 Edgel *redge;
342 List *left_matches;
343 List *right_matches;
344 Match *best_left_match;
345 Match *best_right_match;
346 Tv *tvl = left_tv(), *tvr = right_tv();
347
348 if ((left_matches = (List *) prop_get(ledge->props, MLIST)) == NULL)
349 return;
350 if ((best_left_match = (Match *) left_matches->to) == NULL)
351 return;
352
353 if ((redge = (Edgel *) best_left_match->to2) == NULL)
354 return;
355
356 if ((right_matches = (List *) prop_get(redge->props, MLIST)) == NULL)
357 return;
358 if ((best_right_match = (Match *) right_matches->to) == NULL)
359 return;
360
361 if (left_matches->type == FIXED_MATCH)
362 {
363 fixed_matches++;
364 tv_save_draw(tvl);
365 tv_save_draw(tvr);
366 tv_set_color(tvl, yellow);
367 tv_set_color(tvr, yellow);
368 tv_cross2(tvl, ((Edgel *) (best_left_match->to1))->pos, 5);
369 tv_cross2(tvr, ((Edgel *) (best_left_match->to2))->pos, 5);
370 tv_reset_draw(tvl);
371 tv_reset_draw(tvr);
372 if (data != NULL)
373 print_cnrmatch(best_left_match);
374 }
375 if (left_matches->type == GOOD_MATCH)
376 {
377 good_matches++;
378 }
379 }
380
381 void stereo_corner_disp_proc()
382 {
383
384 er_apply_to_all_edges(left_corners_get(), display_stereo_match, (void *) print_cnrmatch);
385 }
386
387 void stereo_corner_match_proc()
388 {
389 void *data = NULL;
390
391 if (!stereo_images)
392 {
393 error("edge tool: not in stereo mode", non_fatal);
394 return;
395 }
396 stereo_corner_match(left_image(), right_image(),
397 left_corners_get(), right_corners_get(),
398 disp, lowd, upd, width, correlate, uniqueness, asymetry);
399 fixed_matches = 0.0;
400 good_matches = 0.0;
401 er_apply_to_all_edges(left_corners_get(), display_stereo_match, data);
402 format("fixed matches found %d good matches found %d \n", fixed_matches, good_matches);
403 }
404
405 /*
406 void sem_corner_match_proc()
407 {
408 Imrect *left_er, *right_er;
409 void semcnr_match();
410 Vec2 cleft, cright;
411 Imregion *lregion, *rregion;
412 float lcx, lcy, rcx, rcy;
413
414
415 left_er = left_corners_get();
416 right_er = right_corners_get();
417 lregion = left_er->region;
418 rregion = right_er->region;
419 lcx = (lregion->lx + lregion->ux) / 2.0;
420 rcx = (rregion->lx + rregion->ux) / 2.0;
421 lcy = (lregion->ly + lregion->uy) / 2.0;
422 rcy = (rregion->ly + rregion->uy) / 2.0;
423 cleft = vec2(lcx, lcy);
424 cright = vec2(rcx, rcy);
425
426 semcnr_match(left_er,right_er,cleft,cright);
427 }
428 */
429
430 void temporal_corner_match_proc()
431 {
432 Imrect *mono_im, *old_mono_im;
433 Imrect *mono_er;
434 Imrect *old_mono_er;
435
436 mono_er = mono_corners_get();
437 old_mono_er = stored_mono_corners();
438 if (mono_er == NULL || old_mono_er == NULL)
439 return;
440 temporal_corner_match(mono_er, old_mono_er, 0.0, 0.0,
441 theight, twidth, tcorrelate,
442 tuniqueness, tasymetry);
443
444 }
445
446
447 void stereo_temporal_corner_match(double xdispl, double ydispl, double xdispr, double ydispr)
448 {
449 Imrect *left_er;
450 Imrect *old_left_er;
451 Imrect *right_er;
452 Imrect *old_right_er;
453
454 if (!stereo_images)
455 {
456 error("edge tool: not in stereo mode", non_fatal);
457 return;
458 }
459 left_er = left_corners_get();
460 old_left_er = stored_left_corners();
461 if (left_er == old_left_er)
462 return;
463
464 temporal_corner_match(left_er, old_left_er, xdispl, ydispl, theight, twidth, tcorrelate, tuniqueness, tasymetry);
465
466 right_er = right_corners_get();
467 old_right_er = stored_right_corners();
468 if (right_er == old_right_er)
469 return;
470
471 temporal_corner_match(right_er, old_right_er, xdispr, ydispr, theight, twidth, tcorrelate, tuniqueness, tasymetry);
472 set_st_corner_matches(left_er);
473
474 }
475
476
477 void stereo_temporal_corner_match_proc()
478 {
479 Imrect *left_er;
480 Imrect *old_left_er;
481 Imrect *right_er;
482 Imrect *old_right_er;
483 Imregion *region, *old_region;
484 double cx, cy, old_cx, old_cy, xdispl, ydispl, xdispr, ydispr;
485
486 if (!stereo_images)
487 {
488 error("corner tool: matching temporal mono images", non_fatal);
489 return;
490 }
491 left_er = left_corners_get();
492 old_left_er = stored_left_corners();
493 if (left_er == NULL || old_left_er == NULL)
494 return;
495 region = left_er->region;
496 old_region = old_left_er->region;
497 cx = (region->lx + region->ux) / 2.0;
498 old_cx = (old_region->lx + old_region->ux) / 2.0;
499 cy = (region->ly + region->uy) / 2.0;
500 old_cy = (old_region->ly + old_region->uy) / 2.0;
501 xdispl = cx - old_cx;
502 ydispl = cy - old_cy;
503
504 right_er = right_corners_get();
505 old_right_er = stored_right_corners();
506 if (right_er == NULL || old_right_er == NULL)
507 return;
508 region = right_er->region;
509 old_region = old_right_er->region;
510 cx = (region->lx + region->ux) / 2.0;
511 old_cx = (old_region->lx + old_region->ux) / 2.0;
512 cy = (region->ly + region->uy) / 2.0;
513 old_cy = (old_region->ly + old_region->uy) / 2.0;
514 xdispr = cx - old_cx;
515 ydispr = cy - old_cy;
516 stereo_temporal_corner_match(xdispl, ydispl, xdispr, ydispr);
517
518 }
519
520
521 static void geom_init()
522 {
523 threed_geom_set(NULL);
524 }
525
526
527 static void geom_proc()
528 {
529 Parcam *pcam = pcam_get();
530 Transform3 trans;
531 List *cor_geom = NULL;
532 Tv *tv = threed_tv();
533
534 /*
535 * remove any previous 3D data (must be done here if we are to be
536 * able to recompute geometry without re-matching) NAT 16/5/96
537 */
538 er_apply_to_all_edges(left_corners_get(), corner_rem_proj_3d, NULL);
539 er_apply_to_all_edges(left_corners_get(), corner_par_proj_3d, NULL);
540 er_apply_to_all_edges(left_corners_get(), geom_list_point3, &cor_geom);
541 /*
542 * transform to base coordinates for head combination */
543 /*
544 trans = trans3_inverse(*(pcam->rcam1->transf));
545 reclist_list_apply(cor_geom, geom_transform, NULL, &trans);
546 */
547
548 cor_geom = list_append(cor_geom, threed_list_get());
549 threed_geom_null();
550 threed_geom_set(cor_geom);
551 }
552
553 void corner_par_proj_3d(Edgel * corner, int type, void *data,
554 int i, int j)
555 /* add 3d coordinates in rectified frame to corner proplist */
556 {
557 Match *cor_match;
558 Edgel *left_cor, *right_cor;
559 Vec2 *left_rect, *right_rect;
560 Vec3 disp, *pos;
561 int matchlist = MLIST;
562
563 if (corner == NULL)
564 return;
565 if (cor_match = (Match *) get_fixed_match(corner, &matchlist))
566 {
567 left_cor = cor_match->to1;
568 right_cor = cor_match->to2;
569 left_rect = (Vec2 *) prop_get(left_cor->props, RECTPOS);
570 right_rect = (Vec2 *) prop_get(right_cor->props, RECTPOS);
571 if (left_rect && right_rect)
572 {
573 disp.el[0] = left_rect->el[0];
574 disp.el[1] = (left_rect->el[1] + right_rect->el[1]) / 2.0;
575 disp.el[2] = right_rect->el[0] - left_rect->el[0];
576 pos = vec3_alloc();
577 *pos = vec3_par_proj_3d(disp);
578
579 corner->props = proplist_addifnp(corner->props, (void *) pos, POINT3, vec3_free, true);
580 }
581 }
582 }
583
584 void corner_rem_proj_3d(Edgel * corner, int type, void *data,
585 int i, int j)
586 /* remove 3d coordinates from corner proplist */
587 {
588 if (corner == NULL)
589 return;
590 corner->props = proplist_free(corner->props, POINT3);
591 }
592
593
594 void geom_list_point3(Edgel * corner, int type,
595 List ** geomlist,
596 int i,
597 int j)
598 {
599 Vec3 *pos;
600 Point3 *point;
601 double point3_get_z();
602 int k;
603
604 if (corner && (pos = prop_get(corner->props, POINT3)))
605 {
606 point = point3_alloc(POINT3);
607 point->p = *pos;
608 *geomlist = list_add_sorted(*geomlist, link_alloc(point, POINT3), point3_get_z);
609 }
610 }
611
612 double point3_get_z(Point3 * point)
613 {
614 if (point)
615 return (point->p.el[2]);
616 else
617 return (DBL_MAX);
618 }
619
620 static void clear_proc()
621 {
622 if (mono_image())
623 {
624 mono_image_set(NULL);
625 }
626 if (left_image())
627 {
628 left_image_set(NULL);
629 }
630 if (right_image())
631 {
632 right_image_set(NULL);
633 }
634 if (mono_corners_get())
635 {
636 mono_corners_set(NULL);
637 }
638 if (left_corners_get())
639 {
640 left_corners_set(NULL);
641 }
642 if (right_corners_get())
643 {
644 right_corners_set(NULL);
645 }
646 if (stored_mono_corners())
647 {
648 er_free(stored_mono_corners());
649 mono_corners_store(NULL);
650 }
651 if (stored_left_corners())
652 {
653 er_free(stored_left_corners());
654 left_corners_store(NULL);
655 }
656 if (stored_right_corners())
657 {
658 er_free(stored_right_corners());
659 right_corners_store(NULL);
660 }
661 }
662
663 /**** Image choice callback ****/
664
665 static void image_choice_proc(value)
666 int value;
667 {
668 switch (value)
669 {
670 case 0:
671 stereo_images = 1;
672 break;
673 case 1:
674 stereo_images = 0;
675 break;
676 }
677 }
678
679 /** Pick function callbacks **/
680
681 static void mono_pick_proc(Tv_pick(*func) ())
682 {
683 tv_set_pick(mono_tv(), (*func) ());
684 tv_set_activity(mono_tv(), PICK);
685 }
686
687 static void left_pick_proc(Tv_pick(*func) ())
688 {
689 tv_set_pick(left_tv(), (*func) ());
690 tv_set_activity(left_tv(), PICK);
691 }
692
693 static void right_pick_proc(Tv_pick(*func) ())
694 {
695 tv_set_pick(right_tv(), (*func) ());
696 tv_set_activity(right_tv(), PICK);
697 }
698
699 static void threed_pick_proc(Tv_pick(*func) ())
700 {
701 tv_set_pick(threed_tv(), (*func) ());
702 tv_set_activity(threed_tv(), PICK);
703 }
704
705 /** Mouse function callbacks **/
706
707 static void mono_mouse_proc(Tv_mouse(*func) ())
708 {
709 tv_set_mouse(mono_tv(), (*func) ());
710 tv_set_activity(mono_tv(), MOUSE);
711 }
712
713 static void left_mouse_proc(Tv_mouse(*func) ())
714 {
715 tv_set_mouse(left_tv(), (*func) ());
716 tv_set_activity(left_tv(), MOUSE);
717 }
718
719 static void right_mouse_proc(Tv_mouse(*func) ())
720 {
721 tv_set_mouse(right_tv(), (*func) ());
722 tv_set_activity(right_tv(), MOUSE);
723 }
724
725 static void threed_mouse_proc(Tv_mouse(*func) ())
726 {
727 tv_set_mouse(threed_tv(), (*func) ());
728 tv_set_activity(threed_tv(), MOUSE);
729 }
730
731 /*** Paramter dialog callbacks ***/
732
733 static void corner_param_dialog()
734 {
735 static void *dialog = NULL;
736
737 if (dialog)
738 {
739 tw_show_dialog(dialog);
740 return;
741 }
742 dialog = tw_dialog("Corner Parameters");
743
744 tw_fglobal("Sigma :", &sigma, 20);
745 tw_newrow();
746 tw_fglobal("Precision :", &precision, 20);
747 tw_newrow();
748 tw_fglobal("Threshold :", &thres, 20);
749 tw_newrow();
750 tw_fglobal("Patch sigma :", &patch_sigma, 20);
751
752 tw_end_dialog();
753 }
754
755 static void stereo_param_dialog()
756 {
757 static void *dialog = NULL;
758
759 if (dialog)
760 {
761 tw_show_dialog(dialog);
762 return;
763 }
764 dialog = tw_dialog("Stereo Parameters");
765
766 tw_fglobal("Low disp :", &lowd, 20);
767 tw_newrow();
768 tw_fglobal("Upper disp :", &upd, 20);
769 tw_newrow();
770 tw_fglobal("Band width :", &width, 20);
771 tw_newrow();
772 tw_fglobal("Corr thres :", &correlate, 20);
773 tw_newrow();
774 tw_fglobal("Uniqueness :", &uniqueness, 20);
775 tw_newrow();
776 tw_fglobal("Asymetry :", &asymetry, 20);
777
778 tw_end_dialog();
779 }
780
781 static void temp_param_dialog()
782 {
783 static void *dialog = NULL;
784
785 if (dialog)
786 {
787 tw_show_dialog(dialog);
788 return;
789 }
790 dialog = tw_dialog("Temporal Parameters");
791
792 tw_fglobal("Height :", &theight, 20);
793 tw_newrow();
794 tw_fglobal("Width :", &twidth, 20);
795 tw_newrow();
796 tw_fglobal("Correlate :", &tcorrelate, 20);
797 tw_newrow();
798 tw_fglobal("Uniqueness :", &tuniqueness, 20);
799 tw_newrow();
800 tw_fglobal("Asymetry :", &tasymetry, 20);
801
802 tw_end_dialog();
803 }
804
805 /********** Tool creation **********/
806
807 void corner_tool(int x, int y)
808 {
809 static void *tool = NULL;
810
811 if (tool)
812 {
813 tw_show_tool(tool);
814 return;
815 }
816 tool = tw_tool("Corner Tool", x, y);
817
818 tw_menubar("Pick: ",
819 "Mono",
820 "null", mono_pick_proc, null_pick,
821 "corner", mono_pick_proc, mono_print,
822 "c match", mono_pick_proc, mono_corner_matches,
823 NULL,
824 "Left",
825 "manual", left_pick_proc, left_manual_cor,
826 "corner", left_pick_proc, left_print_cor,
827 "c match", left_pick_proc, left_corner_matches,
828 NULL,
829 "Right",
830 "manual", right_pick_proc, right_manual_cor,
831 "corner", right_pick_proc, right_print_cor,
832 "c match", right_pick_proc, right_corner_matches,
833 NULL,
834 "Threed",
835 "null", threed_pick_proc, null_pick,
836 "print", threed_pick_proc, threed_print,
837 "choose", threed_pick_proc, threed_choose,
838 "delete", threed_pick_proc, threed_delete,
839 NULL,
840 NULL);
841
842 tw_newrow();
843 tw_menubar("Mouse:",
844 "Mono",
845 "null", mono_mouse_proc, null_mouse,
846 NULL,
847 "Left",
848 "null", left_mouse_proc, null_mouse,
849 "epi", left_mouse_proc, left_epi_mouse,
850 "rast", left_mouse_proc, left_raster_mouse,
851 NULL,
852 "Right",
853 "null", right_mouse_proc, null_mouse,
854 "epi", right_mouse_proc, right_epi_mouse,
855 "rast", right_mouse_proc, right_raster_mouse,
856 NULL,
857 "Threed",
858 "null", threed_mouse_proc, null_mouse,
859 NULL,
860 NULL);
861
862 tw_newrow();
863 tw_choice("Image Select:",
864 image_choice_proc, 0, "stereo images", "mono image", NULL);
865
866 tw_button("clear", clear_proc, NULL);
867 tw_newrow();
868 tw_button("corner", corner_proc, NULL);
869 tw_button("rectify", rectify_corners_proc, NULL);
870 tw_button("stereo", stereo_corner_match_proc, NULL);
871 tw_button("temporal", stereo_temporal_corner_match_proc, NULL);
872 tw_button("init geom3", geom_init, NULL);
873 tw_button("geom3", geom_proc, NULL);
874
875 tw_newrow();
876 tw_button("Corner Params", corner_param_dialog, NULL);
877 tw_button("Stereo Params", stereo_param_dialog, NULL);
878 tw_button("Temporal Params", temp_param_dialog, NULL);
879
880 tw_newrow();
881 tw_button("show stored cnrs", mono_show_stored_corners, NULL);
882 tw_button("show stereo cnrs", stereo_corner_disp_proc, NULL);
883 tw_button("flip mono", flip_mono_im, NULL);
884 tw_help_button("corner_tool");
885 tw_end_tool();
886 }
887
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.