{"id":8796,"date":"2024-05-26T22:01:01","date_gmt":"2024-05-26T14:01:01","guid":{"rendered":""},"modified":"2024-05-26T22:01:01","modified_gmt":"2024-05-26T14:01:01","slug":"\u70b9\u4e91\u5b9e\u4f8b\u5206\u5272_\u70b9\u4e91\u5206\u5272\u7684\u4e94\u79cd\u65b9\u6cd5","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8796.html","title":{"rendered":"\u70b9\u4e91\u5b9e\u4f8b\u5206\u5272_\u70b9\u4e91\u5206\u5272\u7684\u4e94\u79cd\u65b9\u6cd5"},"content":{"rendered":"
\n\u539f\u6587\u94fe\u63a5\uff1aRegion growing segmentation<\/p>\n<\/blockquote>\n
\u672c\u6559\u7a0b\u4f7f\u7528\u5230\u7684\u70b9\u4e91\u6570\u636e\uff1asource files<\/p>\n
\u5728\u672c\u7bc7\u6559\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u5982\u4f55\u4f7f\u7528\u7531pcl::RegionGrowing\u7c7b<\/strong>\u5b9e\u73b0\u7684\u533a\u57df\u751f\u957f\u7b97\u6cd5\u3002\u8be5\u7b97\u6cd5\u7684\u76ee\u7684\u662f\u5408\u5e76\u5728\u5e73\u6ed1\u7ea6\u675f\u6761\u4ef6\u4e0b\u8db3\u591f\u63a5\u8fd1\u7684\u70b9\u3002\u56e0\u6b64\uff0c\u8be5\u7b97\u6cd5\u7684\u8f93\u51fa\u6570\u636e\u7ed3\u6784\u662f\u7531\u805a\u7c7b\u7ec4\u6210\u7684\u6570\u7ec4\uff0c\u5176\u4e2d\u6bcf\u4e2a\u805a\u7c7b\u90fd\u662f\u88ab\u8ba4\u4e3a\u662f\u540c\u4e00\u5149\u6ed1\u8868\u9762\u7684\u4e00\u90e8\u5206\u7684\u70b9\u7684\u96c6\u5408\u3002\u8be5\u7b97\u6cd5\u7684\u5de5\u4f5c\u539f\u7406\uff08\u5149\u6ed1\u5ea6\u7684\u8ba1\u7b97\uff09\u662f\u57fa\u4e8e\u4e24\u70b9\u6cd5\u7ebf\u4e4b\u95f4\u7684\u89d2\u5ea6\u6bd4\u8f83\u3002<\/p>\n
\u76ee\u5f55<\/strong><\/p>\n
\u57fa\u672c\u539f\u7406<\/p>\n
\u7b97\u6cd5\u4f2a\u4ee3\u7801<\/p>\n
\u8f93\u5165<\/p>\n
\u521d\u59cb\u5316<\/p>\n
\u7b97\u6cd5\u5b9e\u73b0<\/p>\n
\u7a0b\u5e8f\u4ee3\u7801<\/p>\n
\u4ee3\u7801\u5206\u6790<\/p>\n
\u5b9e\u9a8c\u7ed3\u679c<\/p>\n
\u5176\u4ed6\u6570\u636e\u7ed3\u679c<\/p>\n
\n\u57fa\u672c\u539f\u7406<\/h2>\n
\u9996\u5148\uff0c\u5b83\u6839\u636e\u70b9\u7684\u66f2\u7387\u503c\u5bf9\u70b9\u8fdb\u884c\u6392\u5e8f\u3002\u9700\u8981\u8fd9\u6837\u505a\u662f\u56e0\u4e3a\u533a\u57df\u4ece\u66f2\u7387\u6700\u5c0f\u7684\u70b9\u5f00\u59cb\u589e\u957f\u3002\u8fd9\u6837\u505a\u7684\u539f\u56e0\u662f\u66f2\u7387\u6700\u5c0f\u7684\u70b9\u4f4d\u4e8e\u5e73\u5766\u533a\u57df(\u4ece\u6700\u5e73\u5766\u533a\u57df\u751f\u957f\u53ef\u4ee5\u51cf\u5c11\u6bb5\u7684\u603b\u6570)\u3002<\/p>\n
\u6211\u4eec\u6709\u4e86\u5206\u7c7b\u8fc7\u7684\u4e91\u3002\u76f4\u5230\u4e91\u4e2d\u6ca1\u6709\u672a\u6807\u8bb0\u70b9\u65f6\uff0c\u7b97\u6cd5\u9009\u53d6\u66f2\u7387\u503c\u6700\u5c0f\u7684\u70b9\uff0c\u5f00\u59cb\u533a\u57df\u7684\u589e\u957f\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n
\n
- \u9009\u4e2d\u7684\u70b9\u88ab\u6dfb\u52a0\u5230\u540d\u4e3a\u79cd\u5b50\u7684\u96c6\u5408\u4e2d\u3002<\/li>\n
- \u5bf9\u4e8e\u6bcf\u4e00\u4e2a\u79cd\u5b50\u70b9\uff0c\u627e\u5230\u5b83\u7684\u90bb\u8fd1\u70b9\uff1a\n
\n
- \u7b97\u51fa\u6bcf\u4e2a\u76f8\u90bb\u70b9\u7684\u6cd5\u7ebf\u548c\u5f53\u524d\u79cd\u5b50\u70b9\u7684\u6cd5\u7ebf\u4e4b\u95f4\u7684\u89d2\u5ea6\uff0c\u5982\u679c\u89d2\u5ea6\u5c0f\u4e8e\u9608\u503c\uff0c\u5219\u5c06\u5f53\u524d\u70b9\u6dfb\u52a0\u5230\u5f53\u524d\u533a\u57df\u3002<\/li>\n
- \u7136\u540e\u8ba1\u7b97\u6bcf\u4e2a\u90bb\u5c45\u70b9\u7684\u66f2\u7387\u503c\uff0c\u5982\u679c\u66f2\u7387\u5c0f\u4e8e\u9608\u503c\uff0c\u90a3\u4e48\u8fd9\u4e2a\u70b9\u88ab\u6dfb\u52a0\u5230\u79cd\u5b50\u4e2d\u3002<\/li>\n
- \u5c06\u5f53\u524d\u7684\u79cd\u5b50\u4ece\u79cd\u5b50\u5217\u8868\u4e2d\u79fb\u9664\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n
\u5982\u679c\u79cd\u5b50\u5217\u8868\u53d8\u6210\u7a7a\u7684\uff0c\u8fd9\u610f\u5473\u7740\u8be5\u533a\u57df\u751f\u957f\u5df2\u5b8c\u6210\uff0c\u7ee7\u7eed\u91cd\u590d\u4e0a\u8ff0\u8fc7\u7a0b\u3002<\/p>\n
\n\u533a\u57df\u751f\u957f\u7b97\u6cd5\uff1a \u5c06\u5177\u6709\u76f8\u4f3c\u6027\u7684\u70b9\u4e91\u96c6\u5408\u8d77\u6765\u6784\u6210\u533a\u57df\u3002<\/strong>
\u9996\u5148\u5bf9\u6bcf\u4e2a\u9700\u8981\u5206\u5272\u7684\u533a\u57df\u627e\u51fa\u4e00\u4e2a\u79cd\u5b50\u70b9\u4f5c\u4e3a\u751f\u957f\u7684\u8d77\u70b9\uff0c\u7136\u540e\u5c06\u79cd\u5b50\u70b9\u5468\u56f4\u90bb\u57df\u4e2d\u4e0e\u79cd\u5b50\u6709\u76f8\u540c\u6216 \u76f8\u4f3c\u6027\u8d28\u7684\u70b9\u5408\u5e76\u5230\u79cd\u5b50\u50cf\u7d20\u6240\u5728\u7684\u533a\u57df\u4e2d\u3002\u800c\u65b0\u7684\u70b9\u7ee7\u7eed\u4f5c\u4e3a\u79cd\u5b50\u5411\u56db\u5468\u751f\u957f\uff0c\u76f4\u5230\u518d\u6ca1\u6709\u6ee1\u8db3\u6761\u4ef6 \u7684\u50cf\u7d20\u53ef\u4ee5\u5305\u62ec\u8fdb\u6765\uff0c\u4e00\u4e2a\u533a\u57df\u5c31\u751f\u957f\u800c\u6210\u4e86\u3002
\u7b97\u6cd5\u6d41\u7a0b\uff1a<\/p>\n\n
- \u8ba1\u7b97\u6cd5\u7ebfnormal \u548c\u66f2\u7387curvatures\uff0c\u4f9d\u636e\u66f2\u7387\u5347\u5e8f \u6392\u5e8f\uff1b<\/li>\n
- \u9009\u62e9\u66f2\u7387\u6700\u4f4e\u7684\u4e3a\u521d\u59cb\u79cd\u5b50\u70b9\uff0c\u79cd\u5b50\u5468\u56f4\u7684\u4e34\u8fd1\u70b9\u548c \u79cd\u5b50\u70b9\u4e91\u76f8\u6bd4\u8f83\uff1b<\/li>\n
- \u8bbe\u7f6e\u6cd5\u7ebf\u5939\u89d2\u9608\u503c\uff0c\u641c\u7d22\u5f53\u524d\u79cd\u5b50\u70b9\u7684\u90bb\u57df\u70b9\uff0c\u8ba1\u7b97\u90bb\u57df\u70b9\u7684\u6cd5\u7ebf\u4e0e\u5f53\u524d\u79cd\u5b50\u70b9\u7684\u6cd5\u7ebf\u4e4b\u95f4\u7684\u5939\u89d2\uff0c\u5c0f\u4e8e\u9608\u503c\u7684\u90bb\u57df\u70b9\u52a0\u5165\u5230\u5f53\u524d\u533a\u57df\uff1b<\/li>\n
- \u8bbe\u7f6e\u66f2\u7387\u9608\u503c\uff0c\u66f2\u7387\u662f\u5426\u8db3\u591f\u5c0f\uff08\u8868\u9762\u5904\u5728\u540c\u4e00\u4e2a\u5f2f\u66f2\u7a0b\u5ea6\uff09\uff0c\u68c0\u67e5\u6bcf\u4e00\u4e2a\u90bb\u57df\u70b9\u7684\u66f2\u7387\uff0c\u5c0f\u4e8e\u66f2\u7387\u9608\u503c\u7684\u90bb\u57df\u70b9\u52a0\u5165\u5230\u79cd\u5b50\u70b9\u5e8f\u5217\u4e2d\uff0c\u5e76\u5220\u9664\u5f53\u524d\u79cd\u5b50\u70b9\uff0c\u4ee5\u65b0\u7684\u79cd\u5b50\u70b9\u7ee7\u7eed\u751f\u957f\uff1b<\/li>\n
- \u5982\u679c\u6ee1\u8db33\uff0c4\u5219\u8be5\u70b9\u53ef\u7528\u505a\u79cd\u5b50\u70b9;<\/li>\n
- \u5982\u679c\u53ea\u6ee1\u8db33\uff0c\u5219\u5f52\u7c7b\u800c\u4e0d\u505a\u79cd\u5b50;<\/li>\n
- \u91cd\u590d\u8fdb\u884c\u4ee5\u4e0a\u751f\u957f\u8fc7\u7a0b\uff0c\u76f4\u5230\u79cd\u5b50\u70b9\u5e8f\u5217\u88ab\u6e05\u7a7a\u3002\u6b64\u65f6\uff0c\u4e00\u4e2a\u533a\u57df\u751f\u957f\u5b8c\u6210\uff0c\u5e76\u5c06\u5176\u52a0\u5165\u5230\u805a\u7c7b\u6570\u7ec4\u4e2d\uff1b<\/li>\n
- \u5bf9\u5269\u4f59\u70b9\u91cd\u590d\u8fdb\u884c\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u76f4\u5230\u904d\u5386\u5b8c\u6240\u6709\u70b9\u3002<\/li>\n<\/ol>\n<\/blockquote>\n
\u7b97\u6cd5\u4f2a\u4ee3\u7801<\/h2>\n
\u8f93\u5165<\/h3>\n
\n
- Point cloud<\/em> = <\/li>\n
- Point normals<\/em> = <\/li>\n
- Points curvatures<\/em> = <\/li>\n
- Neighbour finding function<\/em> <\/li>\n
- Curvature threshold<\/em> <\/li>\n
- Angle threshold<\/em> <\/li>\n<\/ul>\n
\u521d\u59cb\u5316<\/h3>\n
\u533a\u57df\u5217\u8868\u7f6e\u4e3a\u7a7a\uff1a Region list<\/em> <\/p>\n
\u53ef\u7528\u7684\u70b9\u4e91\u5217\u8868\uff1aAvailable points list<\/em> <\/p>\n
\u7b97\u6cd5\u5b9e\u73b0<\/h3>\n
<\/p>\n
\u7a0b\u5e8f\u4ee3\u7801<\/h2>\n
#include <iostream>\n#include <vector>\n#include <pcl\/point_types.h>\n#include <pcl\/io\/pcd_io.h>\n#include <pcl\/search\/search.h>\n#include <pcl\/search\/kdtree.h>\n#include <pcl\/features\/normal_3d.h>\n#include <pcl\/visualization\/cloud_viewer.h>\n#include <pcl\/filters\/passthrough.h>\n#include <pcl\/segmentation\/region_growing.h>\n#include <pcl\/console\/print.h>\n#include <pcl\/console\/parse.h>\n#include <pcl\/console\/time.h>\n#include <windows.h>\n#include <stdio.h>\n#include <psapi.h>\nvoid PrintMemoryInfo( )\n{\n\tHANDLE hProcess;\n\tPROCESS_MEMORY_COUNTERS pmc;\n\n\thProcess=GetCurrentProcess();\n\tprintf( \"\\nProcess ID: %u\\n\", hProcess );\n\n\t\/\/ Print information about the memory usage of the process.\n\t\/\/\u8f93\u51fa\u8fdb\u7a0b\u4f7f\u7528\u7684\u5185\u5b58\u4fe1\u606f\n \n\tif (NULL == hProcess)\n\t\treturn;\n\n\tif ( GetProcessMemoryInfo( hProcess, &pmc, sizeof(pmc)) )\n\t{\n\t\tprintf( \"\\tPageFaultCount: 0x%08X\\n\", pmc.PageFaultCount );\n\t\tprintf( \"\\tPeakWorkingSetSize: 0x%08X\\n\", \n\t\t\t\t pmc.PeakWorkingSetSize );\n\t\tprintf( \"\\tWorkingSetSize: 0x%08X\\n\", pmc.WorkingSetSize );\n\t\tprintf( \"\\tQuotaPeakPagedPoolUsage: 0x%08X\\n\", \n\t\t\t\t pmc.QuotaPeakPagedPoolUsage );\n\t\tprintf( \"\\tQuotaPagedPoolUsage: 0x%08X\\n\", \n\t\t\t\t pmc.QuotaPagedPoolUsage );\n\t\tprintf( \"\\tQuotaPeakNonPagedPoolUsage: 0x%08X\\n\", \n\t\t\t\t pmc.QuotaPeakNonPagedPoolUsage );\n\t\tprintf( \"\\tQuotaNonPagedPoolUsage: 0x%08X\\n\", \n\t\t\t\t pmc.QuotaNonPagedPoolUsage );\n\t\tprintf( \"\\tPagefileUsage: 0x%08X\\n\", pmc.PagefileUsage ); \n\t\tprintf( \"\\tPeakPagefileUsage: 0x%08X\\n\", \n\t\t\t\t pmc.PeakPagefileUsage );\n\t}\n\n\tCloseHandle( hProcess );\n}\n\nusing namespace pcl::console;\nint\nmain (int argc, char** argv)\n{\n\n\tif(argc<2)\n\t{\n\t\tstd::cout<<\".exe xx.pcd -kn 50 -bc 0 -fc 10.0 -nc 0 -st 30 -ct 0.05\"<<endl;\n\n\t\treturn 0;\n\t}\/\/\u5982\u679c\u8f93\u5165\u53c2\u6570\u5c0f\u4e8e1\u4e2a\uff0c\u8f93\u51fa\u63d0\u793a\n\ttime_t start,end,diff[5],option;\n\tstart = time(0); \n\tint KN_normal=50; \/\/\u8bbe\u7f6e\u9ed8\u8ba4\u8f93\u5165\u53c2\u6570\n\tbool Bool_Cuting=false;\/\/\u8bbe\u7f6e\u9ed8\u8ba4\u8f93\u5165\u53c2\u6570\n\tfloat far_cuting=10,near_cuting=0,SmoothnessThreshold=30.0,CurvatureThreshold=0.05;\/\/\u8bbe\u7f6e\u9ed8\u8ba4\u8f93\u5165\u53c2\u6570\n\tparse_argument (argc, argv, \"-kn\", KN_normal);\n\tparse_argument (argc, argv, \"-bc\", Bool_Cuting);\n\tparse_argument (argc, argv, \"-fc\", far_cuting);\n\tparse_argument (argc, argv, \"-nc\", near_cuting);\n\tparse_argument (argc, argv, \"-st\", SmoothnessThreshold);\n\tparse_argument (argc, argv, \"-ct\", CurvatureThreshold);\/\/\u8bbe\u7f6e\u8f93\u5165\u53c2\u6570\u65b9\u5f0f\n\tpcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);\n\tif ( pcl::io::loadPCDFile <pcl::PointXYZ> (argv[1], *cloud) == -1)\n\t{\n\t\tstd::cout << \"Cloud reading failed.\" << std::endl;\n\t\treturn (-1);\n\t}\/\/ \u52a0\u8f7d\u8f93\u5165\u70b9\u4e91\u6570\u636e\n\tend = time(0); \n\tdiff[0] = difftime (end, start); \n\tPCL_INFO (\"\\Loading pcd file takes(seconds): %d\\n\", diff[0]); \n\t\/\/Noraml estimation step(1 parameter)\n\tpcl::search::Search<pcl::PointXYZ>::Ptr tree = boost::shared_ptr<pcl::search::Search<pcl::PointXYZ> > (new pcl::search::KdTree<pcl::PointXYZ>);\/\/\u521b\u5efa\u4e00\u4e2a\u6307\u5411kd\u6811\u641c\u7d22\u5bf9\u8c61\u7684\u5171\u4eab\u6307\u9488\n\tpcl::PointCloud <pcl::Normal>::Ptr normals (new pcl::PointCloud <pcl::Normal>);\n\tpcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normal_estimator;\/\/\u521b\u5efa\u6cd5\u7ebf\u4f30\u8ba1\u5bf9\u8c61\n\tnormal_estimator.setSearchMethod (tree);\/\/\u8bbe\u7f6e\u641c\u7d22\u65b9\u6cd5\n\tnormal_estimator.setInputCloud (cloud);\/\/\u8bbe\u7f6e\u6cd5\u7ebf\u4f30\u8ba1\u5bf9\u8c61\u8f93\u5165\u70b9\u96c6\n\tnormal_estimator.setKSearch (KN_normal);\/\/ \u8bbe\u7f6e\u7528\u4e8e\u6cd5\u5411\u91cf\u4f30\u8ba1\u7684k\u8fd1\u90bb\u6570\u76ee\n\tnormal_estimator.compute (*normals);\/\/\u8ba1\u7b97\u5e76\u8f93\u51fa\u6cd5\u5411\u91cf\n\tend = time(0); \n\tdiff[1] = difftime (end, start)-diff[0]; \n\tPCL_INFO (\"\\Estimating normal takes(seconds): %d\\n\", diff[1]); \n\t\/\/optional step: cutting the part are far from the orignal point in Z direction.2 parameters\n\tpcl::IndicesPtr indices (new std::vector <int>);\/\/\u521b\u5efa\u4e00\u7ec4\u7d22\u5f15\n\tif(Bool_Cuting)\/\/\u5224\u65ad\u662f\u5426\u9700\u8981\u76f4\u901a\u6ee4\u6ce2\n\t{\n\n\t\tpcl::PassThrough<pcl::PointXYZ> pass;\/\/\u8bbe\u7f6e\u76f4\u901a\u6ee4\u6ce2\u5668\u5bf9\u8c61\n\t\tpass.setInputCloud (cloud);\/\/\u8bbe\u7f6e\u8f93\u5165\u70b9\u4e91\n\t\tpass.setFilterFieldName (\"z\");\/\/\u8bbe\u7f6e\u6307\u5b9a\u8fc7\u6ee4\u7684\u7ef4\u5ea6\n\t\tpass.setFilterLimits (near_cuting, far_cuting);\/\/\u8bbe\u7f6e\u6307\u5b9a\u7eac\u5ea6\u8fc7\u6ee4\u7684\u8303\u56f4\n\t\tpass.filter (*indices);\/\/\u6267\u884c\u6ee4\u6ce2\uff0c\u4fdd\u5b58\u6ee4\u6ce2\u7ed3\u679c\u5728\u4e0a\u8ff0\u7d22\u5f15\u4e2d\n\t}\n\n\n\t\/\/ \u533a\u57df\u751f\u957f\u7b97\u6cd5\u76845\u4e2a\u53c2\u6570\n\tpcl::RegionGrowing<pcl::PointXYZ, pcl::Normal> reg;\/\/\u521b\u5efa\u533a\u57df\u751f\u957f\u5206\u5272\u5bf9\u8c61\n\treg.setMinClusterSize (50);\/\/\u8bbe\u7f6e\u4e00\u4e2a\u805a\u7c7b\u9700\u8981\u7684\u6700\u5c0f\u70b9\u6570\n\treg.setMaxClusterSize (1000000);\/\/\u8bbe\u7f6e\u4e00\u4e2a\u805a\u7c7b\u9700\u8981\u7684\u6700\u5927\u70b9\u6570\n\treg.setSearchMethod (tree);\/\/\u8bbe\u7f6e\u641c\u7d22\u65b9\u6cd5\n\treg.setNumberOfNeighbours (30);\/\/\u8bbe\u7f6e\u641c\u7d22\u7684\u4e34\u8fd1\u70b9\u6570\u76ee\n\treg.setInputCloud (cloud);\/\/\u8bbe\u7f6e\u8f93\u5165\u70b9\u4e91\n\tif(Bool_Cuting)reg.setIndices (indices);\/\/\u901a\u8fc7\u8f93\u5165\u53c2\u6570\u8bbe\u7f6e\uff0c\u786e\u5b9a\u662f\u5426\u8f93\u5165\u70b9\u4e91\u7d22\u5f15\n\treg.setInputNormals (normals);\/\/\u8bbe\u7f6e\u8f93\u5165\u70b9\u4e91\u7684\u6cd5\u5411\u91cf\n\treg.setSmoothnessThreshold (SmoothnessThreshold \/ 180.0 * M_PI);\/\/\u8bbe\u7f6e\u5e73\u6ed1\u9608\u503c\n\treg.setCurvatureThreshold (CurvatureThreshold);\/\/\u8bbe\u7f6e\u66f2\u7387\u9608\u503c\n\n\tstd::vector <pcl::PointIndices> clusters;\n\treg.extract (clusters);\/\/\u83b7\u53d6\u805a\u7c7b\u7684\u7ed3\u679c\uff0c\u5206\u5272\u7ed3\u679c\u4fdd\u5b58\u5728\u70b9\u4e91\u7d22\u5f15\u7684\u5411\u91cf\u4e2d\u3002\n\tend = time(0); \n\tdiff[2] = difftime (end, start)-diff[0]-diff[1]; \n\tPCL_INFO (\"\\Region growing takes(seconds): %d\\n\", diff[2]); \n\n\tstd::cout << \"Number of clusters is equal to \" << clusters.size () << std::endl;\/\/\u8f93\u51fa\u805a\u7c7b\u7684\u6570\u91cf\n\tstd::cout << \"First cluster has \" << clusters[0].indices.size () << \" points.\" << endl;\/\/\u8f93\u51fa\u7b2c\u4e00\u4e2a\u805a\u7c7b\u7684\u6570\u91cf\n\tstd::cout << \"These are the indices of the points of the initial\" <<\n\t\tstd::endl << \"cloud that belong to the first cluster:\" << std::endl;\n\t\/* int counter = 0;\n\twhile (counter < clusters[0].indices.size ())\n\t{\n\tstd::cout << clusters[0].indices[counter] << \", \";\n\tcounter++;\n\tif (counter % 10 == 0)\n\tstd::cout << std::endl;\n\t}\n\tstd::cout << std::endl;\n\t*\/\n\tPrintMemoryInfo();\n\tpcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud = reg.getColoredCloud ();\n\tpcl::visualization::CloudViewer viewer (\"\u533a\u57df\u589e\u957f\u5206\u5272\u65b9\u6cd5\");\n\tviewer.showCloud(colored_cloud);\n\twhile (!viewer.wasStopped ())\n\t{\n\t}\/\/\u8fdb\u884c\u53ef\u89c6\u5316\n\n\treturn (0);\n}<\/code><\/pre>\n
\u4ee3\u7801\u5206\u6790<\/h2>\n
\u7136\u540e\u8bbe\u7f6e\u6700\u5c0f\u548c\u6700\u5927\u96c6\u7fa4\u5927\u5c0f\u3002\u8fd9\u610f\u5473\u7740\u5728\u5206\u5272\u5b8c\u6210\u540e\uff0c\u6240\u6709\u70b9\u5c0f\u4e8e\u6700\u5c0f\u503c(\u6216\u5927\u4e8e\u6700\u5927\u503c)\u7684\u805a\u7c7b\u5c06\u88ab\u4e22\u5f03\u3002\u6700\u5c0f\u503c\u548c\u6700\u5927\u503c\u7684\u9ed8\u8ba4\u503c\u5206\u522b\u4e3a1\u548c\u201c\u5c3d\u53ef\u80fd\u591a\u201d\u3002<\/p>\n
\u7b97\u6cd5\u5728\u5185\u90e8\u7ed3\u6784\u4e2d\u9700\u8981K\u6700\u8fd1\u90bb\u641c\u7d22\uff0c\u6240\u4ee5\u8fd9\u91cc\u662f\u63d0\u4f9b\u641c\u7d22\u65b9\u6cd5\u5e76\u8bbe\u7f6e\u90bb\u5c45\u6570\u91cf\u7684\u5730\u65b9\u3002\u4e4b\u540e\uff0c\u5b83\u63a5\u6536\u5230\u5fc5\u987b\u5206\u5272\u7684\u70b9\u4e91\u3001\u70b9\u4e0b\u6807\u548c\u6cd5\u7ebf\u3002<\/p>\n
pcl::RegionGrowing<pcl::PointXYZ, pcl::Normal> reg;\n reg.setMinClusterSize (50);\n reg.setMaxClusterSize (1000000);\n reg.setSearchMethod (tree);\n reg.setNumberOfNeighbours (30);\n reg.setInputCloud (cloud);\n \/\/reg.setIndices (indices);\n reg.setInputNormals (normals);<\/code><\/pre>\n
\u8fd9\u4e24\u884c\u662f\u7b97\u6cd5\u521d\u59cb\u5316\u4e2d\u6700\u91cd\u8981\u7684\u90e8\u5206\uff0c\u56e0\u4e3a\u5b83\u4eec\u8d1f\u8d23\u4e0a\u8ff0\u7684\u5e73\u6ed1\u7ea6\u675f\u3002\u7b2c\u4e00\u79cd\u65b9\u6cd5\u4ee5\u5f27\u5ea6\u4e3a\u5355\u4f4d\u8bbe\u7f6e\u89d2\u5ea6\uff0c\u4f5c\u4e3a\u6cd5\u5411\u504f\u5dee\u7684\u5141\u8bb8\u8303\u56f4\u3002\u5982\u679c\u70b9\u4e4b\u95f4\u7684\u6cd5\u7ebf\u504f\u5dee\u5c0f\u4e8e\u5e73\u6ed1\u9608\u503c\uff0c\u90a3\u4e48\u5efa\u8bae\u5b83\u4eec\u5728\u540c\u4e00\u7c07\u4e2d(\u65b0\u7684\u70b9-\u88ab\u6d4b\u8bd5\u7684\u70b9-\u5c06\u88ab\u6dfb\u52a0\u5230\u7c07\u4e2d)\u3002\u7b2c\u4e8c\u4e2a\u662f\u66f2\u7387\u9608\u503c\u3002\u5982\u679c\u4e24\u70b9\u6709\u4e00\u4e2a\u5c0f\u7684\u6cd5\u5411\u504f\u5dee\uff0c\u90a3\u4e48\u5b83\u4eec\u4e4b\u95f4\u7684\u66f2\u7387\u5dee\u88ab\u6d4b\u8bd5\u3002<\/p>\n
reg.setSmoothnessThreshold (3.0 \/ 180.0 * M_PI);\n reg.setCurvatureThreshold (1.0);<\/code><\/pre>\n
RegionGrowing\u7c7b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u8fd4\u56de\u5f69\u8272\u4e91\u7684\u65b9\u6cd5\uff0c\u5176\u4e2d\u6bcf\u4e2a\u96c6\u7fa4\u90fd\u6709\u81ea\u5df1\u7684\u989c\u8272\u3002\u56e0\u6b64\uff0c\u5728\u8fd9\u90e8\u5206\u4ee3\u7801\u4e2d\uff0c\u5b9e\u4f8b\u5316pcl::visualization::CloudViewer\u4ee5\u67e5\u770b\u5206\u5272\u7684\u7ed3\u679c\u2014\u2014\u76f8\u540c\u989c\u8272\u7684\u4e91 <\/p>\n
pcl::PointCloud <pcl::PointXYZRGB>::Ptr colored_cloud = reg.getColoredCloud ();\n pcl::visualization::CloudViewer viewer (\"Cluster viewer\");\n viewer.showCloud(colored_cloud);\n while (!viewer.wasStopped ())\n {\n }\n\n return (0);\n}<\/code><\/pre>\n
\u5b9e\u9a8c\u7ed3\u679c<\/h2>\n
\u539f\u59cb\u70b9\u4e91\uff1a<\/p>\n
<\/p>\n
\u4f7f\u7528\u533a\u57df\u751f\u957f\u7b97\u6cd5\u5206\u5272\u540e\u7684\u70b9\u4e91\uff08\u6bcf\u79cd\u989c\u8272\u4ee3\u8868\u4e00\u4e2a\u805a\u7c7b\uff09\uff1a<\/p>\n
<\/p>\n
\u5728\u6700\u540e\u4e00\u5f20\u56fe\u7247\u4e2d\uff0c\u4f60\u53ef\u4ee5\u770b\u5230\u5f69\u8272\u4e91\u6709\u8bb8\u591a\u7ea2\u70b9<\/strong>\u3002\u8fd9\u610f\u5473\u7740\u8fd9\u4e9b\u70b9\u5c5e\u4e8e\u88ab\u62d2\u7edd\u7684\u805a\u7c7b\uff0c\u56e0\u4e3a\u5b83\u4eec\u6709\u592a\u591a\/\u592a\u5c11\u7684\u70b9\u3002<\/p>\n
\u4f7f\u7528\u547d\u4ee4\u884c\u8fdb\u884c\u8f93\u5165\uff1a <\/p>\n
\nD:\\PCLProject\\pcl-project\\pcl_segmentation\\4_region_growing_segmentation\\cmake_bin\\Release>region_growing_segmentation.exe pig1.pcd -kn 50 -bc 0 -fc 10.0 -nc 0 -st 30 -ct 0.05
Loading pcd file takes(seconds): 0
Estimating normal takes(seconds): 1
Region growing takes(seconds): 0
Number of clusters is equal to 141
First cluster has 136600 points.
These are the indices of the points of the initial
cloud that belong to the first cluster:<\/p>\nProcess ID: 4294967295
PageFaultCount: 0x00004A9E
PeakWorkingSetSize: 0x03A69000
WorkingSetSize: 0x03A68000
QuotaPeakPagedPoolUsage: 0x0002DD40
QuotaPagedPoolUsage: 0x0002D5B8
QuotaPeakNonPagedPoolUsage: 0x00003508
QuotaNonPagedPoolUsage: 0x00003480
PagefileUsage: 0x03427000
PeakPagefileUsage: 0x03427000<\/p>\n<\/blockquote>\n\u5176\u4ed6\u6570\u636e\u7ed3\u679c<\/h3>\n
\u539f\u59cb\u70b9\u4e91\uff1a<\/p>\n
<\/p>\n<\/p>\n
\u5904\u7406\u4e4b\u540e\u7684\u70b9\u4e91\uff1a<\/p>\n
<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"\u70b9\u4e91\u5b9e\u4f8b\u5206\u5272_\u70b9\u4e91\u5206\u5272\u7684\u4e94\u79cd\u65b9\u6cd5Inputs:Pointcloud=Pointnormals=Pointscurvatures=NeighbourfindingfunctionCurvaturethres...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8796"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8796"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8796\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8796"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}