chenhongjiang 2 years ago
parent
commit
cb15185c38
4 changed files with 44 additions and 3 deletions
  1. 2 1
      ReadMe.txt
  2. 40 1
      grab_point_rs.cpp
  3. 1 0
      grab_point_rs.h
  4. 1 1
      graft_cv_api.cpp

+ 2 - 1
ReadMe.txt

@@ -74,4 +74,5 @@ v0.6.2 
 v0.6.3 增加茄科切后识别接口及功能(同一个接口支持砧木和穗苗)
 v0.6.4 增加算法参数读取文件进行更新的接口
 v0.6.5 修改代码,得到最左侧一株
-v0.6.6 增加剪裁后没有点的异常处理
+v0.6.6 增加剪裁后没有点的异常处理
+v0.6.7 修改点云显示代码,显示抓取点xy方向,及z平面上的xoy坐标系

+ 40 - 1
grab_point_rs.cpp

@@ -223,7 +223,8 @@ namespace graft_cv {
 			cloud_cand_demo->push_back(pt_grab);
 
 
-			viewer_cloud(cloud_cand_demo, std::string("cloud_cand_demo"));
+			//viewer_cloud(cloud_cand_demo, std::string("cloud_cand_demo"));
+			viewer_cloud_debug(cloud_cand_demo, selected_pt, std::string("cloud_cand_demo"));
 		}
 		return 0;
 	}
@@ -623,5 +624,43 @@ namespace graft_cv {
 			boost::this_thread::sleep(boost::posix_time::microseconds(100000));
 		}
 	}
+	void CRootStockGrabPoint::viewer_cloud_debug(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, pcl::PointXYZ &p, std::string&winname)
+	{
+		pcl::visualization::PCLVisualizer viewer(winname);
+		//viewer.runOnVisualizationThreadOnce(viewerOneOff);	
+		viewer.addPointCloud(cloud);
+		viewer.addCoordinateSystem();
+		pcl::PointXYZ p0, x1, y1,p00,x0,y0;
+		p0.x = p.x;
+		p0.y = p.y;
+		p0.z = p.z;
+		x1.x = p.x + 400.0;
+		x1.y = p.y;
+		x1.z = p.z;
+		y1.x = p.x;
+		y1.y = p.y + 200.0;
+		y1.z = p.z;
+
+		p00.x = 0.0;
+		p00.y = 0.0;
+		p00.z = p.z;
+		x0.x = 600.0;
+		x0.y = 0;
+		x0.z = p.z;
+		y0.x = 0.0;
+		y0.y = 300.0;
+		y0.z = p.z;
+
+		viewer.addLine(p0, x1, 255, 0, 0, "x");
+		viewer.addLine(p0, y1, 0, 255, 0, "y");
+
+		viewer.addLine(p00, x0, 255, 0, 0, "x0");
+		viewer.addLine(p00, y0, 0, 255, 0, "y0");
+
+		while (!viewer.wasStopped()) {
+			viewer.spinOnce(100);
+ 			boost::this_thread::sleep(boost::posix_time::microseconds(100000));
+		}
+	}
 
 };

+ 1 - 0
grab_point_rs.h

@@ -57,6 +57,7 @@ namespace graft_cv {
 
 		void viewer_cloud(pcl::PointCloud<pcl::PointXYZ>::Ptr, std::string&winname);
 		void viewer_cloud(pcl::PointCloud<pcl::PointXYZRGB>::Ptr, std::string&winname);
+		void viewer_cloud_debug(pcl::PointCloud<pcl::PointXYZRGB>::Ptr cloud, pcl::PointXYZ&p, std::string&winname);
 	};
 
 };

+ 1 - 1
graft_cv_api.cpp

@@ -19,7 +19,7 @@ extern CRITICAL_SECTION g_cs;
 namespace graft_cv
 {
 
-	char *g_version_str = "0.6.6";
+	char *g_version_str = "0.6.7";
 
 	//configure
 	string g_conf_file = "./gcv_conf.yml";