Main Page | Modules | Class List | File List | Class Members | File Members

camera.h

Go to the documentation of this file.
00001 
00014 /* This library is free software; you can redistribute it and/or
00015    modify it under the terms of the GNU Lesser General Public
00016    License as published by the Free Software Foundation; either
00017    version 2.1 of the License, or (at your option) any later version.
00018 
00019    This library is distributed in the hope that it will be useful,
00020    but WITHOUT ANY WARRANTY; without even the implied warranty of
00021    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022    Lesser General Public License for more details.
00023 
00024    You should have received a copy of the GNU Lesser General Public
00025    License along with this library; if not, write to the Free Software
00026    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00027 */
00028 
00029 #ifndef _GAN_CAMERA_H
00030 #define _GAN_CAMERA_H
00031 
00032 #include <stdio.h>
00033 #include <gandalf/common/misc_defs.h>
00034 #include <gandalf/vision/camera_defs.h>
00035 #include <gandalf/linalg/3x3matrix.h>
00036 #include <gandalf/linalg/2x3matrix.h>
00037 #include <gandalf/linalg/3vector.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00056 typedef struct Gan_PositionState
00057 {
00058    Gan_Bool initialised;
00059    Gan_Vector3 pin, pout;
00060 } Gan_PositionState;
00061 
00065 typedef struct Gan_CubicBSplineSupport
00066 {
00067    Gan_Vector2 warped_pos[1 + (1 << 4)][1 + (1 << 4)];
00068    Gan_Matrix22 warped_deriv[1 + (1 << 4)][1 + (1 << 4)];
00069 } Gan_CubicBSplineSupport;
00070 
00071 typedef Gan_Vector2 Gan_CubicBSplineWeightBlock[1 + (1<<4)];
00072 
00076 typedef struct Gan_CubicBSplineWeights
00077 {
00078    Gan_Vector2 weight[1 + (1 << 4)][1 + (1 << 4)];
00079 } Gan_CubicBSplineWeights;
00080          
00084 typedef struct Gan_Camera
00085 {
00087    Gan_CameraType type;
00088 
00090 
00092    double fx, fy, fy_over_fx;
00093 
00095    double x0, y0;
00096 
00098    double zh;
00099 
00110    union
00111    {
00112       struct
00113       {
00115          double skew, kyx;
00116 
00118          Gan_Matrix23 Kinv;
00119       } affine;
00120 
00121       struct
00122       {
00124          double K1;
00125 
00127          double thres_R2, thres_dR;
00128 
00130          double outer_a, outer_b;
00131       } radial1;
00132 
00133       struct
00134       {
00136          double K1, K2;
00137 
00139          double thres_R2, thres_dR;
00140 
00142          double outer_a, outer_b;
00143       } radial2;
00144 
00145       struct
00146       {
00148          double K1, K2, K3;
00149 
00151          double thres_R2, thres_dR;
00152 
00154          double outer_a, outer_b;
00155       } radial3;
00156 
00157       struct { double cxx, cxy, cyx, cyy; } xydist4;
00158 
00159       struct
00160       {
00161          double xla, xlp, xha, xhp;
00162          double yla, ylp, yha, yhp;
00163          double axx, axy, ayx, ayy;
00164       } fcwarp;
00165 
00166       struct
00167       {
00169          double skew, kyx, kzx, kzy;
00170 
00172          Gan_Matrix33 K, Kinv;
00173 
00175          Gan_CubicBSplineWeightBlock *weight;
00176 
00178          Gan_CubicBSplineSupport* support;
00179       } cbspline;
00180    } nonlinear;
00181 
00183    struct
00184    {
00186       Gan_Bool (*project) ( const struct Gan_Camera *camera,
00187                             Gan_Vector3 *X, Gan_Vector3 *p, Gan_PositionState *Xpprev,
00188                             Gan_Matrix22 *HX, struct Gan_Camera *HC,
00189                             int *error_code );
00190 
00192       Gan_Bool (*backproject) ( const struct Gan_Camera *camera,
00193                                 Gan_Vector3 *p, Gan_Vector3 *X, Gan_PositionState *pXprev,
00194                                 int *error_code );
00195 
00197       Gan_Bool (*add_distortion) ( const struct Gan_Camera *camera,
00198                                    Gan_Vector3 *pu, Gan_Vector3 *p, Gan_PositionState *pupprev,
00199                                    int *error_code );
00200 
00202       Gan_Bool (*remove_distortion) ( const struct Gan_Camera *camera,
00203                                       Gan_Vector3 *p, Gan_Vector3 *pu, Gan_PositionState *ppuprev,
00204                                       int *error_code);
00205    } point;
00206 
00208    struct
00209    {
00211       Gan_Bool (*project) ( const struct Gan_Camera *camera,
00212                             Gan_Vector3 *L, Gan_Vector3 *l );
00213 
00215       Gan_Bool (*backproject) ( const struct Gan_Camera *camera,
00216                                 Gan_Vector3 *l, Gan_Vector3 *L );
00217    } line;
00218 } Gan_Camera;
00219 
00220  Gan_Bool gan_camera_build_va ( Gan_Camera *camera,
00221                                Gan_CameraType type,
00222                                double zh, double fx, double fy,
00223                                double x0, double y0, ... );
00224  Gan_Bool gan_camera_internalize ( Gan_Camera *camera );
00225  Gan_Bool gan_camera_identical ( const Gan_Camera *camera1, const Gan_Camera *pcamera2 );
00226  Gan_SquMatrix33 gan_camera_fill_matrix_s ( const Gan_Camera *camera );
00227  Gan_Matrix33    gan_camera_fill_fullmatrix_s ( const Gan_Camera *camera );
00228 
00229  Gan_Bool gan_camera_set_common_fields ( Gan_Camera *camera,
00230                                         Gan_CameraType type,
00231                                         double zh, double fx, double fy,
00232                                         double x0, double y0 );
00233 
00258  Gan_Bool
00259  gan_camera_project_point_gen ( const Gan_Camera *camera,
00260                                 Gan_Vector3 *X, Gan_Vector3 *p, Gan_PositionState *Xpprev,
00261                                 Gan_Matrix22 *HX, Gan_Camera HC[2],
00262                                 int *error_code );
00263 
00280  Gan_Bool
00281  gan_camera_project_point ( const Gan_Camera *camera,
00282                             Gan_Vector3 *X, Gan_Vector3 *p,
00283                             int *error_code );
00284 
00303  Gan_Bool
00304  gan_camera_project_point_q ( const Gan_Camera *camera,
00305                               Gan_Vector3 *X, Gan_Vector3 *p );
00306 
00324  Gan_Bool
00325  gan_camera_project_point_i ( const Gan_Camera *camera, Gan_Vector3 *X );
00326 
00347  Gan_Bool
00348  gan_camera_backproject_point_gen ( const Gan_Camera *camera,
00349                                     Gan_Vector3 *p, Gan_Vector3 *X, Gan_PositionState *pXprev,
00350                                     int *error_code );
00351 
00371  Gan_Bool
00372  gan_camera_backproject_point ( const Gan_Camera *camera,
00373                                 Gan_Vector3 *p, Gan_Vector3 *X,
00374                                 int *error_code );
00375 
00396  Gan_Bool
00397  gan_camera_backproject_point_q ( const Gan_Camera *camera,
00398                                   Gan_Vector3 *p, Gan_Vector3 *X );
00399 
00419  Gan_Bool
00420  gan_camera_backproject_point_i ( const Gan_Camera *camera,
00421                                   Gan_Vector3 *p );
00422 
00440  Gan_Bool
00441  gan_camera_add_distortion_gen ( const Gan_Camera *camera,
00442                                  Gan_Vector3 *pu, Gan_Vector3 *p, Gan_PositionState *pupprev,
00443                                  int *error_code );
00444 
00461  Gan_Bool
00462  gan_camera_add_distortion ( const Gan_Camera *camera,
00463                              Gan_Vector3 *pu, Gan_Vector3 *p,
00464                              int *error_code );
00465 
00483  Gan_Bool
00484  gan_camera_add_distortion_q ( const Gan_Camera *camera,
00485                                Gan_Vector3 *pu, Gan_Vector3 *p );
00486 
00502  Gan_Bool
00503  gan_camera_add_distortion_i ( const Gan_Camera *camera, Gan_Vector3 *p );
00504 
00520  Gan_Bool
00521  gan_camera_remove_distortion_gen ( const Gan_Camera *camera,
00522                                     Gan_Vector3 *p, Gan_Vector3 *pu, Gan_PositionState *ppuprev,
00523                                     int *error_code );
00524 
00539  Gan_Bool
00540  gan_camera_remove_distortion ( const Gan_Camera *camera,
00541                                 Gan_Vector3 *p, Gan_Vector3 *pu,
00542                                 int *error_code );
00543 
00560  Gan_Bool
00561  gan_camera_remove_distortion_q ( const Gan_Camera *camera,
00562                                   Gan_Vector3 *p, Gan_Vector3 *pu );
00563 
00579  Gan_Bool
00580  gan_camera_remove_distortion_i ( const Gan_Camera *camera, Gan_Vector3 *p );
00581 
00598  Gan_Bool
00599  gan_camera_project_line_q ( const Gan_Camera *camera,
00600                              Gan_Vector3 *L, Gan_Vector3 *l );
00601 
00618  Gan_Bool
00619  gan_camera_project_line_i ( const Gan_Camera *camera, Gan_Vector3 *L );
00620 
00640  Gan_Bool
00641  gan_camera_backproject_line_q ( const Gan_Camera *camera,
00642                                  Gan_Vector3 *l, Gan_Vector3 *L );
00643 
00665  Gan_Bool
00666  gan_camera_backproject_line_i ( const Gan_Camera *camera, Gan_Vector3 *l );
00667 
00676 #ifdef __cplusplus
00677 }
00678 #endif
00679 
00680 #endif /* #ifndef _GAN_CAMERA_H */

Generated on Fri Mar 17 12:44:47 2006 by  doxygen 1.3.9.1