1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2011 Blender Foundation. 17 * All rights reserved. 18 */ 19 20 #ifndef LIBMV_C_API_RECONSTRUCTION_H_ 21 #define LIBMV_C_API_RECONSTRUCTION_H_ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 struct libmv_Tracks; 28 struct libmv_CameraIntrinsics; 29 struct libmv_CameraIntrinsicsOptions; 30 31 typedef struct libmv_Reconstruction libmv_Reconstruction; 32 33 enum { 34 LIBMV_REFINE_FOCAL_LENGTH = (1 << 0), 35 LIBMV_REFINE_PRINCIPAL_POINT = (1 << 1), 36 LIBMV_REFINE_RADIAL_DISTORTION_K1 = (1 << 2), 37 LIBMV_REFINE_RADIAL_DISTORTION_K2 = (1 << 4), 38 }; 39 40 typedef struct libmv_ReconstructionOptions { 41 int select_keyframes; 42 int keyframe1, keyframe2; 43 int refine_intrinsics; 44 } libmv_ReconstructionOptions; 45 46 typedef void (*reconstruct_progress_update_cb) (void* customdata, 47 double progress, 48 const char* message); 49 50 libmv_Reconstruction* libmv_solveReconstruction( 51 const struct libmv_Tracks* libmv_tracks, 52 const struct libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options, 53 libmv_ReconstructionOptions* libmv_reconstruction_options, 54 reconstruct_progress_update_cb progress_update_callback, 55 void* callback_customdata); 56 57 libmv_Reconstruction* libmv_solveModal( 58 const struct libmv_Tracks* libmv_tracks, 59 const struct libmv_CameraIntrinsicsOptions* libmv_camera_intrinsics_options, 60 const libmv_ReconstructionOptions* libmv_reconstruction_options, 61 reconstruct_progress_update_cb progress_update_callback, 62 void* callback_customdata); 63 64 int libmv_reconstructionIsValid(libmv_Reconstruction *libmv_reconstruction); 65 66 void libmv_reconstructionDestroy(libmv_Reconstruction* libmv_reconstruction); 67 68 int libmv_reprojectionPointForTrack( 69 const libmv_Reconstruction* libmv_reconstruction, 70 int track, 71 double pos[3]); 72 73 double libmv_reprojectionErrorForTrack( 74 const libmv_Reconstruction* libmv_reconstruction, 75 int track); 76 77 double libmv_reprojectionErrorForImage( 78 const libmv_Reconstruction* libmv_reconstruction, 79 int image); 80 81 int libmv_reprojectionCameraForImage( 82 const libmv_Reconstruction* libmv_reconstruction, 83 int image, 84 double mat[4][4]); 85 86 double libmv_reprojectionError(const libmv_Reconstruction* libmv_reconstruction); 87 88 struct libmv_CameraIntrinsics* libmv_reconstructionExtractIntrinsics( 89 libmv_Reconstruction *libmv_Reconstruction); 90 91 #ifdef __cplusplus 92 } 93 #endif 94 95 #endif // LIBMV_C_API_RECONSTRUCTION_H_ 96