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

Linux Cross Reference
Tina6/tina-libs/tina/vision/visMatch_ewta.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_ewta.c,v $
 27  * Date    :  $Date: 2003/10/06 12:29:48 $
 28  * Version :  $Revision: 1.3 $
 29  * CVS Id  :  $Id: visMatch_ewta.c,v 1.3 2003/10/06 12:29:48 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  * 
 35  * Generic stereo functions for performing winner take all choices.
 36  * 
 37  * Includes WTA schemes for implementing either uniqueness or ordering. 
 38  *
 39  *********
 40 */
 41 
 42 #include "visMatch_ewta.h"
 43 
 44 #if HAVE_CONFIG_H
 45   #include <config.h>
 46 #endif
 47 
 48 #include <math.h>
 49 #include <tina/sys/sysDef.h>
 50 #include <tina/sys/sysPro.h>
 51 #include <tina/math/mathDef.h>
 52 #include <tina/math/mathPro.h>
 53 #include <tina/geometry/geomDef.h>
 54 #include <tina/geometry/geomPro.h>
 55 #include <tina/vision/vis_MatchDef.h>
 56 #include <tina/vision/vis_MatchPro.h>
 57 
 58 /* Test if 2 matches are unique wrt uniquely labeled regular
 59  * sub-strings. */
 60 /* ARGSUSED quieten lint */
 61 Bool    matches_not_unique(Match * m1, int type, Match * m2)
 62 
 63 /* unused */
 64 
 65 {
 66     int     s1_id, s2_id;
 67 
 68     if (m1->to1 == m2->to1 || m1->to2 == m2->to2)
 69         return (true);
 70 
 71     /*s1_id = (int) prop_get(((Tstring *) m1->to1)->props, STRING);*/
 72     s1_id = (long int) prop_get(((Tstring *) m1->to1)->props, STRING); /*JD, 2015.01.27*/
 73     /*s2_id = (int) prop_get(((Tstring *) m2->to1)->props, STRING);*/
 74     s2_id = (long int) prop_get(((Tstring *) m2->to1)->props, STRING); /*JD, 2015.01.27*/
 75 
 76     if (s1_id == s2_id)
 77         return (true);
 78 
 79     /*s1_id = (int) prop_get(((Tstring *) m1->to2)->props, STRING);*/
 80     s1_id = (long int) prop_get(((Tstring *) m1->to2)->props, STRING); /*JD, 2015.01.27*/
 81     /*s2_id = (int) prop_get(((Tstring *) m2->to2)->props, STRING);*/
 82     s2_id = (long int) prop_get(((Tstring *) m2->to2)->props, STRING); /*JD, 2015.01.27*/
 83 
 84     if (s1_id == s2_id)
 85         return (true);
 86 
 87     return (false);
 88 }
 89 
 90 /* Test if 2 matches preserve order along the x direction. */
 91 /* ARGSUSED quieten lint */
 92 Bool    matches_not_ordered(Match * m1, int type, Match * m2)
 93 
 94 /* unused */
 95 
 96 {
 97     double  x11, x12, x21, x22;
 98     Vec2    v = {Vec2_id};
 99 
100     v = str2_centroid((Tstring *) m1->to1);
101     x11 = vec2_x(v);
102     v = str2_centroid((Tstring *) m1->to2);
103     x12 = vec2_x(v);
104     v = str2_centroid((Tstring *) m2->to1);
105     x21 = vec2_x(v);
106     v = str2_centroid((Tstring *) m2->to2);
107     x22 = vec2_x(v);
108 
109     if ((x11 < x12) != (x21 < x22))
110         return (true);
111 
112     return (false);
113 }
114 
115 /* Apply WTA scheme to matches associated with a single raster.
116  * 
117  * WTA allows strongest matches to be chosen and competitors to be
118  * eliminated.
119  * 
120  * Scheme implemeted here does not properly allow for the fact that the
121  * same sub-string can be indexed on different rows. */
122 void    choose_wta(List * left, double (*cost_func) ( /* ??? */ ), Bool(*compat_func) ( /* ??? */ ))
123 /* epipolar edge list */
124 
125 
126 
127 {
128     List   *mlist = NULL;
129     List   *ptr;
130     List   *next;
131     List   *choose = NULL;
132 
133     list_apply_func(left, es_add_to_mlist, (void *) &mlist);
134     mlist = list_reverse(sort_list(mlist, cost_func, NULL));
135     mlist_set_supp_type(mlist, BAD_MATCH);
136 
137     for (ptr = mlist; ptr != NULL; ptr = next)
138     {
139         Match  *m = (Match *) ptr->to;
140 
141         next = ptr->next;
142         choose = link_addtostart((List *) choose, ptr);
143         next = list_rm_links_on_func(next, compat_func, (void *) m);
144     }
145     mlist_set_supp_type(choose, GOOD_MATCH);
146     list_rm_links(mlist);
147 }
148 
149 /* Apply wta scheme to all the rasters in the edgerect. */
150 void    choose_wta_matches(Imrect * er, double (*cost_func) ( /* ??? */ ), Bool(*compat_func) ( /* ??? */ ))
151 /* left edgerect */
152 
153 
154 
155 {
156     Rindex *sx;
157     int     ly, uy, i;
158 
159     if (er == NULL || (sx = (Rindex *) prop_get(er->props, SINDEX)) == NULL)
160         return;
161 
162     ly = sx->region->ly;
163     uy = sx->region->uy;
164 
165     for (i = ly; i < uy; ++i)
166         choose_wta((List *) sx->index[i], cost_func, compat_func);
167 }
168 

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