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

Linux Cross Reference
Tina6/tina-libs/tina/vision/visModel_con.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/visModel_con.c,v $
 27  * Date    :  $Date: 2008/10/02 11:53:05 $
 28  * Version :  $Revision: 1.4 $
 29  * CVS Id  :  $Id: visModel_con.c,v 1.4 2008/10/02 11:53:05 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  *
 35  * matches consistent with match list clique 
 36  *
 37  *
 38  *********
 39 */
 40 
 41 #include "visModel_con.h"
 42 
 43 #if HAVE_CONFIG_H
 44   #include <config.h>
 45 #endif
 46 
 47 
 48 
 49 #include <math.h>
 50 #include <tina/sys/sysDef.h>
 51 #include <tina/sys/sysPro.h>
 52 #include <tina/math/mathDef.h>
 53 #include <tina/math/mathPro.h>
 54 #include <tina/geometry/geomDef.h>
 55 #include <tina/geometry/geomPro.h>
 56 #include <tina/vision/vis_ModelDef.h>
 57 #include <tina/vision/vis_ModelPro.h>
 58 
 59 
 60 Bool    smm_con_with_mlist(Match * match, List * list)
 61 {
 62     List   *ptr;
 63 
 64     for (ptr = list; ptr != NULL; ptr = ptr->next)
 65         if (smm_consistent_matches(match, (Match *) ptr->to) == false)
 66             return (false);
 67 
 68     return (true);
 69 }
 70 
 71 List   *smm_mats_con_with_mlist(List * model, List * scene, List * matches)
 72 {
 73     List   *new_matches = NULL;
 74     List   *m;
 75     List   *s;
 76     List   *ptr;
 77     Match   test = {Match_id};
 78 
 79     test.props = NULL;
 80 
 81     model = list_copy(model, (void *(*) ()) NULL, NULL);
 82     scene = list_copy(scene, (void *(*) ()) NULL, NULL);
 83 
 84 
 85     for (ptr = matches; ptr != NULL; ptr = ptr->next)
 86     {
 87         Match  *mat = (Match *) ptr->to;
 88 
 89         model = list_rm_ref(model, mat->to1, (void (*) ()) NULL);
 90         scene = list_rm_ref(scene, mat->to2, (void (*) ()) NULL);
 91     }
 92 
 93     for (m = model; m != NULL; m = m->next)
 94     {
 95         int     type;
 96 
 97         test.type = type = m->type;
 98         test.to1 = m->to;
 99         for (s = scene; s != NULL; s = s->next)
100         {
101             if (s->type != type || !smm_reasonable_match(m->to, s->to, type))
102                 continue;
103 
104             test.to2 = s->to;
105             if (smm_con_with_mlist(&test, matches) == false)
106                 continue;
107 
108             if (smm_con_with_mlist(&test, matches) == false)
109                 continue;
110 
111             test.weight = (float)smm_match_strength(&test);
112             test.label = new_label();
113             new_matches = ref_addtostart((List *) new_matches, (void *) match_copy(&test), MATCH);
114         }
115     }
116 
117         
118 
119     list_rm_links(model);
120     list_rm_links(scene);
121 
122     return (list_append(matches, new_matches));
123 }
124 
125 
126 /* same as above except adds proplist cliche information to each match */
127 
128 List   *smm_mats_con_with_mlist_2(List * model, List * scene, List * matches)
129 {
130     List   *new_matches = NULL;
131     List   *m;
132     List   *s;
133     List   *ptr, *cl_tag;
134     Match   test = {Match_id};
135     Match   *new_test=NULL;
136 
137     test.props = NULL;
138 
139     model = list_copy(model, (void *(*) ()) NULL, NULL);
140     scene = list_copy(scene, (void *(*) ()) NULL, NULL);
141 
142 cl_tag = prop_get( ((Match *)(matches->to))->props, 11111);
143 
144     for (ptr = matches; ptr != NULL; ptr = ptr->next)
145     {
146         Match  *mat = (Match *) ptr->to;
147 
148         model = list_rm_ref(model, mat->to1, (void (*) ()) NULL);
149         scene = list_rm_ref(scene, mat->to2, (void (*) ()) NULL);
150     }
151 
152     for (m = model; m != NULL; m = m->next)
153     {
154         int     type;
155 
156         test.type = type = m->type;
157         test.to1 = m->to;
158         test.props = NULL;
159         for (s = scene; s != NULL; s = s->next)
160         {
161             if (s->type != type || !smm_reasonable_match(m->to, s->to, type))
162                 continue;
163 
164             test.to2 = s->to;
165             if (smm_con_with_mlist(&test, matches) == false)
166                 continue;
167 
168             if (smm_con_with_mlist(&test, matches) == false)
169                 continue;
170 
171             test.weight = (float)smm_match_strength(&test);
172             test.label = new_label();
173             new_test = match_copy(&test);
174             new_matches = ref_addtostart((List *) new_matches, new_test, MATCH);
175             new_test->props = proplist_addifnp( new_test->props, cl_tag, 11111, NULL, false );
176         }
177     }
178 
179         
180 
181     list_rm_links(model);
182     list_rm_links(scene);
183 
184     return (list_append(matches, new_matches));
185 }
186 
187 

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