updated code to use mapper->SetInput instead of SetInputConnection. All widgets except plane, images ans texts
This commit is contained in:
parent
a3b1f29d23
commit
0d702b83f4
modules
core/include/opencv2/core
viz
@ -113,6 +113,8 @@ namespace cv
|
||||
|
||||
template <typename Y> operator Affine3<Y>() const;
|
||||
|
||||
template <typename Y> Affine3<Y> cast() const;
|
||||
|
||||
Mat4 matrix;
|
||||
|
||||
#if defined EIGEN_WORLD_VERSION && defined EIGEN_GEOMETRY_MODULE_H
|
||||
@ -421,6 +423,12 @@ cv::Affine3<T>::operator Affine3<Y>() const
|
||||
return Affine3<Y>(matrix);
|
||||
}
|
||||
|
||||
template<typename T> template <typename Y> inline
|
||||
cv::Affine3<Y> cv::Affine3<T>::cast() const
|
||||
{
|
||||
return Affine3<Y>(matrix);
|
||||
}
|
||||
|
||||
template<typename T> inline
|
||||
cv::Affine3<T> cv::operator*(const cv::Affine3<T>& affine1, const cv::Affine3<T>& affine2)
|
||||
{
|
||||
|
@ -41,9 +41,6 @@
|
||||
// * Ozan Tonkal, ozantonkal@gmail.com
|
||||
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
|
||||
//
|
||||
// OpenCV Viz module is complete rewrite of
|
||||
// PCL visualization module (www.pointclouds.org)
|
||||
//
|
||||
//M*/
|
||||
|
||||
#ifndef __OPENCV_VIZ_HPP__
|
||||
|
@ -54,9 +54,10 @@ cv::viz::WCloud::WCloud(InputArray cloud, InputArray colors)
|
||||
|
||||
vtkSmartPointer<vtkCloudMatSource> cloud_source = vtkSmartPointer<vtkCloudMatSource>::New();
|
||||
cloud_source->SetColorCloud(cloud, colors);
|
||||
cloud_source->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(cloud_source->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, cloud_source->GetOutput());
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
mapper->ImmediateModeRenderingOff();
|
||||
mapper->SetScalarRange(0, 255);
|
||||
@ -74,9 +75,10 @@ cv::viz::WCloud::WCloud(InputArray cloud, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkCloudMatSource> cloud_source = vtkSmartPointer<vtkCloudMatSource>::New();
|
||||
cloud_source->SetCloud(cloud);
|
||||
cloud_source->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(cloud_source->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, cloud_source->GetOutput());
|
||||
mapper->ImmediateModeRenderingOff();
|
||||
mapper->ScalarVisibilityOff();
|
||||
|
||||
@ -127,15 +129,11 @@ void cv::viz::WCloudCollection::addCloud(InputArray cloud, InputArray colors, co
|
||||
{
|
||||
// This is the first cloud
|
||||
mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
mapper->SetInput(polydata);
|
||||
#else
|
||||
mapper->SetInputData(polydata);
|
||||
#endif
|
||||
mapper->SetScalarRange(0, 255);
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
mapper->ScalarVisibilityOn();
|
||||
mapper->ImmediateModeRenderingOff();
|
||||
VtkUtils::SetInputData(mapper, polydata);
|
||||
|
||||
actor->SetNumberOfCloudPoints(std::max(1, polydata->GetNumberOfPoints()/10));
|
||||
actor->GetProperty()->SetInterpolationToFlat();
|
||||
@ -147,16 +145,12 @@ void cv::viz::WCloudCollection::addCloud(InputArray cloud, InputArray colors, co
|
||||
vtkPolyData *currdata = vtkPolyData::SafeDownCast(mapper->GetInput());
|
||||
CV_Assert("Cloud Widget without data" && currdata);
|
||||
|
||||
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
appendFilter->AddInput(currdata);
|
||||
appendFilter->AddInput(polydata);
|
||||
mapper->SetInput(appendFilter->GetOutput());
|
||||
#else
|
||||
appendFilter->AddInputData(currdata);
|
||||
appendFilter->AddInputData(polydata);
|
||||
mapper->SetInputData(appendFilter->GetOutput());
|
||||
#endif
|
||||
vtkSmartPointer<vtkAppendPolyData> append_filter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
append_filter->AddInputConnection(currdata->GetProducerPort());
|
||||
append_filter->AddInputConnection(polydata->GetProducerPort());
|
||||
append_filter->Update();
|
||||
|
||||
VtkUtils::SetInputData(mapper, append_filter->GetOutput());
|
||||
|
||||
actor->SetNumberOfCloudPoints(std::max(1, actor->GetNumberOfCloudPoints() + polydata->GetNumberOfPoints()/10));
|
||||
}
|
||||
@ -245,11 +239,7 @@ cv::viz::WCloudNormals::WCloudNormals(InputArray _cloud, InputArray _normals, in
|
||||
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
||||
mapper->SetColorModeToMapScalars();
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
mapper->SetInput(polyData);
|
||||
#else
|
||||
mapper->SetInputData(polyData);
|
||||
#endif
|
||||
VtkUtils::SetInputData(mapper, polyData);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -326,11 +316,7 @@ cv::viz::WMesh::WMesh(const Mesh3d &mesh)
|
||||
vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
mapper->ImmediateModeRenderingOff();
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
mapper->SetInput(polydata);
|
||||
#else
|
||||
mapper->SetInputData(polydata);
|
||||
#endif
|
||||
VtkUtils::SetInputData(mapper, polydata);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
//actor->SetNumberOfCloudPoints(std::max(1, polydata->GetNumberOfPoints() / 10));
|
||||
|
@ -564,7 +564,6 @@ void cv::viz::InteractorStyle::OnLeftButtonUp()
|
||||
void cv::viz::InteractorStyle::OnMiddleButtonDown()
|
||||
{
|
||||
Vec2i p(Interactor->GetEventPosition());
|
||||
|
||||
MouseEvent::Type type = (Interactor->GetRepeatCount() == 0) ? MouseEvent::MouseButtonPress : MouseEvent::MouseDblClick;
|
||||
MouseEvent event(type, MouseEvent::MiddleButton, p, getModifiers());
|
||||
if (mouseCallback_)
|
||||
@ -586,7 +585,6 @@ void cv::viz::InteractorStyle::OnMiddleButtonUp()
|
||||
void cv::viz::InteractorStyle::OnRightButtonDown()
|
||||
{
|
||||
Vec2i p(Interactor->GetEventPosition());
|
||||
|
||||
MouseEvent::Type type = (Interactor->GetRepeatCount() == 0) ? MouseEvent::MouseButtonPress : MouseEvent::MouseDblClick;
|
||||
MouseEvent event(type, MouseEvent::RightButton, p, getModifiers());
|
||||
if (mouseCallback_)
|
||||
|
@ -52,9 +52,10 @@ cv::viz::WLine::WLine(const Point3d &pt1, const Point3d &pt2, const Color &color
|
||||
vtkSmartPointer<vtkLineSource> line = vtkSmartPointer<vtkLineSource>::New();
|
||||
line->SetPoint1(pt1.x, pt1.y, pt1.z);
|
||||
line->SetPoint2(pt2.x, pt2.y, pt2.z);
|
||||
line->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(line->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, line->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -153,9 +154,10 @@ cv::viz::WSphere::WSphere(const Point3d ¢er, double radius, int sphere_resol
|
||||
sphere->SetPhiResolution(sphere_resolution);
|
||||
sphere->SetThetaResolution(sphere_resolution);
|
||||
sphere->LatLongTessellationOff();
|
||||
sphere->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(sphere->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, sphere->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -203,9 +205,10 @@ cv::viz::WArrow::WArrow(const Point3d& pt1, const Point3d& pt2, double thickness
|
||||
vtkSmartPointer<vtkTransformPolyDataFilter> transformPD = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
|
||||
transformPD->SetTransform(transform);
|
||||
transformPD->SetInputConnection(arrowSource->GetOutputPort());
|
||||
transformPD->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(transformPD->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, transformPD->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -239,9 +242,10 @@ cv::viz::WCircle::WCircle(const Point3d& pt, double radius, double thickness, co
|
||||
vtkSmartPointer<vtkTransformPolyDataFilter> tf = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
|
||||
tf->SetTransform(t);
|
||||
tf->SetInputConnection(disk->GetOutputPort());
|
||||
tf->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(tf->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, tf->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -270,9 +274,10 @@ cv::viz::WCylinder::WCylinder(const Point3d& pt_on_axis, const Point3d& axis_dir
|
||||
tuber->SetInputConnection(line->GetOutputPort());
|
||||
tuber->SetRadius(radius);
|
||||
tuber->SetNumberOfSides(numsides);
|
||||
tuber->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(tuber->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, tuber->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -292,19 +297,21 @@ template<> cv::viz::WCylinder cv::viz::Widget::cast<cv::viz::WCylinder>()
|
||||
|
||||
cv::viz::WCube::WCube(const Point3d& pt_min, const Point3d& pt_max, bool wire_frame, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
vtkSmartPointer<vtkPolyDataAlgorithm> cube;
|
||||
if (wire_frame)
|
||||
{
|
||||
vtkSmartPointer<vtkOutlineSource> cube = vtkSmartPointer<vtkOutlineSource>::New();
|
||||
cube->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
|
||||
mapper->SetInputConnection(cube->GetOutputPort());
|
||||
cube = vtkSmartPointer<vtkOutlineSource>::New();
|
||||
vtkOutlineSource::SafeDownCast(cube)->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
vtkSmartPointer<vtkCubeSource> cube = vtkSmartPointer<vtkCubeSource>::New();
|
||||
cube->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
|
||||
mapper->SetInputConnection(cube->GetOutputPort());
|
||||
cube = vtkSmartPointer<vtkCubeSource>::New();
|
||||
vtkCubeSource::SafeDownCast(cube)->SetBounds(pt_min.x, pt_max.x, pt_min.y, pt_max.y, pt_min.z, pt_max.z);
|
||||
}
|
||||
cube->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
VtkUtils::SetInputData(mapper, cube->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -345,6 +352,7 @@ cv::viz::WCoordinateSystem::WCoordinateSystem(double scale)
|
||||
tube_filter->SetInputConnection(polydata->GetProducerPort());
|
||||
tube_filter->SetRadius(axes->GetScaleFactor() / 50.0);
|
||||
tube_filter->SetNumberOfSides(6);
|
||||
tube_filter->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
@ -400,7 +408,7 @@ cv::viz::WPolyLine::WPolyLine(InputArray _points, const Color &color)
|
||||
polydata->GetPointData()->SetScalars(scalars);
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(polydata->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, polydata);
|
||||
mapper->SetScalarRange(0, 255);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
@ -449,7 +457,7 @@ cv::viz::WGrid::WGrid(const Vec2i &dimensions, const Vec2d &spacing, const Color
|
||||
vtkSmartPointer<vtkPolyData> grid = GridUtils::createGrid(dimensions, spacing);
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(grid->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, grid);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -478,15 +486,11 @@ cv::viz::WGrid::WGrid(const Vec4d &coefs, const Vec2i &dimensions, const Vec2d &
|
||||
|
||||
vtkSmartPointer<vtkTransformPolyDataFilter> transform_filter = vtkSmartPointer<vtkTransformPolyDataFilter>::New();
|
||||
transform_filter->SetTransform(transform);
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
transform_filter->SetInputConnection(grid->GetProducerPort());
|
||||
#else
|
||||
transform_filter->SetInputData(grid);
|
||||
#endif
|
||||
transform_filter->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(transform_filter->GetOutputPort());
|
||||
VtkUtils::SetInputData(mapper, transform_filter->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -544,6 +548,7 @@ void cv::viz::WText3D::setText(const String &text)
|
||||
CV_Assert("This widget does not support text." && textSource);
|
||||
|
||||
textSource->SetText(text.c_str());
|
||||
textSource->Modified();
|
||||
textSource->Update();
|
||||
}
|
||||
|
||||
@ -620,11 +625,7 @@ cv::viz::WImageOverlay::WImageOverlay(const Mat &image, const Rect &rect)
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
// Scale the image based on the Rect
|
||||
@ -667,11 +668,7 @@ void cv::viz::WImageOverlay::setImage(const Mat &image)
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
mapper->SetInputConnection(flipFilter->GetOutputPort());
|
||||
@ -697,11 +694,7 @@ cv::viz::WImage3D::WImage3D(const Mat &image, const Size &size)
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
Vec3d plane_center(size.width * 0.5, size.height * 0.5, 0.0);
|
||||
@ -749,11 +742,7 @@ cv::viz::WImage3D::WImage3D(const Vec3d &position, const Vec3d &normal, const Ve
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
vtkSmartPointer<vtkPlaneSource> plane = vtkSmartPointer<vtkPlaneSource>::New();
|
||||
@ -809,11 +798,7 @@ void cv::viz::WImage3D::setImage(const Mat &image)
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
// Apply the texture
|
||||
@ -855,11 +840,7 @@ namespace cv { namespace viz { namespace
|
||||
// Need to flip the image as the coordinates are different in OpenCV and VTK
|
||||
vtkSmartPointer<vtkImageFlip> flipFilter = vtkSmartPointer<vtkImageFlip>::New();
|
||||
flipFilter->SetFilteredAxis(1); // Vertical flip
|
||||
#if VTK_MAJOR_VERSION <= 5
|
||||
flipFilter->SetInputConnection(vtk_image->GetProducerPort());
|
||||
#else
|
||||
flipFilter->SetInputData(vtk_image);
|
||||
#endif
|
||||
flipFilter->Update();
|
||||
|
||||
Vec3d plane_center(0.0, 0.0, scale);
|
||||
@ -958,7 +939,6 @@ namespace cv { namespace viz { namespace
|
||||
cv::viz::WCameraPosition::WCameraPosition(double scale)
|
||||
{
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
|
||||
VtkUtils::SetInputData(mapper, getPolyData(WCoordinateSystem(scale)));
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
|
||||
@ -979,7 +959,7 @@ cv::viz::WCameraPosition::WCameraPosition(const Matx33d &K, double scale, const
|
||||
vtkSmartPointer<vtkPolyData> polydata = CameraPositionUtils::createFrustrum(aspect_ratio, fovy, scale);
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(polydata->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, polydata);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -996,7 +976,7 @@ cv::viz::WCameraPosition::WCameraPosition(const Vec2d &fov, double scale, const
|
||||
vtkSmartPointer<vtkPolyData> polydata = CameraPositionUtils::createFrustrum(aspect_ratio, fovy, scale);
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(polydata->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, polydata);
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -1042,14 +1022,14 @@ template<> cv::viz::WCameraPosition cv::viz::Widget::cast<cv::viz::WCameraPositi
|
||||
|
||||
cv::viz::WTrajectory::WTrajectory(InputArray _path, int display_mode, double scale, const Color &color)
|
||||
{
|
||||
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
vtkSmartPointer<vtkAppendPolyData> append_filter = vtkSmartPointer<vtkAppendPolyData>::New();
|
||||
|
||||
// Bitwise and with 3 in order to limit the domain to 2 bits
|
||||
if (display_mode & WTrajectory::PATH)
|
||||
{
|
||||
Mat points = vtkTrajectorySource::ExtractPoints(_path);
|
||||
vtkSmartPointer<vtkPolyData> polydata = getPolyData(WPolyLine(points, color));
|
||||
appendFilter->AddInputConnection(polydata->GetProducerPort());
|
||||
append_filter->AddInputConnection(polydata->GetProducerPort());
|
||||
}
|
||||
|
||||
if (display_mode & WTrajectory::FRAMES)
|
||||
@ -1067,11 +1047,12 @@ cv::viz::WTrajectory::WTrajectory(InputArray _path, int display_mode, double sca
|
||||
tensor_glyph->SymmetricOff();
|
||||
tensor_glyph->ColorGlyphsOff();
|
||||
|
||||
appendFilter->AddInputConnection(tensor_glyph->GetOutputPort());
|
||||
append_filter->AddInputConnection(tensor_glyph->GetOutputPort());
|
||||
}
|
||||
append_filter->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
VtkUtils::SetInputData(mapper, appendFilter->GetOutput());
|
||||
VtkUtils::SetInputData(mapper, append_filter->GetOutput());
|
||||
mapper->SetScalarModeToUsePointData();
|
||||
mapper->SetScalarRange(0, 255);
|
||||
|
||||
@ -1106,10 +1087,8 @@ cv::viz::WTrajectoryFrustums::WTrajectoryFrustums(InputArray _path, const Matx33
|
||||
tensor_glyph->ColorGlyphsOff();
|
||||
tensor_glyph->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyData> polydata = tensor_glyph->GetOutput();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(polydata->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, tensor_glyph->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
@ -1134,10 +1113,8 @@ cv::viz::WTrajectoryFrustums::WTrajectoryFrustums(InputArray _path, const Vec2d
|
||||
tensor_glyph->ColorGlyphsOff();
|
||||
tensor_glyph->Update();
|
||||
|
||||
vtkSmartPointer<vtkPolyData> polydata = tensor_glyph->GetOutput();
|
||||
|
||||
vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
|
||||
mapper->SetInputConnection(polydata->GetProducerPort());
|
||||
VtkUtils::SetInputData(mapper, tensor_glyph->GetOutput());
|
||||
|
||||
vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
|
||||
actor->SetMapper(mapper);
|
||||
|
Loading…
x
Reference in New Issue
Block a user