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

Linux Cross Reference
Tina6/tina-libs/tina/vision/visMatch_cts.c

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

  1 /**********
  2  *
  3  * This file is part of the TINA Open Source Image Analysis Environment
  4  * henceforth known as TINA
  5  *
  6  * TINA is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Public License as
  8  * published by the Free Software Foundation.
  9  *
 10  * TINA is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  * GNU General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU General Public License
 16  * along with TINA; if not, write to the Free Software Foundation, Inc.,
 17  * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18  *
 19  * ANY users of TINA who require exemption from the existing licence must
 20  * negotiate a new licence with Dr. Neil.A.Thacker, the sole agent for
 21  * the University of Manchester.
 22  *
 23  **********
 24  *
 25  * Program :    TINA
 26  * File    :  $Source: /home/tina/cvs/tina-libs/tina/vision/visMatch_cts.c,v $
 27  * Date    :  $Date: 2003/10/06 12:29:47 $
 28  * Version :  $Revision: 1.3 $
 29  * CVS Id  :  $Id: visMatch_cts.c,v 1.3 2003/10/06 12:29:47 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  *
 35  *********
 36 */
 37 
 38 #include "visMatch_cts.h"
 39 
 40 #if HAVE_CONFIG_H
 41   #include <config.h>
 42 #endif
 43 
 44 #include <stdio.h>
 45 #include <math.h>
 46 #include <tina/sys/sysDef.h>
 47 #include <tina/sys/sysPro.h>
 48 #include <tina/math/mathDef.h>
 49 #include <tina/geometry/geomDef.h>
 50 #include <tina/geometry/geomPro.h>
 51 #include <tina/vision/vis_MatchPro.h>
 52 
 53 static FILE *fp = NULL;
 54 
 55 void    set_st_corner_matches(Imrect * er)
 56 {
 57     void   *data = NULL;
 58     Rindex *fx;
 59 
 60     if ((fx = prop_get(er->props, ER_TINDEX)) == NULL)
 61         return;
 62 
 63     fp = fopen("temp.dump", "w");
 64     apply_func_to_windex(fx, (void *(*) ())set_st_corner_match, data);
 65     (void) fclose(fp);
 66 }
 67 
 68 /* Starting from the current left hand edgel can we go back to any
 69  * previous stereo matching and check that the current stereo match is
 70  * consistent */
 71 /* ARGSUSED quieten lint */
 72 /* BUGFIX JB 22/11/93 was: void   *set_st_corner_match(Edgel * ledge,
 73  * void *data) */
 74 
 75 void    set_st_corner_match(Edgel * ledge, void *data /* unused */ )
 76 {
 77     List   *left_matches;
 78     Match  *best_left_match;
 79     Edgel  *redge;
 80     List   *back_matches_left;
 81     List   *back_matches_right;
 82     List   *for_matches_left;
 83     List   *for_matches_right;
 84     Match  *back_match_left;
 85     Match  *back_match_right;
 86     Edgel  *back_edge_left;
 87     Edgel  *back_edge_right;
 88     List   *sold_matches_left;
 89     Match  *sold_match_left;
 90     Edgel  *sold_edge_right;
 91 
 92     /* current stereo match is redge */
 93     if ((left_matches = (List *) prop_get(ledge->props, MLIST)) == NULL
 94         || (left_matches->type < GOOD_MATCH)
 95         || (best_left_match = (Match *) left_matches->to) == NULL
 96         || (redge = (Edgel *) best_left_match->to2) == NULL)
 97         return;
 98 
 99     if ((back_matches_left = (List *) prop_get(ledge->props, BACKTEMP)) == NULL
100 
101     /* if the temporal match type is already better than GOOD_MATCH
102      * then the FORTEMP and BACKTEMP matches are already known to be
103      * identical */
104         || (back_matches_left->type < GOOD_MATCH)
105         || (back_match_left = (Match *) back_matches_left->to) == NULL
106         || (back_edge_left = (Edgel *) back_match_left->to2) == NULL)
107         return;
108 
109     if ((back_matches_right = (List *) prop_get(redge->props, BACKTEMP)) == NULL
110 
111     /* if the temporal match type is already better than GOOD_MATCH
112      * then the FORTEMP and BACKTEMP matches are already known to be
113      * identical */
114         || (back_matches_right->type < GOOD_MATCH)
115       || (back_match_right = (Match *) back_matches_right->to) == NULL
116         || (back_edge_right = (Edgel *) back_match_right->to2) == NULL)
117         return;
118 
119     /* old stereo match is sold_edge_right */
120     if ((sold_matches_left = (List *) prop_get(back_edge_left->props, MLIST)) == NULL
121         || (sold_match_left = (Match *) sold_matches_left->to) == NULL)
122         return;
123     sold_edge_right = sold_match_left->to2;
124 
125     if (sold_edge_right == back_edge_right)
126     {
127         back_matches_left->type = FIXED_MATCH;
128         back_matches_right->type = FIXED_MATCH;
129         for_matches_left = (List *) prop_get(back_edge_left->props, FORTEMP);
130         for_matches_right = (List *) prop_get(back_edge_right->props, FORTEMP);
131         if (for_matches_left != NULL)
132             for_matches_left->type = FIXED_MATCH;
133         if (for_matches_right != NULL)
134             for_matches_right->type = FIXED_MATCH;
135         if (fp != NULL)
136             (void) fprintf(fp, "%3.2f %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f\n",
137                  back_edge_left->pos.el[0], back_edge_left->pos.el[1],
138                back_edge_right->pos.el[0], back_edge_right->pos.el[1],
139                            ledge->pos.el[0], ledge->pos.el[1],
140                            redge->pos.el[0], redge->pos.el[1]);
141     }
142 }
143 
144 Match  *find_temporal_match(Match * match)
145 {
146     void   *get_fixed_match();
147     Edgel  *ledge;
148     Edgel  *foredge;
149     Match  *formatch;
150     int     data = FORTEMP;
151 
152     ledge = (Edgel *) match->to1;
153     if ((formatch = (Match *) get_fixed_match(ledge, &data)) != NULL)
154     {
155         foredge = (Edgel *) formatch->to1;
156         data = MLIST;
157         return ((Match *) get_fixed_match(foredge, &data));
158     } else
159         return (NULL);
160 }
161 

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