#include <gandalf/vision/camera_linear.h>for double precision or
#include <gandalf/vision/cameraf_linear.h>Then use the routine
Gan_Camera CameraD; /* build a linear camera in double precision */ gan_camera_build_linear ( &CameraD, /* ZH FY FX Y0 X0 */ 100.0, 700.0, 500.0, 150.0, 100.0 );to create a double precision linear camera. There is a single-precision camera structure, called a Gan_Camera_f. The single precision version of the above function is
Gan_Camera_f CameraF; /* build a linear camera in double precision */ gan_cameraf_build_linear ( &CameraF, /* ZH FY FX Y0 X0 */ 100.0F, 700.0F, 500.0F, 150.0F, 100.0F );There are similar functions for creating cameras with a radial distortion model, for which you will need one or more of the following header files:
#include <gandalf/vision/camera_radial_dist1.h> #include <gandalf/vision/camera_radial_dist2.h> #include <gandalf/vision/camera_radial_dist3.h> #include <gandalf/vision/cameraf_radial_dist1.h> #include <gandalf/vision/cameraf_radial_dist2.h> #include <gandalf/vision/cameraf_radial_dist3.h>
Then the functions are
/* build a camera with one radial distortion parameter */ gan_camera_build_radial_distortion_1 ( &CameraD, /* ZH FY FX Y0 X0 */ 100.0, 700.0, 500.0, 150.0, 100.0, /* K1 */ 0.001 ); /* OR */ gan_cameraf_build_radial_distortion_1 ( &CameraF, /* ZH FY FX Y0 X0 */ 100.0F, 700.0F, 500.0F, 150.0F, 100.0F, /* K1 */ 0.001F ); /* build a camera with two radial distortion parameters */ gan_camera_build_radial_distortion_2 ( &CameraD, /* ZH FY FX Y0 X0 */ 100.0, 700.0, 500.0, 150.0, 100.0, /* K1, K2 */ 0.001, 1.0e-7 ); /* OR */ gan_cameraf_build_radial_distortion_2 ( &CameraF, /* ZH FY FX Y0 X0 */ 100.0F, 700.0F, 500.0F, 150.0F, 100.0F, /* K1, K2 */ 0.001F, 1.0e-7F ); /* build a camera with three radial distortion parameters */ gan_camera_build_radial_distortion_3 ( &CameraD, /* ZH FY FX Y0 X0 */ 100.0, 700.0, 500.0, 150.0, 100.0, /* K1, K2, K3 */ 0.001, 1.0e-7, -0.0001 ); /* OR */ gan_cameraf_build_radial_distortion_3 ( &CameraF, /* ZH FY FX Y0 X0 */ 100.0F, 700.0F, 500.0F, 150.0F, 100.0F, /* K1, K2, K3 */ 0.001F, 1.0e-7F, -0.0001F );Note that Gan_Camera's and Gan_Camera_f's are simple structures with no internally allocated data, so there is no ..._free function for them.