From: Anatoly Baksheev Date: Sat, 11 Jan 2014 12:44:01 +0000 (+0400) Subject: simplification of cloud collection X-Git-Tag: accepted/tizen/6.0/unified/20201030.111113~3552^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f930f2f19d115c89efb4790f342deb4f9814af1c;p=platform%2Fupstream%2Fopencv.git simplification of cloud collection --- diff --git a/modules/viz/src/clouds.cpp b/modules/viz/src/clouds.cpp index e7759e3..9ea1d76 100644 --- a/modules/viz/src/clouds.cpp +++ b/modules/viz/src/clouds.cpp @@ -112,15 +112,8 @@ void cv::viz::WCloudCollection::addCloud(InputArray cloud, InputArray colors, co vtkSmartPointer source = vtkSmartPointer::New(); source->SetColorCloud(cloud, colors); - vtkSmartPointer transform = vtkSmartPointer::New(); - transform->SetMatrix(pose.matrix.val); + vtkSmartPointer polydata = VtkUtils::TransformPolydata(source->GetOutputPort(), pose); - vtkSmartPointer transform_filter = vtkSmartPointer::New(); - transform_filter->SetInputConnection(source->GetOutputPort()); - transform_filter->SetTransform(transform); - transform_filter->Update(); - - vtkSmartPointer polydata = transform_filter->GetOutput(); vtkSmartPointer actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this)); CV_Assert("Incompatible widget type." && actor); diff --git a/modules/viz/src/precomp.hpp b/modules/viz/src/precomp.hpp index 98de7b7..df46f70 100644 --- a/modules/viz/src/precomp.hpp +++ b/modules/viz/src/precomp.hpp @@ -256,17 +256,22 @@ namespace cv return normals_generator->GetOutput(); } - static vtkSmartPointer TransformPolydata(vtkSmartPointer polydata, const Affine3d& pose) + static vtkSmartPointer TransformPolydata(vtkSmartPointer algorithm_output_port, const Affine3d& pose) { vtkSmartPointer transform = vtkSmartPointer::New(); transform->SetMatrix(vtkmatrix(pose.matrix)); vtkSmartPointer transform_filter = vtkSmartPointer::New(); transform_filter->SetTransform(transform); - transform_filter->SetInputConnection(polydata->GetProducerPort()); + transform_filter->SetInputConnection(algorithm_output_port); transform_filter->Update(); return transform_filter->GetOutput(); } + + static vtkSmartPointer TransformPolydata(vtkSmartPointer polydata, const Affine3d& pose) + { + return TransformPolydata(polydata->GetProducerPort(), pose); + } }; } }