reshape continuous clouds for better performance.
authorAnatoly Baksheev <no@email>
Fri, 12 Jul 2013 19:59:19 +0000 (23:59 +0400)
committerAnatoly Baksheev <no@email>
Fri, 12 Jul 2013 19:59:19 +0000 (23:59 +0400)
modules/viz/src/simple_widgets.cpp

index 9386c85..d9184d3 100644 (file)
@@ -635,7 +635,12 @@ temp_viz::CloudWidget::CloudWidget(InputArray _cloud, InputArray _colors)
     Mat colors = _colors.getMat();
     CV_Assert(cloud.type() == CV_32FC3 || cloud.type() == CV_64FC3 || cloud.type() == CV_32FC4 || cloud.type() == CV_64FC4);
     CV_Assert(colors.type() == CV_8UC3 && cloud.size() == colors.size());
-    
+
+    if (cloud.isContinuous() && colors.isContinuous())
+    {
+        cloud.reshape(cloud.channels(), 1);
+        colors.reshape(colors.channels(), 1);
+    }
 
     vtkIdType nr_points;
     vtkSmartPointer<vtkPolyData> polydata = CreateCloudWidget::create(cloud, nr_points);