/*
This file is part of the CVD Library.
Copyright (C) 2005 The Authors
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
//-*- c++ -*-
#ifndef __CAMERA_H
#define __CAMERA_H
#include <cmath>
#include <TooN/TooN.h>
#include <TooN/helpers.h>
template<class T>
inline T SAT(T x){return (x<-1.0/3?-1e9:x);}
/// Classes which represent camera calibrations.
/// @ingroup gVision
namespace Camera {
/// A linear camera with zero skew
/// @ingroup gVision
class Linear {
public:
/// The number of parameters in the camera
static const int num_parameters=4;
///Load parameters from a stream
///@param is The stream to use
inline void load(std::istream& is);
/// Save parameters to a stream
///@param os The stream to use
inline void save(std::ostream& os);
/// Fast linear projection for working out what's there
inline TooN::Vector<2> linearproject(const TooN::Vector<2>& camframe, double scale=1) const;
/// Project from Euclidean camera frame to image plane
inline TooN::Vector<2> project(const TooN::Vector<2>& camframe) const;
/// Project from image plane to a Euclidean camera
inline TooN::Vector<2> unproject(const TooN::Vector<2>& imframe) const;
/// Get the derivative of image frame wrt camera frame at the last computed projection
/// in the form \f$ \begin{bmatrix} \frac{\partial \text{im1}}{\partial \text{cam1}} & \frac{\partial \text{im1}}{\partial \text{cam2}} \\ \frac{\partial \text{im2}}{\partial \text{cam1}} & \frac{\partial \text{im2}}{\partial \text{cam2}} \end{bmatrix} \f$
inline TooN::Matrix<2,2> get_derivative() const;
/// Get the motion of a point with respect to each of the internal camera parameters
inline TooN::Matrix<num_parameters,2> get_parameter_derivs() const ;
/// Get the component of the motion of a point in the direction provided
/// with respect to each of the internal camera parameters
/// @param direction The (x,y) direction to use
inline TooN::Vector<num_parameters> get_parameter_derivs(const TooN::Vector<2>& direction) const ;
/// Update the internal camera parameters by adding the vector given
/// @param updates Update vector in the format
/// \f$ \begin{pmatrix}\Delta f_u & \Delta f_v & \Delta u_0 & \Delta v_0 \end{pmatrix} \f$
inline void update(const TooN::Vector<num_parameters>& updates);
/// Returns the vector of camera parameters in the format
/// \f$ \begin{pmatrix}f_u & f_v & u_0 & v_0 \end{pmatrix} \f$
inline TooN::Vector<num_parameters>& get_parameters() {return my_camera_parameters;}
inline const TooN::Vector<num_parameters>& get_parameters() const {return my_camera_parameters;}
private:
TooN::Vector<num_parameters> my_camera_parameters;
mutable TooN::Vector<2> my_last_camframe;
};
/// A camera with zero skew and cubic distortion
/// @ingroup gVision
class Cubic {
public:
/// The number of parameters in the camera
static const int num_parameters=5;
///Load parameters from a stream
///@param is The stream to use
inline void load(std::istream& is);
/// Save parameters to a stream
///@param os The stream to use
inline void save(std::ostream& os);
/// Fast linear projection for working out what's there
inline TooN::Vector<2> linearproject(const TooN::Vector<2>& camframe, double scale=1);
/// Project from Euclidean camera frame to image plane
inline TooN::Vector<2> project(const TooN::Vector<2>& camframe) const;
/// Project from image plane to a Euclidean camera
inline TooN::Vector<2> unproject(const TooN::Vector<2>& imframe);
/// Get the derivative of image frame wrt camera frame at the last computed projection
/// in the form \f$ \begin{bmatrix} \frac{\partial \text{im1}}{\partial \text{cam1}} & \frac{\partial \text{im1}}{\partial \text{cam2}} \\ \frac{\partial \text{im2}}{\partial \text{cam1}} & \frac{\partial \text{im2}}{\partial \text{cam2}} \end{bmatrix} \f$
inline TooN::Matrix<2,2> get_derivative();
/// Get the motion of a point with respect to each of the internal camera parameters
inline TooN::Matrix<num_parameters,2> get_parameter_derivs() const ;
/// Get the component of the motion of a point in the direction provided
/// with respect to each of the internal camera parameters
/// @param direction The (x,y) direction to use
inline TooN::Vector<num_parameters> get_parameter_derivs(const TooN::Vector<2>& direction) const ;
/// Update the internal camera parameters by adding the vector given
/// @param updates Update vector in the format
/// \f$ \begin{pmatrix}\Delta f_u & \Delta f_v & \Delta u_0 & \Delta v_0 & \Delta c\end{pmatrix} \f$
inline void update(const TooN::Vector<num_parameters>& updates);
/// Returns the vector of camera parameters in the format
/// \f$ \begin{pmatrix}f_u & f_v & u_0 & v_0 & c\end{pmatrix} \f$
inline TooN::Vector<num_parameters>& get_parameters() {return my_camera_parameters;}
inline const TooN::Vector<num_parameters>& get_parameters() const {return my_camera_parameters;}
private:
TooN::Vector<num_parameters> my_camera_parameters; // f_u, f_v, u_0, v_0
mutable TooN::Vector<2> my_last_camframe;
};
/// A camera with zero skew and quintic distortion
/// @ingroup gVision
class Quintic {
public:
/// The number of parameters in the camera
static const int num_parameters=6;
///Load parameters from a stream
///@param is The stream to use
inline void load(std::istream& is);
/// Save parameters to a stream
///@param os The stream to use
inline void save(std::ostream& os);
/// Fast linear projection for working out what's there
inline TooN::Vector<2> linearproject(const TooN::Vector<2>& camframe, double scale=1) const ;
/// Project from Euclidean camera frame to image plane
inline TooN::Vector<2> project_vector(const TooN::Vector<2>& x, const TooN::Vector<2>& d) const {
const double xsq = x*x;
const double& a = my_camera_parameters[4];
const double& b = my_camera_parameters[5];
return (2 * (a + 2*b*xsq) * (x*d) * TooN::diagmult(my_camera_parameters.slice<0,2>(), x) +
(1 + a*xsq + b*xsq*xsq)*TooN::diagmult(my_camera_parameters.slice<0,2>(), d));
}
inline TooN::Vector<2> project_vector(const TooN::Vector<2>& d) const {
return diagmult(my_camera_parameters.slice<0,2>(), d);
}
inline TooN::Vector<2> unproject_vector(const TooN::Vector<2>& d) const {
TooN::Vector<2> v;
v[0] = d[0]/my_camera_parameters[0];
v[1] = d[1]/my_camera_parameters[1];
return v;
}
inline TooN::Vector<2> project(const TooN::Vector<2>& camframe) const;
inline std::pair<TooN::Vector<2>, TooN::Matrix<2> > project(const TooN::Vector<2>& camframe, const TooN::Matrix<2>& R) const;
/// Project from image plane to a Euclidean camera
inline TooN::Vector<2> unproject(const TooN::Vector<2>& imframe) const;
inline std::pair<TooN::Vector<2>, TooN::Matrix<2> > unproject(const TooN::Vector<2>& imframe, const TooN::Matrix<2>& R) const;
/// Get the derivative of image frame wrt camera frame at the last computed projection
/// in the form \f$ \begin{bmatrix} \frac{\partial \text{im1}}{\partial \text{cam1}} & \frac{\partial \text{im1}}{\partial \text{cam2}} \\ \frac{\partial \text{im2}}{\
没有合适的资源?快使用搜索试试~ 我知道了~
windows下编译PTAM所需已编译好的libcvd,gvars库的相关内容
共145个文件
h:138个
lib:4个
hh:2个
需积分: 12 7 下载量 104 浏览量
2017-04-03
17:11:06
上传
评论
收藏 27.14MB ZIP 举报
温馨提示
windows下编译PTAM所需已编译好的libcvd,gvars库的相关内容。版本libcvd-20100511,gvars3.0
资源推荐
资源详情
资源评论
收起资源包目录
windows下编译PTAM所需已编译好的libcvd,gvars库的相关内容 (145个子文件)
capture_logic.cxx 2KB
camera.h 32KB
image.h 24KB
gl_helpers.h 21KB
videosource.h 18KB
morphology.h 18KB
convolution.h 17KB
vision.h 16KB
convert_pixel_types.h 14KB
image_io.h 13KB
colourspace.h 12KB
colourspaces.h 12KB
rgb_components.h 12KB
draw.h 11KB
load_and_save.h 11KB
gvars3.h 10KB
dvbuffer.h 9KB
fast_corner.h 9KB
utility.h 9KB
image_ref.h 9KB
colourspace_convert.h 9KB
videodisplay.h 8KB
v4l1buffer.h 8KB
dvbuffer3.h 8KB
interpolate.h 8KB
documentation.h 8KB
diskbuffer2.h 8KB
tensor_voting.h 8KB
scalar_convert.h 7KB
videofilebuffer.h 7KB
pixel_traits.h 7KB
image_convert.h 7KB
deinterlacebuffer.h 7KB
timer.h 7KB
image_interpolate.h 6KB
serialize.h 6KB
videobuffer.h 6KB
fits.h 6KB
harris_corner.h 6KB
bmp.h 6KB
pnm_grok.h 6KB
v4lbuffer.h 6KB
gl_types.h 5KB
v4lcontrol.h 5KB
readaheadvideobuffer.h 5KB
glwindow.h 5KB
haar.h 5KB
tiff.h 5KB
qtbuffer.h 5KB
v4l2buffer.h 5KB
png.h 5KB
rgb.h 5KB
pixel_operations.h 4KB
colourspacebuffer.h 4KB
serverpushjpegbuffer.h 4KB
irls.h 4KB
argb.h 4KB
rgba.h 4KB
integral_image.h 4KB
GUI_Motif.h 3KB
la.h 3KB
bgrx.h 3KB
timeddiskbuffer.h 3KB
interface.h 3KB
cvdimage.h 3KB
videoframe.h 3KB
GUI.h 3KB
builtin_components.h 3KB
parameter.h 3KB
ringbuffer.h 3KB
cpu_hacks.h 3KB
localvideoframe.h 3KB
GUI_Fltk2.h 3KB
sgi-video.h 3KB
GUI_Fltk.h 3KB
brezenham.h 3KB
name_builtin_types.h 2KB
v4l2frame.h 2KB
config.h 2KB
default.h 2KB
save_postscript.h 2KB
jpeg.h 2KB
types.h 2KB
v4l1frame.h 2KB
videobufferwithdata.h 2KB
diskbuffer2_frame.h 2KB
thread.h 2KB
text.h 2KB
runnable_batch.h 2KB
rgb8.h 2KB
type_name.h 2KB
videofilebuffer_frame.h 2KB
deinterlaceframe.h 2KB
abs.h 2KB
localvideobuffer.h 2KB
vector_image_ref.h 2KB
random.h 2KB
O2videoframe.h 2KB
O2buffer.h 2KB
dvframe.h 2KB
共 145 条
- 1
- 2
资源评论
吃个小熊饼
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功