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

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

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