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

Linux Cross Reference
Tina5/tina-libs/tina/vision/visCorr_dproj.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/visCorr_dproj.c,v $
 23  * Date    :  $Date: 2004/08/04 15:07:47 $
 24  * Version :  $Revision: 1.1 $
 25  * CVS Id  :  $Id: visCorr_dproj.c,v 1.1 2004/08/04 15:07:47 paul Exp $
 26  *
 27  * Author : Simon Crossley (see thesis Univ. Sheffield U.K.), NAT.
 28  */
 29 /**
 30  * @file stereo correlation algorithms
 31  * @brief Routines to compute disparity at edges using disparity image.
 32  *
 33  *********
 34 */
 35 
 36 #include "visCorr_dproj.h"
 37 
 38 #include <math.h>
 39 #include <tina/sys/sysDef.h>
 40 #include <tina/sys/sysPro.h>
 41 #include <tina/math/mathDef.h>
 42 #include <tina/math/mathPro.h>
 43 #include <tina/file/fileDef.h>
 44 #include <tina/file/filePro.h>
 45 #include <tina/image/imgDef.h>
 46 #include <tina/image/imgPro.h>
 47 #include <tina/geometry/geomDef.h>
 48 #include <tina/geometry/geomPro.h>
 49 
 50 #include "vis_CorrDef.h"
 51 
 52 /* proj_dispim: create a list of 3D data points to be passed
 53    to a 3D display tool */
 54 
 55 List *proj_dispim(Imrect *disp_im, Imrect *edge_im)
 56 {
 57   Imregion roi;
 58   int i, j;
 59   List *geomlist = NULL;
 60   float disp;
 61   Point3 *point;
 62   Point2 *backref;
 63   Vec3 p;
 64   Edgel *edge;
 65   Vec2 edge_loc;
 66 
 67   if (disp_im == NULL || edge_im == NULL)
 68     return (NULL);
 69 
 70   roi = *(disp_im->region);
 71   roi.lx += PAD_DEPTH;
 72   roi.ly += PAD_DEPTH;
 73   roi.ux -= PAD_DEPTH;
 74   roi.uy -= PAD_DEPTH;
 75 
 76   FOR_IM (&roi, i, j)
 77     {
 78       disp = IM_FLOAT(disp_im, i, j);
 79       if (disp == NO_DISP)
 80         continue;
 81       
 82       if ((edge = (Edgel *)IM_PTR(edge_im, i, j)) == NULL)
 83         continue;
 84       
 85       point = point3_alloc(POINT3);
 86       backref = point2_make(vec2((float)j, (float)i), POINT2);
 87       
 88       edge_loc = edge->pos;
 89       vec3_x(p) = vec2_x(edge_loc);
 90       vec3_y(p) = vec2_y(edge_loc);
 91       vec3_z(p) = disp;
 92       point->p = vec3_par_proj_3d(p);
 93       point->props = proplist_addifnp(point->props, backref, POINT2,
 94                                       point2_free, true);
 95       geomlist = list_addtostart(geomlist, link_alloc(point, POINT3));
 96     }
 97 
 98   return(geomlist);
 99 }
100 
101 /* proj_scaled_dispim: create a list of 3D data points to be passed
102    to a 3D display tool */
103 
104 List *proj_scaled_dispim(Imrect *disp_im, double z_scale)
105 {
106   Imregion roi;
107   int i, j;
108   List *geomlist = NULL;
109   float disp;
110   Point3 *point;
111   Point2 *backref;
112         
113   if (disp_im == NULL)
114     return (NULL);
115 
116   roi = *(disp_im->region);
117   roi.lx += PAD_DEPTH;
118   roi.ly += PAD_DEPTH;
119   roi.ux -= PAD_DEPTH;
120   roi.uy -= PAD_DEPTH;
121 
122   FOR_IM(&roi, i, j)
123     {
124       disp = IM_FLOAT(disp_im, i, j);
125       if (disp == NO_DISP)
126         continue;
127 
128       point = point3_alloc(POINT3);
129       backref = point2_make(vec2((float)j, (float)i), POINT2);
130       
131       point->p = vec3(j, i, disp);
132       vec3_z(point->p) *= (float)z_scale;
133       
134       point->props = proplist_addifnp(point->props, backref, POINT2,
135                                       point2_free, true);
136       geomlist = list_addtostart(geomlist, link_alloc(point, POINT3));
137     }
138 
139   return(geomlist);
140 }
141 
142 

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