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

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

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