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

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

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