资源简介
opencv2 3D标定.cpp
代码片段和文件信息
/*
* 3calibration.cpp -- Calibrate 3 cameras in a horizontal line together.
*/
#include “opencv2/calib3d.hpp“
#include “opencv2/imgproc.hpp“
#include “opencv2/imgcodecs.hpp“
#include “opencv2/highgui.hpp“
#include “opencv2/core/utility.hpp“
#include
#include
#include
using namespace cv;
using namespace std;
enum { DETECTION = 0 CAPTURING = 1 CALIBRATED = 2 };
static void help(char** argv)
{
printf( “\nThis is a camera calibration sample that calibrates 3 horizontally placed cameras together.\n“
“Usage: %s\n“
“ -w= # the number of inner corners per one of board dimension\n“
“ -h= # the number of inner corners per another board dimension\n“
“ [-s=] # square size in some user-defined units (1 by default)\n“
“ [-o=] # the output filename for intrinsic [and extrinsic] parameters\n“
“ [-zt] # assume zero tangential distortion\n“
“ [-a=] # fix aspect ratio (fx/fy)\n“
“ [-p] # fix the principal point at the center\n“
“ [input_data] # input data - text file with a list of the images of the board\n“
“\n“ argv[0] );
}
static void calcChessboardCorners(Size boardSize float squareSize vector& corners)
{
corners.resize(0);
for( int i = 0; i < boardSize.height; i++ )
for( int j = 0; j < boardSize.width; j++ )
corners.push_back(Point3f(float(j*squareSize)
float(i*squareSize) 0));
}
static bool run3Calibration(vector > imagePoints1
vector > imagePoints2
vector > imagePoints3
Size imageSize Size boardSize
float squareSize float aspectRatio
int flags
Mat& cameraMatrix1 Mat& distCoeffs1
Mat& cameraMatrix2 Mat& distCoeffs2
Mat& cameraMatrix3 Mat& distCoeffs3
Mat& R12 Mat& T12 Mat& R13 Mat& T13)
{
int c i;
// step 1: calibrate each camera individually
vector > objpt(1);
vector > imgpt;
calcChessboardCorners(boardSize squareSize objpt[0]);
vector rvecs tvecs;
for( c = 1; c <= 3; c++ )
{
const vector >& imgpt0 = c == 1 ? imagePoints1 : c == 2 ? imagePoints2 : imagePoints3;
imgpt.clear();
int N = 0;
for( i = 0; i < (int)imgpt0.size(); i++ )
if( !imgpt0[i].empty() )
{
imgpt.push
- 上一篇:基于VSCode和CMake实现C++开发
- 下一篇:Qt曲线
相关资源
- 3DES加密算法C++实现
- DES/3DES算法C语言实现
- DES和3DES加密算法,C语言,适用于单片
- Frangi最初提出的Hessian矩阵血管增强,
- 导入3dmax模型的VC++程序
- 用opengl做的3D教室漫游程序
- 简单的OpenGL 3D场景
- 3DES加密算法 C++实现
- D3D11 最新HOOK 源码支持X86_X64
- MFC,3D动画小车
- MFC+OpenGL实现3ds模型导入
- 3D图形旋转
- 基于OpenGL的3D射击游戏的设计与实现
- 3D枪战射击游戏cs简单版源代码
- opengl画了一个简单的3D模型
-
C++ 实现 3DES加解密ba
se64加解密 - VC++和OpenGL读取3DS文件并显示的完整源
- openg读取3ds文件,含view3ds软件
- C语言 opengl 3d 游戏开发 源码
- 3DSLoader.rar
- 使用qwtPlot3D实现三维曲线、轨迹绘制
- OpenInventor中COIN3D三维程序开发
- MFC 中使用 OpenGL 1.0非微软版本,而是
- Unity3D调用Native OpenGL渲染方式
- bm3d图像去噪算法C++代码
- 3D三角形网格模型补洞源代码
- BM3DC++代码
- Visual C++游戏开发技术与书与随书光盘
- 3D天空迷宫.zip
- Game Programming in C++ Creating 3D Games Fir
评论
共有 条评论