PCL在MFC下建立窗口界面

上传人:豆浆 文档编号:11126770 上传时间:2017-09-02 格式:PDF 页数:18 大小:614.75KB
返回 下载 相关 举报
PCL在MFC下建立窗口界面_第1页
第1页 / 共18页
PCL在MFC下建立窗口界面_第2页
第2页 / 共18页
PCL在MFC下建立窗口界面_第3页
第3页 / 共18页
PCL在MFC下建立窗口界面_第4页
第4页 / 共18页
PCL在MFC下建立窗口界面_第5页
第5页 / 共18页
点击查看更多>>
资源描述

《PCL在MFC下建立窗口界面》由会员分享,可在线阅读,更多相关《PCL在MFC下建立窗口界面(18页珍藏版)》请在金锄头文库上搜索。

1、1. 在c盘下新建Project 文件夹2. 打开vs2010新建MFC应用程序项目,项目名称 PCLDialog,位置 C:Projects。选择基于对话框如图。其余默认完成。完成后如下图:3. 将我提供 pclvisualization_mfc文件夹(修改过的源代码) 放到自己所建的工程中文件夹下 (C:ProjectsPCLDialogPCLDialog)4. 将源文件和头文件添加到工程中1) .右键单击头文件 -添加 -现有项。找到 C:ProjectsPCLDialogPCLDialogpclvisualization_mfcinclude目录下的头文件全部添加。2)。右键单击源文件

2、 -添加 -现有项。找到 C:ProjectsPCLDialogPCLDialogpclvisualization_mfc目录下的源文件文件全部添加。5.为工程添加附加包含目录(根据自己程序安装路径而定)C:Program FilesVTKincludevtk-5.10C:Program FilesPCL 1.6.03rdPartyBoostincludeC:Program FilesPCL 1.6.0includepcl-1.6C:Program FilesPCL 1.6.03rdPartyEigenincludeC:Program FilesPCL 1.6.03rdPartyFLANNin

3、cludeC:ProjectsPCLDialogPCLDialog添加附加库目录(根据自己程序安装路径而定)C:Program FilesPCL 1.6.03rdPartyQhulllibC:Program FilesPCL 1.6.03rdPartyBoostlibC:Program FilesPCL 1.6.03rdPartyFLANNlibC:Program FilesPCL 1.6.03rdPartyEigenbinC:Program FilesPCL 1.6.0libC:Program FilesVTKlibvtk-5.10C:Program FilesOpenNILib为工程添加附

4、加依赖项openNI.libpcl_apps_debug.libpcl_common_debug.libpcl_features_debug.libpcl_filters_debug.libpcl_io_debug.libpcl_io_ply_debug.libpcl_keypoints_debug.libpcl_kdtree_debug.libpcl_octree_debug.libpcl_registration_debug.libpcl_sample_consensus_debug.libpcl_search_debug.libpcl_segmentation_debug.libpcl_

5、surface_debug.libpcl_tracking_debug.libpcl_visualization_debug.libflann_cpp_s-gd.libflann_cuda_s-gd.libflann-gd.libflann_s-gd.libboost_date_time-vc100-mt-gd-1_47.libboost_filesystem-vc100-mt-gd-1_47.libboost_iostreams-vc100-mt-gd-1_47.libboost_system-vc100-mt-gd-1_47.libboost_thread-vc100-mt-gd-1_47

6、.liblibboost_date_time-vc100-mt-gd-1_47.liblibboost_filesystem-vc100-mt-gd-1_47.liblibboost_iostreams-vc100-mt-gd-1_47.liblibboost_system-vc100-mt-gd-1_47.liblibboost_thread-vc100-mt-gd-1_47.libvtkalglib.libvtkCharts.libvtkCommon.libvtkDICOMParser.libvtkexoIIc.libvtkexpat.libvtkFiltering.libvtkfreet

7、ype.libvtkftgl.libvtkGenericFiltering.libvtkGeovis.libvtkGraphics.libvtkhdf5.libvtkhdf5_hl.libvtkHybrid.libvtkImaging.libvtkInfovis.libvtkIO.libvtkjpeg.libvtklibxml2.libvtkmetaio.libvtkMFC.libvtkNetCDF.libvtkNetCDF_cxx.libvtkpng.libvtkproj4.libvtkRendering.libvtksqlite.libvtksys.libvtktiff.libvtkver

8、dict.libvtkViews.libvtkVolumeRendering.libvtkWidgets.libvtkzlib.lib6.在工程属性字符集中选择 UseMulti-Byte Character Set,如果用 Unicode, PCL源文件有太多要改,后面编译通不过。(总之我试着解决了,总是出错,后来就放弃了,请高手指点)7.1) 在对话框中插入 picture control2)改控件 ID为: IDC_PCDVIEWER8.在 PCLDialogDlg.h中1)添加头文件(将下面代码复制一下即可):#include pclpoint_cloud.h#include pclp

9、oint_types.h#include pclvisualization_mfcincludepcl_mfc_visualizer.h#include vtkRenderer.h#include 2)新建私有变量(将下面代码复制到指定的地方即可)private:/视图窗口pcl:mfc_visualization:PCLVisualizer *viewer;/vtkRenderer *pvtkRenderer;POINT ptBorder;/数据点sensor_msgs:PointCloud2:Ptr binary_blob;/数据点句柄pcl:mfc_visualization:Point

10、CloudGeometryHandlerXYZ:Ptr xyz_Handler;pcl:mfc_visualization:PointCloudColorHandlerRGBField:Ptr color_Handler; /传感器位置方向矩阵Eigen:Vector4f sensor_origin;Eigen:Quaternion sensor_orientation;3)复制过后的结果应该是: 9.在PCLDialogDlg.cpp中1).初始化CPCLDialogDlg:CPCLDialogDlg(CWnd* pParent /*=NULL*/): CDialogEx(CPCLDialo

11、gDlg:IDD, pParent)m_hIcon = AfxGetApp()-LoadIcon(IDR_MAINFRAME);/begin tyz/初始化this-viewer = NULL;sensor_origin = Eigen:Vector4f:Zero();sensor_orientation = Eigen:Quaternionf:Identity ();2) 在 BOOL CPCLDialogDlg:OnInitDialog()函数中添加/利用PictControl控件加载 PCD窗口CWnd *viewer_pcWnd;viewer_pcWnd = this-GetDlgIt

12、em(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();/

13、10. 添加消息 WM_SIZE响应函数 OnSize,保证 PCLVisualizer窗口 viewer随对话框变化。1). 在 PCLDialog窗体上单击右键选择 MFC类向导选择消息中的 WM-SIZE后添加处理函数,并编辑代码。2)void CPCLDialogDlg:OnSize(UINT nType, int cx, int cy)CDialogEx:OnSize(nType, cx, cy);/ TODO: Add your message handler code hereif (:IsWindow(this-GetSafeHwnd()if (this-viewer)cx -

14、= ptBorder.x;cy -= ptBorder.y;this-GetDlgItem(IDC_PCLVIWER)-SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE);this-viewer-SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE); 11新建 button控件, caption: Open PCD, ID: IDC_OPENPCD,为控件添加响应函 OnBnClickedOpenpcd()修改 caption和 ID后属性显示为下图:添加响应函 OnBnClickedOpenpcd()右击 Open PCD按钮选择添加事件处理程序,弹出对话框点编辑,添加代码如下void CPCLDialogDlg:OnBnClickedOpenpcd()this-viewer-removeAllPointClouds ();/ TODO: Add your control notification handler code herestatic TCHAR BASED_CODE szFilter

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号