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

Linux Cross Reference
Tina4/src/vision/camera/proj.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 /**
  4 proj.c:
  5 Projection functions for general camera
  6 **/
  7 
  8 #include <tina/sys.h>
  9 #include <tina/math.h>
 10 #include <tina/mathfuncs.h>
 11 #include <tina/vision.h>
 12 
 13 Vec2    cam_proj(Camera * cam, Vec3 v)
 14 {
 15     Vec2    w = {Vec2_id};
 16     Vec2    rectify_pos();
 17 
 18     /** transform into camera frame **/
 19     if (cam->transf != NULL)
 20         v = trans3_pos(*cam->transf, v);
 21 
 22     /** project onto unit focal plane **/
 23     w = proj2_of_vec3(v);
 24 
 25     /** allow for optical distortion **/
 26     if (cam->distort_func != NULL)
 27         w = cam->distort_func(w, cam->distort_params);
 28 
 29     /** change to image coordinates **/
 30     w = rectify_pos(cam->cam_to_im, w);
 31 
 32     return (w);
 33 }
 34 
 35 void    cam_ray(Camera * cam, Vec2 u, Vec3 * p, Vec3 * v)
 36 {
 37     Vec2    rectify_pos();
 38     Vec3    w = {Vec3_id};
 39 
 40     /* change from image to unit camera coordinates */
 41     rectify_pos(cam->im_to_cam, u);
 42 
 43     /** allow for optical distortion **/
 44     if (cam->correct_func != NULL)
 45         u = cam->correct_func(u, cam->distort_params);
 46 
 47     w = proj3_of_vec2(u);
 48     if (cam->transf != NULL)
 49     {
 50         *p = trans3_get_origin2in1(*(cam->transf));
 51 
 52         w = trans3_inverse_vec(*(cam->transf), w);
 53         *v = vec3_unit(w);
 54     } else
 55     {
 56         *p = vec3_zero();
 57         *v = vec3_unit(w);
 58     }
 59 }
 60 

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