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

Linux Cross Reference
Tina5/tina-libs/tina/vision/visMatch_echoose.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_echoose.c,v $
 23  * Date    :  $Date: 2003/10/06 12:29:47 $
 24  * Version :  $Revision: 1.3 $
 25  * CVS Id  :  $Id: visMatch_echoose.c,v 1.3 2003/10/06 12:29:47 neil Exp $
 26  *
 27  * Author  : Legacy TINA
 28  *
 29  * Notes :
 30  * Generic stereo functions for choosing best matches.
 31  * 
 32  * They only change the type field in the support structure assiociated
 33  * with each match.
 34  * 
 35  * Functions that also delete alternative matches and select the chosen
 36  * one can be found in select.c 
 37  *
 38  *********
 39 */
 40 
 41 #include "visMatch_echoose.h"
 42 
 43 #if HAVE_CONFIG_H
 44   #include <config.h>
 45 #endif
 46 
 47 #include <math.h>
 48 #include <tina/sys/sysDef.h>
 49 #include <tina/sys/sysPro.h>
 50 #include <tina/math/mathDef.h>
 51 #include <tina/math/mathPro.h>
 52 #include <tina/geometry/geomDef.h>
 53 #include <tina/geometry/geomPro.h>
 54 #include <tina/vision/vis_MatchDef.h>
 55 #include <tina/vision/vis_MatchPro.h>
 56 
 57 /* Chose the best match of an epipolar edge string. Based upon the
 58  * matching strength field of the support structure. Sets the support
 59  * type of the best match to GOOD_MATCH. Sets the support type for
 60  * contradictory matches to BAD_MATCH. */
 61 static void choose_best_match(Tstring * es)
 62 {
 63     List   *list;
 64     List   *ptr;
 65     Support *bestsup = NULL;
 66     float   max_strength = (float) 0.0;
 67 
 68     if (es == NULL)
 69         return;
 70 
 71     list = (List *) prop_get(es->props, MLIST);
 72 
 73     for (ptr = list; ptr != NULL; ptr = ptr->next)
 74     {
 75         Match  *match = (Match *) ptr->to;
 76         Support *sup;
 77 
 78         sup = (Support *) prop_get(match->props, MATCH_SUPPORT);
 79 
 80         if (sup->type <= BAD_MATCH)
 81             continue;
 82 
 83         sup->type = BAD_MATCH;
 84         if (bestsup == NULL || sup->matching_strength > max_strength)
 85         {
 86             bestsup = sup;
 87             max_strength = sup->matching_strength;
 88         }
 89     }
 90     if (bestsup != NULL)
 91         bestsup->type = GOOD_MATCH;
 92 }
 93 
 94 /* Choose the best match for all the epipolar edge strings that
 95  * constitute the global edge string. */
 96 void    es_choose_best_matches(Tstring * es)
 97 {
 98     es_apply_to_sindex_strings(es, choose_best_match, NULL);
 99 }
100 
101 /* Choose all matches in the match list. Set the support type of each
102  * to GOOD_MATCH. Set the support type of contradictory matches to
103  * BAD_MATCH. */
104 void    choose_these_matches(List * mlist)
105 {
106     List   *clist;
107     List   *mptr;
108     List   *cptr;
109 
110     if (mlist == NULL)
111         return;
112 
113     for (mptr = mlist; mptr != NULL; mptr = mptr->next)
114     {
115         Match  *match;
116         Support *bestsup;
117         Tstring *es;
118 
119         match = (Match *) mptr->to;
120         es = (Tstring *) match->to1;
121         bestsup = (Support *) prop_get(match->props, MATCH_SUPPORT);
122         if (bestsup->type <= BAD_MATCH) /* already rejected */
123             continue;
124 
125         clist = (List *) prop_get(es->props, MLIST);
126 
127         for (cptr = clist; cptr != NULL; cptr = cptr->next)
128         {
129             Match  *match = (Match *) cptr->to;
130             Support *sup;
131 
132             sup = (Support *) prop_get(match->props, MATCH_SUPPORT);
133             sup->type = BAD_MATCH;
134         }
135         bestsup->type = GOOD_MATCH;
136     }
137 }
138 

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