fix minor bug, minor cleaning, cv_assert with messages

This commit is contained in:
ozantonkal 2013-08-31 11:30:37 +02:00 committed by Ozan Tonkal
parent 69f135ec57
commit af8a918e04
8 changed files with 36 additions and 125 deletions

View File

@ -61,9 +61,6 @@ namespace cv
{ {
public: public:
LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white()); LineWidget(const Point3f &pt1, const Point3f &pt2, const Color &color = Color::white());
void setLineWidth(float line_width);
float getLineWidth();
}; };
class CV_EXPORTS PlaneWidget : public Widget3D class CV_EXPORTS PlaneWidget : public Widget3D

View File

@ -298,7 +298,7 @@ struct cv::viz::CloudCollectionWidget::CreateCloudWidget
} }
vtkPolyData *data = vtkPolyData::SafeDownCast(mapper->GetInput()); vtkPolyData *data = vtkPolyData::SafeDownCast(mapper->GetInput());
CV_Assert(data); CV_Assert("Cloud Widget without data" && data);
vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New(); vtkSmartPointer<vtkAppendPolyData> appendFilter = vtkSmartPointer<vtkAppendPolyData>::New();
appendFilter->AddInputConnection(mapper->GetInput()->GetProducerPort()); appendFilter->AddInputConnection(mapper->GetInput()->GetProducerPort());
@ -357,7 +357,7 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, InputArray _col
transform_filter->Update(); transform_filter->Update();
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Incompatible widget type." && actor);
Vec3d minmax(scalars->GetRange()); Vec3d minmax(scalars->GetRange());
CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax); CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax);
@ -392,7 +392,7 @@ void cv::viz::CloudCollectionWidget::addCloud(InputArray _cloud, const Color &co
transform_filter->Update(); transform_filter->Update();
vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkLODActor *actor = vtkLODActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Incompatible widget type." && actor);
Vec3d minmax(scalars->GetRange()); Vec3d minmax(scalars->GetRange());
CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax); CreateCloudWidget::createMapper(actor, transform_filter->GetOutput(), minmax);

View File

@ -152,17 +152,9 @@ void cv::viz::InteractorStyle::registerKeyboardCallback(void (*callback)(const K
void void
cv::viz::InteractorStyle::OnKeyDown () cv::viz::InteractorStyle::OnKeyDown ()
{ {
if (!init_)
{ CV_Assert("Interactor style not initialized. Please call Initialize () before continuing" && init_);
std::cout << "Interactor style not initialized. Please call Initialize () before continuing" << std::endl; CV_Assert("No renderer given! Use SetRendererCollection () before continuing." && renderer_);
return;
}
if (!renderer_)
{
std::cout << "No renderer given! Use SetRendererCollection () before continuing." << std::endl;
return;
}
FindPokedRenderer (Interactor->GetEventPosition ()[0], Interactor->GetEventPosition ()[1]); FindPokedRenderer (Interactor->GetEventPosition ()[0], Interactor->GetEventPosition ()[1]);

View File

@ -27,20 +27,6 @@ cv::viz::LineWidget::LineWidget(const Point3f &pt1, const Point3f &pt2, const Co
setColor(color); setColor(color);
} }
void cv::viz::LineWidget::setLineWidth(float line_width)
{
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor);
actor->GetProperty()->SetLineWidth(line_width);
}
float cv::viz::LineWidget::getLineWidth()
{
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor);
return actor->GetProperty()->GetLineWidth();
}
template<> cv::viz::LineWidget cv::viz::Widget::cast<cv::viz::LineWidget>() template<> cv::viz::LineWidget cv::viz::Widget::cast<cv::viz::LineWidget>()
{ {
Widget3D widget = this->cast<Widget3D>(); Widget3D widget = this->cast<Widget3D>();
@ -556,12 +542,12 @@ cv::viz::Text3DWidget::Text3DWidget(const String &text, const Point3f &position,
void cv::viz::Text3DWidget::setText(const String &text) void cv::viz::Text3DWidget::setText(const String &text)
{ {
vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this)); vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support text." && actor);
// Update text source // Update text source
vtkPolyDataMapper *mapper = vtkPolyDataMapper::SafeDownCast(actor->GetMapper()); vtkPolyDataMapper *mapper = vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
vtkVectorText * textSource = vtkVectorText::SafeDownCast(mapper->GetInputConnection(0,0)->GetProducer()); vtkVectorText * textSource = vtkVectorText::SafeDownCast(mapper->GetInputConnection(0,0)->GetProducer());
CV_Assert(textSource); CV_Assert("This widget does not support text." && textSource);
textSource->SetText(text.c_str()); textSource->SetText(text.c_str());
textSource->Update(); textSource->Update();
@ -570,11 +556,11 @@ void cv::viz::Text3DWidget::setText(const String &text)
cv::String cv::viz::Text3DWidget::getText() const cv::String cv::viz::Text3DWidget::getText() const
{ {
vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this)); vtkFollower *actor = vtkFollower::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support text." && actor);
vtkPolyDataMapper *mapper = vtkPolyDataMapper::SafeDownCast(actor->GetMapper()); vtkPolyDataMapper *mapper = vtkPolyDataMapper::SafeDownCast(actor->GetMapper());
vtkVectorText * textSource = vtkVectorText::SafeDownCast(mapper->GetInputConnection(0,0)->GetProducer()); vtkVectorText * textSource = vtkVectorText::SafeDownCast(mapper->GetInputConnection(0,0)->GetProducer());
CV_Assert(textSource); CV_Assert("This widget does not support text." && textSource);
return textSource->GetText(); return textSource->GetText();
} }
@ -615,14 +601,14 @@ template<> cv::viz::TextWidget cv::viz::Widget::cast<cv::viz::TextWidget>()
void cv::viz::TextWidget::setText(const String &text) void cv::viz::TextWidget::setText(const String &text)
{ {
vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support text." && actor);
actor->SetInput(text.c_str()); actor->SetInput(text.c_str());
} }
cv::String cv::viz::TextWidget::getText() const cv::String cv::viz::TextWidget::getText() const
{ {
vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkTextActor *actor = vtkTextActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support text." && actor);
return actor->GetInput(); return actor->GetInput();
} }
@ -671,10 +657,10 @@ void cv::viz::ImageOverlayWidget::setImage(const Mat &image)
CV_Assert(!image.empty() && image.depth() == CV_8U); CV_Assert(!image.empty() && image.depth() == CV_8U);
vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support overlay image." && actor);
vtkImageMapper *mapper = vtkImageMapper::SafeDownCast(actor->GetMapper()); vtkImageMapper *mapper = vtkImageMapper::SafeDownCast(actor->GetMapper());
CV_Assert(mapper); CV_Assert("This widget does not support overlay image." && mapper);
// Create the vtk image and set its parameters based on input image // Create the vtk image and set its parameters based on input image
vtkSmartPointer<vtkImageData> vtk_image = vtkSmartPointer<vtkImageData>::New(); vtkSmartPointer<vtkImageData> vtk_image = vtkSmartPointer<vtkImageData>::New();
@ -821,7 +807,7 @@ void cv::viz::Image3DWidget::setImage(const Mat &image)
CV_Assert(!image.empty() && image.depth() == CV_8U); CV_Assert(!image.empty() && image.depth() == CV_8U);
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("This widget does not support 3D image." && actor);
// Create the vtk image and set its parameters based on input image // Create the vtk image and set its parameters based on input image
vtkSmartPointer<vtkImageData> vtk_image = vtkSmartPointer<vtkImageData>::New(); vtkSmartPointer<vtkImageData> vtk_image = vtkSmartPointer<vtkImageData>::New();

View File

@ -74,7 +74,7 @@ struct cv::viz::Mesh3d::loadMeshImpl
reader->Update(); reader->Update();
vtkSmartPointer<vtkPolyData> poly_data = reader->GetOutput (); vtkSmartPointer<vtkPolyData> poly_data = reader->GetOutput ();
CV_Assert(poly_data); CV_Assert("File does not exist or file format is not supported." && poly_data);
vtkSmartPointer<vtkPoints> mesh_points = poly_data->GetPoints (); vtkSmartPointer<vtkPoints> mesh_points = poly_data->GetPoints ();
vtkIdType nr_points = mesh_points->GetNumberOfPoints (); vtkIdType nr_points = mesh_points->GetNumberOfPoints ();

View File

@ -34,9 +34,6 @@ cv::viz::Viz3d::VizImpl::VizImpl (const std::string &name)
///////////////////////////////////////////////// /////////////////////////////////////////////////
interactor_ = vtkSmartPointer <vtkRenderWindowInteractor>::Take (vtkRenderWindowInteractorFixNew ()); interactor_ = vtkSmartPointer <vtkRenderWindowInteractor>::Take (vtkRenderWindowInteractorFixNew ());
//win_->PointSmoothingOn ();
//win_->LineSmoothingOn ();
//win_->PolygonSmoothingOn ();
window_->AlphaBitPlanesOff (); window_->AlphaBitPlanesOff ();
window_->PointSmoothingOff (); window_->PointSmoothingOff ();
window_->LineSmoothingOff (); window_->LineSmoothingOff ();
@ -46,7 +43,6 @@ cv::viz::Viz3d::VizImpl::VizImpl (const std::string &name)
interactor_->SetRenderWindow (window_); interactor_->SetRenderWindow (window_);
interactor_->SetInteractorStyle (style_); interactor_->SetInteractorStyle (style_);
//interactor_->SetStillUpdateRate (30.0);
interactor_->SetDesiredUpdateRate (30.0); interactor_->SetDesiredUpdateRate (30.0);
// Initialize and create timer, also create window // Initialize and create timer, also create window
@ -119,8 +115,8 @@ void cv::viz::Viz3d::VizImpl::removeWidget(const String &id)
{ {
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id); WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end(); bool exists = wam_itr != widget_actor_map_->end();
CV_Assert(exists); CV_Assert("Widget does not exist." && exists);
CV_Assert(removeActorFromRenderer (wam_itr->second)); CV_Assert("Widget could not be removed." && removeActorFromRenderer (wam_itr->second));
widget_actor_map_->erase(wam_itr); widget_actor_map_->erase(wam_itr);
} }
@ -129,7 +125,7 @@ cv::viz::Widget cv::viz::Viz3d::VizImpl::getWidget(const String &id) const
{ {
WidgetActorMap::const_iterator wam_itr = widget_actor_map_->find(id); WidgetActorMap::const_iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end(); bool exists = wam_itr != widget_actor_map_->end();
CV_Assert(exists); CV_Assert("Widget does not exist." && exists);
Widget widget; Widget widget;
WidgetAccessor::setProp(widget, wam_itr->second); WidgetAccessor::setProp(widget, wam_itr->second);
@ -141,10 +137,10 @@ void cv::viz::Viz3d::VizImpl::setWidgetPose(const String &id, const Affine3f &po
{ {
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id); WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end(); bool exists = wam_itr != widget_actor_map_->end();
CV_Assert(exists); CV_Assert("Widget does not exist." && exists);
vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second); vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second);
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = convertToVtkMatrix(pose.matrix); vtkSmartPointer<vtkMatrix4x4> matrix = convertToVtkMatrix(pose.matrix);
actor->SetUserMatrix (matrix); actor->SetUserMatrix (matrix);
@ -156,10 +152,10 @@ void cv::viz::Viz3d::VizImpl::updateWidgetPose(const String &id, const Affine3f
{ {
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id); WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end(); bool exists = wam_itr != widget_actor_map_->end();
CV_Assert(exists); CV_Assert("Widget does not exist." && exists);
vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second); vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second);
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix(); vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix();
if (!matrix) if (!matrix)
@ -180,10 +176,10 @@ cv::Affine3f cv::viz::Viz3d::VizImpl::getWidgetPose(const String &id) const
{ {
WidgetActorMap::const_iterator wam_itr = widget_actor_map_->find(id); WidgetActorMap::const_iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end(); bool exists = wam_itr != widget_actor_map_->end();
CV_Assert(exists); CV_Assert("Widget does not exist." && exists);
vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second); vtkProp3D *actor = vtkProp3D::SafeDownCast(wam_itr->second);
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix(); vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix();
Matx44f matrix_cv = convertToMatx(matrix); Matx44f matrix_cv = convertToMatx(matrix);
@ -254,56 +250,6 @@ void cv::viz::Viz3d::VizImpl::removeAllWidgets()
renderer_->RemoveAllViewProps(); renderer_->RemoveAllViewProps();
} }
//////////////////////////////////////////////////////////////////////////////////////////
bool cv::viz::Viz3d::VizImpl::removeActorFromRenderer (const vtkSmartPointer<vtkLODActor> &actor)
{
vtkLODActor* actor_to_remove = vtkLODActor::SafeDownCast (actor);
// Iterate over all actors in this renderer
vtkPropCollection* actors = renderer_->GetViewProps ();
actors->InitTraversal ();
vtkProp* current_actor = NULL;
while ((current_actor = actors->GetNextProp ()) != NULL)
{
if (current_actor != actor_to_remove)
continue;
renderer_->RemoveActor (actor);
// renderer->Render ();
// Found the correct viewport and removed the actor
return (true);
}
return false;
}
//////////////////////////////////////////////////////////////////////////////////////////
bool cv::viz::Viz3d::VizImpl::removeActorFromRenderer (const vtkSmartPointer<vtkActor> &actor)
{
vtkActor* actor_to_remove = vtkActor::SafeDownCast (actor);
// Add it to all renderers
//rens_->InitTraversal ();
// Iterate over all actors in this renderer
vtkPropCollection* actors = renderer_->GetViewProps ();
actors->InitTraversal ();
vtkProp* current_actor = NULL;
while ((current_actor = actors->GetNextProp ()) != NULL)
{
if (current_actor != actor_to_remove)
continue;
renderer_->RemoveActor (actor);
// renderer->Render ();
// Found the correct viewport and removed the actor
return (true);
}
return false;
}
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
bool cv::viz::Viz3d::VizImpl::removeActorFromRenderer (const vtkSmartPointer<vtkProp> &actor) bool cv::viz::Viz3d::VizImpl::removeActorFromRenderer (const vtkSmartPointer<vtkProp> &actor)
{ {

View File

@ -119,6 +119,7 @@ private:
if (event_id == vtkCommand::ExitEvent) if (event_id == vtkCommand::ExitEvent)
{ {
viz_->stopped_ = true; viz_->stopped_ = true;
viz_->interactor_->GetRenderWindow()->Finalize();
viz_->interactor_->TerminateApp (); viz_->interactor_->TerminateApp ();
} }
} }
@ -142,12 +143,6 @@ private:
/** \brief The render window interactor style. */ /** \brief The render window interactor style. */
vtkSmartPointer<InteractorStyle> style_; vtkSmartPointer<InteractorStyle> style_;
/** \brief Internal list with actor pointers and name IDs for point clouds. */
// cv::Ptr<CloudActorMap> cloud_actor_map_;
/** \brief Internal list with actor pointers and name IDs for shapes. */
// cv::Ptr<ShapeActorMap> shape_actor_map_;
/** \brief Internal list with actor pointers and name IDs for all widget actors */ /** \brief Internal list with actor pointers and name IDs for all widget actors */
cv::Ptr<WidgetActorMap> widget_actor_map_; cv::Ptr<WidgetActorMap> widget_actor_map_;
@ -155,13 +150,8 @@ private:
/** \brief Boolean that holds whether or not the camera parameters were manually initialized*/ /** \brief Boolean that holds whether or not the camera parameters were manually initialized*/
bool camera_set_; bool camera_set_;
bool removeActorFromRenderer (const vtkSmartPointer<vtkLODActor> &actor);
bool removeActorFromRenderer (const vtkSmartPointer<vtkActor> &actor);
bool removeActorFromRenderer (const vtkSmartPointer<vtkProp> &actor); bool removeActorFromRenderer (const vtkSmartPointer<vtkProp> &actor);
//void addActorToRenderer (const vtkSmartPointer<vtkProp> &actor);
/** \brief Internal method. Creates a vtk actor from a vtk polydata object. /** \brief Internal method. Creates a vtk actor from a vtk polydata object.
* \param[in] data the vtk polydata object to create an actor for * \param[in] data the vtk polydata object to create an actor for
* \param[out] actor the resultant vtk actor object * \param[out] actor the resultant vtk actor object

View File

@ -40,7 +40,7 @@ cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
reader->SetFileName (file_name.c_str ()); reader->SetFileName (file_name.c_str ());
vtkSmartPointer<vtkDataSet> data = reader->GetOutput(); vtkSmartPointer<vtkDataSet> data = reader->GetOutput();
CV_Assert(data); CV_Assert("File does not exist or file format is not supported." && data);
vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New(); vtkSmartPointer<vtkLODActor> actor = vtkSmartPointer<vtkLODActor>::New();
@ -77,7 +77,7 @@ cv::viz::Widget cv::viz::Widget::fromPlyFile(const String &file_name)
void cv::viz::Widget::setRenderingProperty(int property, double value) void cv::viz::Widget::setRenderingProperty(int property, double value)
{ {
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget type is not supported." && actor);
switch (property) switch (property)
{ {
@ -118,7 +118,7 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
double cv::viz::Widget::getRenderingProperty(int property) const double cv::viz::Widget::getRenderingProperty(int property) const
{ {
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget type is not supported." && actor);
double value = 0.0; double value = 0.0;
switch (property) switch (property)
@ -239,7 +239,7 @@ struct cv::viz::Widget3D::MatrixConverter
void cv::viz::Widget3D::setPose(const Affine3f &pose) void cv::viz::Widget3D::setPose(const Affine3f &pose)
{ {
vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = convertToVtkMatrix(pose.matrix); vtkSmartPointer<vtkMatrix4x4> matrix = convertToVtkMatrix(pose.matrix);
actor->SetUserMatrix (matrix); actor->SetUserMatrix (matrix);
@ -249,7 +249,7 @@ void cv::viz::Widget3D::setPose(const Affine3f &pose)
void cv::viz::Widget3D::updatePose(const Affine3f &pose) void cv::viz::Widget3D::updatePose(const Affine3f &pose)
{ {
vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix(); vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix();
if (!matrix) if (!matrix)
@ -269,7 +269,7 @@ void cv::viz::Widget3D::updatePose(const Affine3f &pose)
cv::Affine3f cv::viz::Widget3D::getPose() const cv::Affine3f cv::viz::Widget3D::getPose() const
{ {
vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget is not 3D." && actor);
vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix(); vtkSmartPointer<vtkMatrix4x4> matrix = actor->GetUserMatrix();
Matx44f matrix_cv = MatrixConverter::convertToMatx(matrix); Matx44f matrix_cv = MatrixConverter::convertToMatx(matrix);
@ -280,7 +280,7 @@ void cv::viz::Widget3D::setColor(const Color &color)
{ {
// Cast to actor instead of prop3d since prop3d doesn't provide getproperty // Cast to actor instead of prop3d since prop3d doesn't provide getproperty
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget type is not supported." && actor);
Color c = vtkcolor(color); Color c = vtkcolor(color);
actor->GetMapper ()->ScalarVisibilityOff (); actor->GetMapper ()->ScalarVisibilityOff ();
@ -292,7 +292,7 @@ void cv::viz::Widget3D::setColor(const Color &color)
template<> cv::viz::Widget3D cv::viz::Widget::cast<cv::viz::Widget3D>() template<> cv::viz::Widget3D cv::viz::Widget::cast<cv::viz::Widget3D>()
{ {
vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkProp3D *actor = vtkProp3D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget cannot be cast." && actor);
Widget3D widget; Widget3D widget;
WidgetAccessor::setProp(widget, actor); WidgetAccessor::setProp(widget, actor);
@ -305,7 +305,7 @@ template<> cv::viz::Widget3D cv::viz::Widget::cast<cv::viz::Widget3D>()
void cv::viz::Widget2D::setColor(const Color &color) void cv::viz::Widget2D::setColor(const Color &color)
{ {
vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget type is not supported." && actor);
Color c = vtkcolor(color); Color c = vtkcolor(color);
actor->GetProperty ()->SetColor (c.val); actor->GetProperty ()->SetColor (c.val);
actor->Modified (); actor->Modified ();
@ -314,7 +314,7 @@ void cv::viz::Widget2D::setColor(const Color &color)
template<> cv::viz::Widget2D cv::viz::Widget::cast<cv::viz::Widget2D>() template<> cv::viz::Widget2D cv::viz::Widget::cast<cv::viz::Widget2D>()
{ {
vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this)); vtkActor2D *actor = vtkActor2D::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert(actor); CV_Assert("Widget cannot be cast." && actor);
Widget2D widget; Widget2D widget;
WidgetAccessor::setProp(widget, actor); WidgetAccessor::setProp(widget, actor);