资源简介
这是在ROS下同时采集彩色图和深度图的代码包。博客:https://blog.csdn.net/crp997576280/article/details/88377871 对应的代码包,具体使用步骤可以参考博客。如果你的积分不够可以留下邮箱,我看到的时候会发送到你的邮箱当中去。
代码片段和文件信息
/**
*
* 函数功能:采集iaikinect2输出的彩色图和深度图数据,并以文件的形式进行存储
*
*
* 分隔符为 逗号‘,‘
* 时间戳单位为秒(s) 精确到小数点后6位(us)
*
* maker:crp
* 2017-5-13
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include //将ROS下的sensor_msgs/Image消息类型转化成cv::Mat。
#include//头文件sensor_msgs/Image是ROS下的图像的类型,这个头文件中包含对图像进行编码的函数
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
using namespace cv;
Mat rgb depth;
char successed_flag1 =0successed_flag2=0;
string topic1_name = “/kinect2/qhd/image_color“; //topic 名称
string topic2_name = “/kinect2/qhd/image_depth_rect“;
string filename_rgbdata=“/home/crp/recordData/RGBD/rgbdata.txt“;
string filename_depthdata=“/home/crp/recordData/RGBD/depthdata.txt“;
string save_imagedata = “/home/crp/recordData/RGBD/“;
bool display_IMU5211( unsigned char buf[21] timeval time_stampstring &out_result);
void dispDepth(const cv::Mat &in cv::Mat &out const float maxValue);
void callback_function_color( const sensor_msgs::Image::ConstPtr image_data);
void callback_function_depth( const sensor_msgs::Image::ConstPtr image_data);
int main(int argcchar** argv)
{
string out_result;
namedWindow(“image color“CV_WINDOW_AUTOSIZE);
namedWindow(“image depth“CV_WINDOW_AUTOSIZE);
ros::init(argcargv“kinect2_listen“);
if(!ros::ok())
return 0;
ros::NodeHandle n;
ros::Subscriber sub1 = n.subscribe(topic1_name50callback_function_color);
ros::Subscriber sub2 = n.subscribe(topic2_name50callback_function_depth);
ros::AsyncSpinner spinner(3); // Use 3 threads
spinner.start();
string rgb_str dep_str;
struct timeval time_val;
struct timezone tz;
double time_stamp;
ofstream fout_rgb(filename_rgbdata.c_str());
if(!fout_rgb)
{
cerr< }
ofstream fout_depth(filename_depthdata.c_str());
if(!fout_depth)
{
cerr< }
while(ros::ok())
{
if( successed_flag1 )
{
gettimeofday(&time_val&tz);//us
// time_stamp =time_val.tv_sec+ time_val.tv_usec/1000000.0;
ostringstream os_rgb;
os_rgb< rgb_str = save_imagedata+“rgb/“+os_rgb.str()+“.png“;
imwrite(rgb_strrgb);
fout_rgb< successed_flag1=0;
imshow(“image
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-03-10 15:26 save_rgbd_from_kinect2\
文件 6741 2019-03-10 15:26 save_rgbd_from_kinect2\CMakeLists.txt
文件 6799 2016-06-30 15:24 save_rgbd_from_kinect2\CMakeLists.txt~
目录 0 2019-03-10 15:25 save_rgbd_from_kinect2\include\
目录 0 2019-03-10 16:12 save_rgbd_from_kinect2\include\save_rgbd_from_kinect2\
文件 3131 2019-03-10 15:26 save_rgbd_from_kinect2\package.xm
文件 3131 2016-06-21 14:26 save_rgbd_from_kinect2\package.xm
目录 0 2019-03-10 23:40 save_rgbd_from_kinect2\src\
文件 5960 2019-03-10 23:40 save_rgbd_from_kinect2\src\save_rgbd_from_kinect2.cpp
文件 5960 2019-03-10 23:40 save_rgbd_from_kinect2\src\save_rgbd_from_kinect2.cpp~
- 上一篇:伪终端实现GSM
- 下一篇:labview手绘波形
相关资源
- probability-sheldon-ross-solution-manual.pdf
- ROS 6.x+7.x L6 授权
- kinect深度图像去噪
- 在ROS中与其他器件使用十六进制串口
- 镭神激光雷达驱动LS01C_ROS完整文件包
- Microsoft Loopback Adapter Cracked x64 AMD64
- Kinect程序,包括简单的图像处理
- Kinect+PCL Demo程序 点云处理和显示 VS
- Microsoft.Practices.ServiceLocation
- 最简单方便的ROSDDNS动态域名脚本
- Bentley Microstation V8i (SELECTSeries 4)
- RationalRose2007 直接使用版
- kinect 2.0生成点云,并用PCL存储
- 新建 Microsoft Word 文档.docx
- 常见wifi电路设计
- 基于欧几里德聚类的障碍物检测ROS实
- 推荐的ros学习方法和较好教程书籍.
- Microsoft Root Certification 2010&2011解决VS
- ROS读取键盘通过串口控制电机例程
- kinect官方技术文档英文
- Microsoft.Office.Interop.Graph.dll
- 机器人在ros下的KCF跟踪算法实现
- 基于 ROS 与 Kinect 的移动机器人同时定
- ZeroServer_2
- ZeroServer_1 界面图标
- ZeroServer_01
- 用于rosserial-stm32的库RosLibs
- 微软KinectFusion开源实现
- Microsoft ACPI Source Language (ASL) Compi
- Kinect获取彩色图像并保存为jpg图片
评论
共有 条评论