00001 /* This file is part of Polyora, a multi-target tracking library. 00002 Copyright (C) 2010 Julien Pilet 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License along 00015 with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 To contact the author of this program, please send an e-mail to: 00018 julien.pilet(at)calodox.org 00019 */ 00020 /* Camera Distortion handling functions. Julien Pilet 2008. */ 00021 00022 #ifndef _DISTORTION_H 00023 #define _DISTORTION_H 00024 00025 #include "keypoint.h" 00026 00027 // Camera calibration; 00028 struct DistortParams { 00029 float fx,fy,cx,cy; 00030 float k[2],p[2]; 00031 00032 static DistortParams *load(const char *file); 00033 }; 00034 00035 extern DistortParams defaultCam; 00036 00038 void distort(const float u, const float v, float distorted[2], const DistortParams &p=defaultCam); 00039 00041 void undistort(const float distorted_u, const float distorted_v, float uv[2], const DistortParams &p=defaultCam); 00042 00044 void undistort(keypoint *kpt, const DistortParams &p=defaultCam); 00045 00046 #endif