本帖最后由 tyzaizl 于 2013-5-21 15:56 编辑
如何实现基于MFC对话框的PCL显示(2)
田玉珍(CIOMP)
2.3.4 在工程属性字符集中选择UseMulti-Byte Character Set,如果用Unicode, PCL源文件有太多要改,后面编译通不过。(总之我试着解决了,总是出错,后来就放弃了,请高手指点) 2.3.5在对话框中插入picture control控件ID:IDC_PCDVIEWER。 2.3.6 在PCLDialog.h中添加 头文件 - #include "pcl\point_cloud.h"
- #include "pcl\point_types.h"
- #include "pclvisualization_mfc\include\pcl_mfc_visualizer.h"
- #include "vtkRenderer.h"
- #include <pcl/io/pcd_io.h>
复制代码新建私有变量 - private:
- //视图窗口
- pcl::mfc_visualization::PCLVisualizer *viewer;
- //vtkRenderer *pvtkRenderer;
- POINT ptBorder;
- //数据点
- sensor_msgs::PointCloud2::Ptr binary_blob;
- //数据点句柄
- pcl::mfc_visualization::PointCloudGeometryHandlerXYZ<sensor_msgs::PointCloud2>::Ptr xyz_Handler;
- pcl::mfc_visualization::PointCloudColorHandlerRGBField<sensor_msgs::PointCloud2>::Ptr color_Handler;
- //传感器位置方向矩阵
- Eigen::Vector4f sensor_origin;
- Eigen::Quaternion<float> sensor_orientation;
复制代码2.3.7 初始化 - CPCLDialogDlg::CPCLDialogDlg(CWnd* pParent /*=NULL*/): CDialogEx(CPCLDialogDlg::IDD, pParent)
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- ///////////////////////////////////////////////////////////////////////////////////////////////////
- //begin tyz
- //初始化
- this->viewer = NULL;
- sensor_origin = Eigen::Vector4f::Zero();
- sensor_orientation = Eigen::Quaternionf::Identity ();
- }
复制代码2.3.8 在BOOL CPCLDialogDlg::OnInitDialog()函数中添加 - ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //利用PictControl控件加载PCD窗口
- CWnd *viewer_pcWnd;
- viewer_pcWnd = this->GetDlgItem(IDC_PCDVIWER);
- this->viewer = new pcl::mfc_visualization::PCLVisualizer(viewer_pcWnd);
- CRect cRectPCL;
- this->viewer->GetClientRect(&cRectPCL);
- CRect cRectClient;
- GetClientRect(&cRectClient);
- this->ptBorder.x = cRectClient.Width() - cRectPCL.Width();
- this->ptBorder.y = cRectClient.Height() - cRectPCL.Height();
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////
复制代码 如何实现基于MFC对话框的PCL显示(3)
http://www.pclcn.org/bbs/forum.php?mod=viewthread&tid=225&page=1&extra=#pid752
(如有需要相关修改源代码的,请回复留下邮箱,我发给大家) |