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

Linux Cross Reference
TINA5/tina-libs/tina/geometry/geomCam_proj.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/geometry/geomCam_proj.c,v $
 23  * Date    :  $Date: 2002/12/09 11:51:23 $
 24  * Version :  $Revision: 1.1.1.1 $
 25  * CVS Id  :  $Id: geomCam_proj.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
 26  *
 27  * Author  : Legacy TINA
 28  *
 29  * Notes : Projection functions for general camera
 30  *
 31  *********
 32 */
 33 
 34 #include "geomCam_proj.h"
 35 
 36 #if HAVE_CONFIG_H
 37   #include <config.h>
 38 #endif
 39 
 40 #include <math.h>
 41 #include <tina/sys/sysDef.h>
 42 #include <tina/sys/sysPro.h>
 43 #include <tina/math/mathDef.h>
 44 #include <tina/math/mathPro.h>
 45 #include <tina/geometry/geomDef.h>
 46 #include <tina/geometry/geom_CamDef.h>
 47 #include <tina/geometry/geomCam_rect.h>
 48 
 49 Vec2    cam_proj(Camera * cam, Vec3 v)
 50 {
 51     Vec2    w = {Vec2_id};
 52     Vec2    rectify_pos();
 53 
 54     /** transform into camera frame **/
 55     if (cam->transf != NULL)
 56         v = trans3_pos(*cam->transf, v);
 57 
 58     /** project onto unit focal plane **/
 59     w = proj2_of_vec3(v);
 60 
 61     /** allow for optical distortion **/
 62     if (cam->distort_func != NULL)
 63         w = cam->distort_func(w, cam->distort_params);
 64 
 65     /** change to image coordinates **/
 66     w = rectify_pos(cam->cam_to_im, w);
 67 
 68     return (w);
 69 }
 70 
 71 void    cam_ray(Camera * cam, Vec2 u, Vec3 * p, Vec3 * v)
 72 {
 73     Vec2    rectify_pos();
 74     Vec3    w = {Vec3_id};
 75 
 76     /* change from image to unit camera coordinates */
 77     rectify_pos(cam->im_to_cam, u);
 78 
 79     /** allow for optical distortion **/
 80     if (cam->correct_func != NULL)
 81         u = cam->correct_func(u, cam->distort_params);
 82 
 83     w = proj3_of_vec2(u);
 84     if (cam->transf != NULL)
 85     {
 86         *p = trans3_get_origin2in1(*(cam->transf));
 87 
 88         w = trans3_inverse_vec(*(cam->transf), w);
 89         *v = vec3_unit(w);
 90     } else
 91     {
 92         *p = vec3_zero();
 93         *v = vec3_unit(w);
 94     }
 95 }
 96 

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