前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >web3.0卡牌链游项目系统开发源码解决方案(成熟技术)

web3.0卡牌链游项目系统开发源码解决方案(成熟技术)

原创
作者头像
用户V_StPv888
发布2022-10-14 11:18:27
5570
发布2022-10-14 11:18:27
举报
文章被收录于专栏:开发大于一切开发大于一切

  一、什么是元宇宙?

  元宇宙指的是通过虚拟增强的物理现实,呈现收敛性和物理持久性特征的,基于未来互联网,具有链接感知和共享特征的3D虚拟空间。

  大概可以从时空性、真实性、独立性、连接性四个方面交叉描述元宇宙:

  (1)From the perspective of space-time,the meta universe is a virtual digital world in the space dimension and a real digital world in the time dimension;

  (2)From the perspective of authenticity,there are both digital copies of the real world and creations of the virtual world in the meta universe;

  (3)From the perspective of independence,the meta universe is a parallel space closely connected with the external real world and highly independent;

  (4)From the connectivity point of view,the meta universe is a sustainable and widely covered virtual reality system that includes the network,hardware terminals and users;

  为了保证代码的简洁,我们要把以前做过的东西封装成函数,写在slamBase.cpp中,以便将来调用。(不过,由于是算法性质的内容,就不封成c++的对象了)。

  首先工具函数:将cv的旋转矢量与位移矢量转换为变换矩阵,类型为Eigen::Isometry3d;

  src/slamBase.cpp

  1//cvMat2Eigen

  2 Eigen::Isometry3d cvMat2Eigen(cv::Mat&rvec,cv::Mat&tvec)

  3{

  4 cv::Mat R;

  5 cv::Rodrigues(rvec,R);

  6 Eigen::Matrix3d r;

  7 cv::cv2eigen(R,r);

  8

  9//将平移向量和旋转矩阵转换成变换矩阵

  10 Eigen::Isometry3d T=Eigen::Isometry3d::Identity();

  11

  12 Eigen::AngleAxisd angle(r);

  13 Eigen::Translation<double,3>trans(tvec.at<double>(0,0),tvec.at<double>(0,1),tvec.at<double>(0,2));

  14 T=angle;

  15 T(0,3)=tvec.at<double>(0,0);

  16 T(1,3)=tvec.at<double>(0,1);

  17 T(2,3)=tvec.at<double>(0,2);

  18 return T;

  19}

  另一个函数:将新的帧合并到旧的点云里:

  1//joinPointCloud

  2//输入:原始点云,新来的帧以及它的位姿

  3//输出:将新来帧加到原始帧后的图像

  4 PointCloud::Ptr joinPointCloud(PointCloud::Ptr original,FRAME&newFrame,Eigen::Isometry3d T,CAMERA_INTRINSIC_PARAMETERS&camera)

  5{

  6 PointCloud::Ptr newCloud=image2PointCloud(newFrame.rgb,newFrame.depth,camera);

  7

  8//合并点云

  9 PointCloud::Ptr output(new PointCloud());

  10 pcl::transformPointCloud(*original,*output,T.matrix());

  11*newCloud+=*output;

  12

  13//Voxel grid滤波降采样

  14 static pcl::VoxelGrid<PointT>voxel;

  15 static ParameterReader pd;

  16 double gridsize=atof(pd.getData("voxel_grid").c_str());

  17 voxel.setLeafSize(gridsize,gridsize,gridsize);

  18 voxel.setInputCloud(newCloud);

  19 PointCloud::Ptr tmp(new PointCloud());

  20 voxel.filter(*tmp);

  21 return tmp;

  22}

  另外,在parameters.txt中,我们增加了几个参数,以便调节程序的性能:

  #part 5

  #数据相关

  #起始与终止索引

  start_index=1

  end_index=700

  #数据所在目录

  rgb_dir=../data/rgb_png/

  rgb_extension=.png

  depth_dir=../data/depth_png/

  depth_extension=.png

  #点云分辨率

  voxel_grid=0.02

  #是否实时可视化

  visualize_pointcloud=yes

  #最小匹配数量

  min_good_match=10

  #最小内点

  min_inliers=5

  #最大运动误差

  max_norm=0.3

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
云服务器
云服务器(Cloud Virtual Machine,CVM)提供安全可靠的弹性计算服务。 您可以实时扩展或缩减计算资源,适应变化的业务需求,并只需按实际使用的资源计费。使用 CVM 可以极大降低您的软硬件采购成本,简化 IT 运维工作。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档