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

Linux Cross Reference
Tina5/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 Lesser 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 Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser 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  **********
 20  *
 21  * Program :    TINA
 22  * File    :  $Source: /home/tina/cvs/tina-libs/tina/vision/visMatch_cts.c,v $
 23  * Date    :  $Date: 2003/10/06 12:29:47 $
 24  * Version :  $Revision: 1.3 $
 25  * CVS Id  :  $Id: visMatch_cts.c,v 1.3 2003/10/06 12:29:47 neil Exp $
 26  *
 27  * Author  : Legacy TINA
 28  *
 29  * Notes :
 30  *
 31  *********
 32 */
 33 
 34 #include "visMatch_cts.h"
 35 
 36 #if HAVE_CONFIG_H
 37   #include <config.h>
 38 #endif
 39 
 40 #include <stdio.h>
 41 #include <math.h>
 42 #include <tina/sys/sysDef.h>
 43 #include <tina/sys/sysPro.h>
 44 #include <tina/math/mathDef.h>
 45 #include <tina/geometry/geomDef.h>
 46 #include <tina/geometry/geomPro.h>
 47 #include <tina/vision/vis_MatchPro.h>
 48 
 49 static FILE *fp = NULL;
 50 
 51 void    set_st_corner_matches(Imrect * er)
 52 {
 53     void   *data = NULL;
 54     Rindex *fx;
 55 
 56     if ((fx = prop_get(er->props, ER_TINDEX)) == NULL)
 57         return;
 58 
 59     fp = fopen("temp.dump", "w");
 60     apply_func_to_windex(fx, (void *(*) ())set_st_corner_match, data);
 61     (void) fclose(fp);
 62 }
 63 
 64 /* Starting from the current left hand edgel can we go back to any
 65  * previous stereo matching and check that the current stereo match is
 66  * consistent */
 67 /* ARGSUSED quieten lint */
 68 /* BUGFIX JB 22/11/93 was: void   *set_st_corner_match(Edgel * ledge,
 69  * void *data) */
 70 
 71 void    set_st_corner_match(Edgel * ledge, void *data /* unused */ )
 72 {
 73     List   *left_matches;
 74     Match  *best_left_match;
 75     Edgel  *redge;
 76     List   *back_matches_left;
 77     List   *back_matches_right;
 78     List   *for_matches_left;
 79     List   *for_matches_right;
 80     Match  *back_match_left;
 81     Match  *back_match_right;
 82     Edgel  *back_edge_left;
 83     Edgel  *back_edge_right;
 84     List   *sold_matches_left;
 85     Match  *sold_match_left;
 86     Edgel  *sold_edge_right;
 87 
 88     /* current stereo match is redge */
 89     if ((left_matches = (List *) prop_get(ledge->props, MLIST)) == NULL
 90         || (left_matches->type < GOOD_MATCH)
 91         || (best_left_match = (Match *) left_matches->to) == NULL
 92         || (redge = (Edgel *) best_left_match->to2) == NULL)
 93         return;
 94 
 95     if ((back_matches_left = (List *) prop_get(ledge->props, BACKTEMP)) == NULL
 96 
 97     /* if the temporal match type is already better than GOOD_MATCH
 98      * then the FORTEMP and BACKTEMP matches are already known to be
 99      * identical */
100         || (back_matches_left->type < GOOD_MATCH)
101         || (back_match_left = (Match *) back_matches_left->to) == NULL
102         || (back_edge_left = (Edgel *) back_match_left->to2) == NULL)
103         return;
104 
105     if ((back_matches_right = (List *) prop_get(redge->props, BACKTEMP)) == NULL
106 
107     /* if the temporal match type is already better than GOOD_MATCH
108      * then the FORTEMP and BACKTEMP matches are already known to be
109      * identical */
110         || (back_matches_right->type < GOOD_MATCH)
111       || (back_match_right = (Match *) back_matches_right->to) == NULL
112         || (back_edge_right = (Edgel *) back_match_right->to2) == NULL)
113         return;
114 
115     /* old stereo match is sold_edge_right */
116     if ((sold_matches_left = (List *) prop_get(back_edge_left->props, MLIST)) == NULL
117         || (sold_match_left = (Match *) sold_matches_left->to) == NULL)
118         return;
119     sold_edge_right = sold_match_left->to2;
120 
121     if (sold_edge_right == back_edge_right)
122     {
123         back_matches_left->type = FIXED_MATCH;
124         back_matches_right->type = FIXED_MATCH;
125         for_matches_left = (List *) prop_get(back_edge_left->props, FORTEMP);
126         for_matches_right = (List *) prop_get(back_edge_right->props, FORTEMP);
127         if (for_matches_left != NULL)
128             for_matches_left->type = FIXED_MATCH;
129         if (for_matches_right != NULL)
130             for_matches_right->type = FIXED_MATCH;
131         if (fp != NULL)
132             (void) fprintf(fp, "%3.2f %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f %3.2f\n",
133                  back_edge_left->pos.el[0], back_edge_left->pos.el[1],
134                back_edge_right->pos.el[0], back_edge_right->pos.el[1],
135                            ledge->pos.el[0], ledge->pos.el[1],
136                            redge->pos.el[0], redge->pos.el[1]);
137     }
138 }
139 
140 Match  *find_temporal_match(Match * match)
141 {
142     void   *get_fixed_match();
143     Edgel  *ledge;
144     Edgel  *foredge;
145     Match  *formatch;
146     int     data = FORTEMP;
147 
148     ledge = (Edgel *) match->to1;
149     if ((formatch = (Match *) get_fixed_match(ledge, &data)) != NULL)
150     {
151         foredge = (Edgel *) formatch->to1;
152         data = MLIST;
153         return ((Match *) get_fixed_match(foredge, &data));
154     } else
155         return (NULL);
156 }
157 

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