您的位置:首页 > 编程语言 > MATLAB

opencv-matlab-multi view geo-双目-相机参数-转置与不转置与转置与不转置-指南

2016-04-07 21:21 627 查看
记录 opencv-matlab-射影几何 中相机参数不统一的情况:

内参矩阵MM

约定,ximg=Mxcamx_{img}=Mx_{cam},其中,MM是内参矩阵,xcamx_{cam}是某点在相机坐标系下的坐标,ximgx_{img}是对应的像素坐标。

matlab中,stereo camera calibrator app输出的内参矩阵名为IntrinsicMatrix,是下三角矩阵,与约定不一致,为MTM^{T}。

opencv中,内参矩阵是上三角矩阵,与约定表示一致。

双目,相机2的RtRt

约定,P′=M′[R|t]P^{'}=M^{'} \big[ R | t \big] , x′img=P′xcamx_{img}^{'}=P^{'}x_{cam},其中x′imgx_{img}^{'}是xcamx_{cam}在相机2下成像所对应的像素坐标,M′M^{'}是相机2的内参矩阵,tt为相机1的光心CC在相机2坐标系下的坐标,RR为点坐标由相机1坐标系–>相机2坐标系的旋转矩阵.

扩展,极点e′=M′te^{'}=M^{'} t,x′cam=Rxcam+t=[R|t]xcamx^{'}_{cam}=Rx_{cam}+t=\big[ R | t \big]x_{cam}。

matlab中,相机2的RT分别名为RotationOfCamera2,TranslationOfCamera2,与约定表示一致。

opencv中,相机矩阵proMatr与约定表示的PP一致,函数cvTriangulatePoints:

CVAPI(void) cvTriangulatePoints(
CvMat* projMatr1,
CvMat* projMatr2,
CvMat* projPoints1,
CvMat* projPoints2,
CvMat* points4D);


中的前两个参数即P,P′P,P^{'}。

基础矩阵FF

约定,x′imgFximg=0x_{img}^{'}Fx_{img}=0, 即 l′=Fximg,l=x′imgFl^{'}=Fx_{img},l=x_{img}^{'}F,其中l,l′l,l^{'}分别为相机1、相机2成像下与x′img,ximgx_{img}^{'},x_{img}对应的的极线。

matlab中,stereo camera calibrator app输出的基础矩阵名为FundamentalMatrix,用于计算极线时不准确,原因不明。可用公式F=[e]×P′P+F=[e]_{\times}P^{'}P^{+}计算,其中P+P^{+}是PP的伪逆,P+=(PTP)−1PTP^{+}=(P^{T}P)^{-1}P^{T}。

Multiple View Geometry In Computer Vision 提供了检视对极线的matlab函数:

fig=vgg_gui_F(i1,i2,F)


这里的(参数F)(参数F)与约定的(基本矩阵F)(基本矩阵F)不一致,为(基本矩阵F)(基本矩阵F)的转置。

opencv中,基础矩阵fundamental_matrix与约定表示的FF一致,函数cvComputeCorrespondEpilines:

CVAPI(void) cvComputeCorrespondEpilines( const CvMat* points,
int which_image,
const CvMat* fundamental_matrix,
CvMat* correspondent_lines );


中的参数fundamental_matrix正是基础矩阵FF。

畸变

matlab中的径向畸变系数,切向畸变系数分别名为RadialDistortion,TangentialDistortion。

opencv中,函数cvUndistort2:

CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst,
const CvMat* camera_matrix,
const CvMat* distortion_coeffs,
const CvMat* new_camera_matrix CV_DEFAULT(0) );


中的参数distortion_coeffs合并了两种畸变参数,先径向、再切向。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: