fixed potential crash
This commit is contained in:
parent
2705068290
commit
159de9cc47
@ -334,7 +334,7 @@ namespace cv { namespace viz { namespace
|
|||||||
return polydata;
|
return polydata;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void createMapper(vtkSmartPointer<vtkLODActor> actor, vtkSmartPointer<vtkPolyData> poly_data, Vec3d& minmax)
|
static void createMapper(vtkSmartPointer<vtkLODActor> actor, vtkSmartPointer<vtkPolyData> poly_data)
|
||||||
{
|
{
|
||||||
vtkDataSetMapper *mapper = vtkDataSetMapper::SafeDownCast(actor->GetMapper());
|
vtkDataSetMapper *mapper = vtkDataSetMapper::SafeDownCast(actor->GetMapper());
|
||||||
if (!mapper)
|
if (!mapper)
|
||||||
@ -347,7 +347,7 @@ namespace cv { namespace viz { namespace
|
|||||||
mapper_new->SetInputData(poly_data);
|
mapper_new->SetInputData(poly_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mapper_new->SetScalarRange(minmax.val);
|
mapper_new->SetScalarRange(0, 255);
|
||||||
mapper_new->SetScalarModeToUsePointData();
|
mapper_new->SetScalarModeToUsePointData();
|
||||||
|
|
||||||
bool interpolation = (poly_data && poly_data->GetNumberOfCells() != poly_data->GetNumberOfVerts());
|
bool interpolation = (poly_data && poly_data->GetNumberOfCells() != poly_data->GetNumberOfVerts());
|
||||||
@ -435,8 +435,8 @@ void cv::viz::WCloudCollection::addCloud(InputArray _cloud, InputArray _colors,
|
|||||||
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||||
CV_Assert("Incompatible widget type." && actor);
|
CV_Assert("Incompatible widget type." && actor);
|
||||||
|
|
||||||
Vec3d minmax(scalars->GetRange());
|
|
||||||
CloudCollectionUtils::createMapper(actor, transform_filter->GetOutput(), minmax);
|
CloudCollectionUtils::createMapper(actor, transform_filter->GetOutput());
|
||||||
}
|
}
|
||||||
|
|
||||||
void cv::viz::WCloudCollection::addCloud(InputArray _cloud, const Color &color, const Affine3f &pose)
|
void cv::viz::WCloudCollection::addCloud(InputArray _cloud, const Color &color, const Affine3f &pose)
|
||||||
@ -474,8 +474,7 @@ void cv::viz::WCloudCollection::addCloud(InputArray _cloud, const Color &color,
|
|||||||
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
|
||||||
CV_Assert("Incompatible widget type." && actor);
|
CV_Assert("Incompatible widget type." && actor);
|
||||||
|
|
||||||
Vec3d minmax(scalars->GetRange());
|
CloudCollectionUtils::createMapper(actor, transform_filter->GetOutput());
|
||||||
CloudCollectionUtils::createMapper(actor, transform_filter->GetOutput(), minmax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<> cv::viz::WCloudCollection cv::viz::Widget::cast<cv::viz::WCloudCollection>()
|
template<> cv::viz::WCloudCollection cv::viz::Widget::cast<cv::viz::WCloudCollection>()
|
||||||
|
@ -102,7 +102,7 @@ cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
|
|||||||
vtkSmartPointer<vtkDataArray> scalars = data->GetPointData()->GetScalars();
|
vtkSmartPointer<vtkDataArray> scalars = data->GetPointData()->GetScalars();
|
||||||
if (scalars)
|
if (scalars)
|
||||||
{
|
{
|
||||||
cv::Vec3d minmax(scalars->GetRange());
|
cv::Vec2d minmax(scalars->GetRange());
|
||||||
mapper->SetScalarRange(minmax.val);
|
mapper->SetScalarRange(minmax.val);
|
||||||
mapper->SetScalarModeToUsePointData();
|
mapper->SetScalarModeToUsePointData();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user