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

Linux Cross Reference
Tina6/tina-libs/tina/vision/visMatch_erange.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_erange.c,v $
 27  * Date    :  $Date: 2003/10/06 12:29:48 $
 28  * Version :  $Revision: 1.3 $
 29  * CVS Id  :  $Id: visMatch_erange.c,v 1.3 2003/10/06 12:29:48 neil Exp $
 30  *
 31  * Author  : Legacy TINA
 32  *
 33  * Notes :
 34  * 
 35  * Module for managing current disparity range information.
 36  * 
 37  * Must be revised as appropriate before other stereo matching.
 38  * 
 39  * Can be used in conjuntion with disparity histogram to obtain spatial
 40  * map of disparity ranges directly from the edge data.
 41  * 
 42  * Subsequently provides an local index for disparity range estimates. 
 43  *
 44  *********
 45 */
 46 
 47 #include "visMatch_erange.h"
 48 
 49 #if HAVE_CONFIG_H
 50   #include <config.h>
 51 #endif
 52 
 53 
 54 #include <math.h>
 55 #include <tina/sys/sysDef.h>
 56 #include <tina/sys/sysPro.h>
 57 #include <tina/math/mathDef.h>
 58 #include <tina/math/mathPro.h>
 59 #include <tina/geometry/geomDef.h>
 60 #include <tina/geometry/geomPro.h>
 61 #include <tina/vision/vis_MatchDef.h>
 62 #include <tina/vision/vis_MatchPro.h>
 63 
 64 /* Static structure and functions to manage index of allowable
 65  * disparity its size should mirror dimensions of stereo index of the
 66  * left image. */
 67 static Windex *disp_range;
 68 
 69 void    disp_range_set(Windex * range)
 70 {
 71     wx_free(disp_range, rfree);
 72     disp_range = range;
 73 }
 74 
 75 Windex *disp_range_get(void)
 76 {
 77     return (disp_range);
 78 }
 79 
 80 /* Enquire about the disparity range corresponding to image location
 81  * (wrt stereo index image region). */
 82 Bool    disp_range_at_pos2(Vec2 v, double *low_d, double *up_d)
 83 {
 84     Ipos    p = {Ipos_id};
 85     Vec2   *vp;
 86 
 87     if (disp_range == NULL)
 88         return (false);
 89 
 90     p = wx_get_index(disp_range, v);
 91     vp = (Vec2 *) wx_get(disp_range, ipos_y(p), ipos_x(p));
 92 
 93     if (vp == NULL)
 94         return (false);
 95 
 96     *low_d = vec2_x(*vp);
 97     *up_d = vec2_y(*vp);
 98     return (true);
 99 }
100 
101 /* Fix the disparity range of the disparity range index. */
102 void    disp_range_fix_disparity(Windex * w, double low_d, double up_d)
103 {
104     Vec2 ***index;
105     int     i, j;
106     int     n, m;
107 
108     if (w == NULL)
109         return;
110 
111     m = w->m;
112     n = w->n;
113     index = (Vec2 ***) w->index;
114 
115     for (i = 0; i < m; ++i)
116         for (j = 0; j < n; ++j)
117             *index[i][j] = vec2(low_d, up_d);
118 }
119 
120 /* Make a disparity range index corresponding to given region and
121  * dimensions. */
122 Windex *disp_range_build(Imregion * region, int m, int n)
123 {
124     Windex *w;
125     Vec2 ***index;
126     int     i, j;
127 
128     if (region == NULL)
129         return (NULL);
130 
131     w = wx_alloc(region, m, n, DISPARITY);
132     m = w->m;
133     n = w->n;
134     index = (Vec2 ***) w->index;
135 
136     for (i = 0; i < m; ++i)
137         for (j = 0; j < n; ++j)
138             index[i][j] = vec2_make(vec2_zero());
139     return (w);
140 }
141 
142 /* Build a disparity range window for the edgerect uses the region of
143  * the associated stereo index. */
144 Windex *er_disp_range_build(Imrect * er, int m, int n)
145 {
146     Rindex *sx;
147 
148     if (er == NULL)
149         return (NULL);
150 
151     sx = (Rindex *) prop_get(er->props, SINDEX);
152     if (sx == NULL)
153         return (NULL);
154 
155     return (disp_range_build(sx->region, m, n));
156 }
157 

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