showPointCloud with single color
authorozantonkal <ozantonkal@gmail.com>
Wed, 12 Jun 2013 08:55:07 +0000 (10:55 +0200)
committerozantonkal <ozantonkal@gmail.com>
Wed, 12 Jun 2013 08:55:07 +0000 (10:55 +0200)
modules/viz/include/opencv2/viz/viz3d.hpp
modules/viz/src/q/viz3d_impl.hpp
modules/viz/src/viz3d.cpp
modules/viz/src/viz3d_impl.cpp

index 046b9dc..d7e4707 100644 (file)
@@ -28,6 +28,7 @@ namespace temp_viz
         void addCoordinateSystem(double scale, const Affine3f& t, const String &id = "coordinate");
 
         void showPointCloud(const String& id, InputArray cloud, InputArray colors, const Affine3f& pose = Affine3f::Identity());
+        void showPointCloud(const String& id, InputArray cloud, const Color& color, const Affine3f& pose = Affine3f::Identity());
 
         bool addPointCloudNormals (const Mat &cloud, const Mat& normals, int level = 100, float scale = 0.02f, const String &id = "cloud");
 
index bf67701..7afa86a 100644 (file)
@@ -104,6 +104,7 @@ public:
       * \param[in] pose transform to be applied on the point cloud
       */
     void showPointCloud(const String& id, InputArray cloud, InputArray colors, const Affine3f& pose = Affine3f::Identity());
+    void showPointCloud(const String& id, InputArray cloud, const Color& color, const Affine3f& pose = Affine3f::Identity());
 
     bool addPolygonMesh (const Mesh3d& mesh, const cv::Mat& mask, const std::string &id = "polygon");
     bool updatePolygonMesh (const Mesh3d& mesh, const cv::Mat& mask, const std::string &id = "polygon");
index 2047c09..dfade99 100644 (file)
@@ -28,6 +28,11 @@ void temp_viz::Viz3d::showPointCloud(const String& id, InputArray cloud, InputAr
     impl_->showPointCloud(id, cloud, colors, pose);
 }
 
+void temp_viz::Viz3d::showPointCloud(const String& id, InputArray cloud, const Color& color, const Affine3f& pose)
+{
+    impl_->showPointCloud(id, cloud, color, pose);
+}
+
 bool temp_viz::Viz3d::addPointCloudNormals (const Mat &cloud, const Mat& normals, int level, float scale, const String& id)
 {
     return impl_->addPointCloudNormals(cloud, normals, level, scale, id);
index 1ad0678..2ee07ff 100644 (file)
@@ -114,7 +114,7 @@ void temp_viz::Viz3d::VizImpl::showPointCloud(const String& id, InputArray _clou
     vtkSmartPointer<vtkIdTypeArray> cells = vertices->GetData ();
 
     if (exist)
-        updateCells(cells, initcells, nr_points);
+        updateCells (cells, initcells, nr_points);
     else
         updateCells (cells, am_it->second.cells, nr_points);
 
@@ -166,6 +166,13 @@ void temp_viz::Viz3d::VizImpl::showPointCloud(const String& id, InputArray _clou
     }
 }
 
+void temp_viz::Viz3d::VizImpl::showPointCloud(const String& id, InputArray _cloud, const Color& color, const Affine3f& pose)
+{
+    // Generate an array of colors from single color
+    Mat colors(_cloud.size(), CV_8UC3, color);
+    showPointCloud(id, _cloud, colors, pose);
+}
+
 bool temp_viz::Viz3d::VizImpl::addPointCloudNormals (const cv::Mat &cloud, const cv::Mat& normals, int level, float scale, const std::string &id)
 {
     CV_Assert(cloud.size() == normals.size() && cloud.type() == CV_32FC3 && normals.type() == CV_32FC3);