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

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

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