opencv连杆操作.docx

上传人:scccc 文档编号:12034499 上传时间:2021-12-01 格式:DOCX 页数:6 大小:71.50KB
返回 下载 相关 举报
opencv连杆操作.docx_第1页
第1页 / 共6页
opencv连杆操作.docx_第2页
第2页 / 共6页
opencv连杆操作.docx_第3页
第3页 / 共6页
opencv连杆操作.docx_第4页
第4页 / 共6页
opencv连杆操作.docx_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《opencv连杆操作.docx》由会员分享,可在线阅读,更多相关《opencv连杆操作.docx(6页珍藏版)》请在三一文库上搜索。

1、智能机器人实验报告实验四 连杆操作【实验目的】理解3D点云运算,能够熟练编程实现连杆的空间运动模拟。【实验条件】Ubuntu系统PCL库Opencv库【实验原理】在对机器人运动学中旋转及平移操作进行充分理解的基础上,综合运用旋转平移组合等操作,实现连杆移动的仿真。如下图所示,图中3D点云为单个连杆。运用opencv及PCL操作该连杆,实现两连杆的连接以及旋转仿真。推荐精选连杆1连杆2 连杆1  连杆2 45度85度【实验内容】完成下列程序,要求使用opencv完成点云的旋转平移等操作,并将操作后的点云转换为pcl的PointCloud类型返回,以便之后的

2、程序显示结果。pcl:PointCloud<pcl:PointXYZ> linkageTransformation (pcl:PointCloud<pcl:PointXYZ> pointcloudinput) pcl:PointCloud<pcl:PointXYZ> pointcloudoutput; /* * please finish this program to implement 3D points linkage Transformation. * input: pointcloudinput * output: pointcloudoutput

3、 * description: calculate pointcloudoutput by Transformating linkage point cloud */ cv:Mat l1 =cv:Mat(3,pointcloudinput.size(),CV_32F); cerr << "=" << endl; for(int i=0;i<pointcloudinput.size();+i) l1.at<float>(0, i) =pointcloudinput.at(i).x;推荐精选 l1.at<float>(1,

4、i) =pointcloudinput.at(i).y; l1.at<float>(2, i) =pointcloudinput.at(i).z; cerr << "=" << endl; cv:Mat l2 =cv:Mat(3,pointcloudinput.size(),CV_32F); for(int i=0;i<pointcloudinput.size();+i) l2.at<float>(0, i) =pointcloudinput.at(i).x; l2.at<float>(1, i) =poin

5、tcloudinput.at(i).y; l2.at<float>(2, i) =pointcloudinput.at(i).z; cerr << "=" << endl; cv:Mat R1 = cv:Mat(3,3,CV_32F); R1.at<float>(0,0)=cos(3.14/4); R1.at<float>(1,0)=sin(3.14/4); R1.at<float>(2,0)=0; R1.at<float>(1,0)=-sin(3.14/4); R1.at<float

6、>(1,1)=cos(3.14/4); R1.at<float>(1,2)=0; R1.at<float>(2,0)=0; R1.at<float>(2,1)=0; R1.at<float>(2,2)=1; l1 = R1 * l1; cerr << "=" << endl; cv:Mat R2 = cv:Mat(3,3,CV_32F); R2.at<float>(0,0)=cos(1.48); R2.at<float>(1,0)=sin(1.48); R2.at<f

7、loat>(2,0)=0; R2.at<float>(1,0)=-sin(1.48); R2.at<float>(1,1)=cos(1.48); R2.at<float>(1,2)=0; R2.at<float>(2,0)=0; R2.at<float>(2,1)=0; R2.at<float>(2,2)=1; l2 = R2 * l2; cerr << "=" << endl; for(int i = 0; i < pointcloudinput.size();i+

8、) l2.at<float>(0,i) += 8.0f;cv:Mat c = cv:Mat(3, pointcloudinput.size(),CV_32F);for(int i = 0; i < pointcloudinput.size();i+)c.at<float>(0,i) = -2.344;推荐精选c.at<float>(1,i) = 5.656;c.at<float>(2,i) = 0;l2 = l2 + c; pcl:PointCloud<pcl:PointXYZ> pointcloudl1,pointcloudl

9、2;pointcloudl1.resize(l1.cols);pointcloudl2.resize(l2.cols);for(int i =0; i<l1.cols;+i) pointcloudl1.at(i).x = l1.at<float>(0,i); pointcloudl1.at(i).y = l1.at<float>(1,i); pointcloudl1.at(i).z = l1.at<float>(2,i); pointcloudoutput.push_back(pointcloudl1.at(i);for(int i =0; i<

10、l2.cols;+i) pointcloudl2.at(i).x = l1.at<float>(0,i); pointcloudl2.at(i).y = l1.at<float>(1,i); pointcloudl2.at(i).z = l1.at<float>(2,i); pointcloudoutput.push_back(pointcloudl1.at(i); return pointcloudoutput;【实验程序】编写实验程序。【实验结果】推荐精选【实验分析】在实验过程中编译出现错误,对程序进行修改之后运行成功 (注:可编辑下载,若有不当之处,请指正,谢谢!) 推荐精选

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1