Skip to content

Calling WPlane::getPose() yields segmentation fault #9486

@dustsigns

Description

@dustsigns
System information (version)
  • OpenCV => 3.3
  • Operating System / Platform => Ubuntu 16.04 (x86-64)
  • Compiler => g++ 5.4.0
Detailed description

Calling WPlane::getPose() before calling showWidget yields a segmentation fault. The following code illustrates the issue:

Steps to reproduce
#include <iostream>
#include <opencv2/viz.hpp>

using namespace std;
using namespace cv;
using namespace cv::viz;

int main()
{
  Viz3d visualization("Test");
  WPlane test_object(Size2d(0, 0));
  const auto pose = test_object.getPose();
  cout << pose.rotation() << endl; //Avoid warning due to unused variable
  visualization.showWidget("Test object", test_object);
  /*visualization.spinOnce(1, true);
  while (!visualization.wasStopped())
    visualization.spinOnce(1, true);*/
  return 0;
}

The program crashes after printing the following error message:

ERROR: In /build/vtk6-YpT4yb/vtk6-6.2.0+dfsg1/Filters/Sources/vtkPlaneSource.cxx, line 104
vtkPlaneSource (0x2348f20): Bad plane coordinate system

ERROR: In /build/vtk6-YpT4yb/vtk6-6.2.0+dfsg1/Common/ExecutionModel/vtkExecutive.cxx, line 784
vtkCompositeDataPipeline (0x2348bb0): Algorithm vtkPlaneSource(0x2348f20) returned failure for request: vtkInformation (0x234a030)
Debug: Off
Modified Time: 311
Reference Count: 1
Registered Events: (none)
Request: REQUEST_DATA
FROM_OUTPUT_PORT: 0
ALGORITHM_AFTER_FORWARD: 1
FORWARD_DIRECTION: 0

According to gdb, the crash happens in the line where Widget::getPose() is called.

The crash also happens when the plane size is (1, 1). In this case, the error message disappears, but the segmentation fault still happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcategory: vizOpenCV 4.0+: moved to opencv_contrib

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions