资源简介
生成相机标定棋盘的c++程序,棋盘格大小为25mm,生成后直接就可以打印使用了。
代码片段和文件信息
/*
获取kinect原始图片序列并依时间保存,以100张为单位,获取的图片可用于kinect标定
*/
#include “kinect.h“
#include
#include
#include
#include
#include
using namespace cv;
using namespace std;
// 安全释放指针
template
inline void SafeRelease(Interface *& pInterfaceToRelease)
{
if (pInterfaceToRelease != NULL)
{
pInterfaceToRelease->Release();
pInterfaceToRelease = NULL;
}
}
// 保存所需数据的结构体
struct eachframe
{
string depth_name;
string rgb_name;
cv::Mat tmp_itD1;
cv::Mat tmp_itRGB1;
};
int main()
{
// 创建保存目录
CreateDirectory(L“.//images“ NULL);
// 获取Kinect设备
IKinectSensor* m_pKinectSensor;
ICoordinateMapper* m_pCoordinateMapper;
CameraIntrinsics* m_pCameraIntrinsics = new CameraIntrinsics();
HRESULT hr;
hr = GetDefaultKinectSensor(&m_pKinectSensor);
if (FAILED(hr))
{
return hr;
}
IMultiSourceframeReader* m_pMultiframeReader;
IBodyframeSource* m_pBodyframeSource;
IBodyframeReader* m_pBodyframeReader;
if (m_pKinectSensor)
{
hr = m_pKinectSensor->Open();
Sleep(1000);
if (SUCCEEDED(hr))
{
m_pKinectSensor->get_BodyframeSource(&m_pBodyframeSource);
// 获取多数据源到读取器
hr = m_pKinectSensor->OpenMultiSourceframeReader(
frameSourceTypes::frameSourceTypes_Color |
frameSourceTypes::frameSourceTypes_Infrared |
frameSourceTypes::frameSourceTypes_Depth
&m_pMultiframeReader);
}
}
if (SUCCEEDED(hr))
{
hr = m_pKinectSensor->get_CoordinateMapper(&m_pCoordinateMapper);
}
if (!m_pKinectSensor || FAILED(hr))
{
return E_FAIL;
}
// 获取深度相机内参并打印
if (SUCCEEDED(hr))
{
hr = m_pCoordinateMapper->GetDepthCameraIntrinsics(m_pCameraIntrinsics);
}
if (SUCCEEDED(hr))
{
cout << “FocalLengthX : “ << m_pCameraIntrinsics->FocalLengthX << endl;
cout << “FocalLengthY : “ << m_pCameraIntrinsics->FocalLengthY << endl;
cout << “PrincipalPointX : “ << m_pCameraIntrinsics->PrincipalPointX << endl;
cout << “PrincipalPointY : “ << m_pCameraIntrinsics->PrincipalPointY << endl;
cout << “RadialDistortionFourthOrder : “ << m_pCameraIntrinsics->RadialDistortionFourthOrder << endl;
cout << “RadialDistortionSecondOrder : “ << m_pCameraIntrinsics->RadialDistortionSecondOrder << endl;
cout << “RadialDistortionSixthOrder : “ << m_pCameraIntrinsics->RadialDistortionSixthOrder << endl;
}
// 三个数据帧及引用
IDepthframeReference* m_pDepthframeReference;
IColorframeReference* m_pColorframeReference;
IInfraredframeReference* m_pInfraredframeReference;
IInfraredframe* m_pInfraredframe;
IDepthframe* m_pDepthframe;
IColorframe* m_pColorframe;
// 四个个图片格式
Mat i_rgb(1080 1920 CV_8UC4); //注意:这里必须为4通道的图,Kinect的数据只能以Bgra格式传出
Mat i_depth(424 512 CV_8UC1);
Mat i_depth_raw(424 512 CV_16UC1);
Mat i_ir(424 512 CV_16UC1);
UINT16 *depthData = new UINT16[424 * 512];
UINT16 *irData = new UINT16[424 * 512];
IMultiSourceframe*
- 上一篇:rs编解码.c rs纠错码
- 下一篇:C语言实现的文字加密与解密小程序()
相关资源
- ICP算法源代码拿走不谢
- 自适应图像增强完整OpenCV代码
- 在mfc中picture控件中显示Mat图片
- 基于Matlab的声纹锁
- OpenCv实现两个图片的相似度
- opencv椭圆拟合长短轴比
- Retinex算法,C++,opencv
- 利用opencv实现的条形码检测与识别C
- 各种语言编写的pcm代码
- LMSE(Ho-Kashyap).rar
- Opencv2.4.12 SVM手写数字识别
- opencv 正脸+左右侧脸全检测
- PCA和KPCA的Matlab和C++程序
- matlab实现VQ说话人识别系统
- 激光雷达数据读取、显示、分割、直
- DWA算法验证(matlab)
- CvvImage类库
- 基于opencv的C++人眼识别以及眨眼检测
- 在VS2012上基于opencv的C++人眼识别与眨
- 基于暗通道和导向滤波的图像去雾算
- 根据原图和二值图得到分割彩图
- qt界面化实现各种滤波函数
- c#通过dll读取opencv里的mat图片
- linux opencv车牌识别
- matlab2016b vs2017编译器补丁文件
- opencv多视频同一窗口显示C++程序
- 基于opencv的手势识别
- 利用opencv做的垃圾检测代码
- PEMFC matlab 仿真
- Opencv3.0 鱼眼相机标定fisheye
评论
共有 条评论