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

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

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