Skip to content

Unexpected behavior of cv::viz::WCloudCollection::finalize() #2934

Open
@pauljurczak

Description

@pauljurczak

I get the same results with opencv 4.5.1-dev on Ubuntu 18.04 built with VTK 6.3 and opencv 4.5.2-dev on Ubuntu 20.04 built with VTK 9.0.1 using gcc-9.3 and gcc-10.1. This code snippet:

  constexpr int n = 2;

  Viz3d window{"Cloud"};
  WCloudCollection cloud;

  for (int i = 0; i < n; i++) {
    Mat_<Vec3f> pc(100, 100);

    randu(pc, Scalar{0, 0, 0}, Scalar{1, 1, 1});
    cloud.addCloud(pc, Color::yellow());
    cloud.finalize(); 
  }

  window.setFullScreen();
  window.setBackgroundColor(Color::gray());
  window.showWidget("cloud", cloud);
  window.spin();

crashes with Segmentation fault when n > 1. It runs fine for any n when cloud.finalize(); is commented out.

I'm guessing that intended use is:

  constexpr int n = 2;

  Viz3d window{"Cloud"};
  WCloudCollection cloud;

  for (int i = 0; i < n; i++) {
    Mat_<Vec3f> pc(100, 100);

    randu(pc, Scalar{0, 0, 0}, Scalar{1, 1, 1});
    cloud.addCloud(pc, Color::yellow());
  }

  cloud.finalize(); 
  window.setFullScreen();
  window.setBackgroundColor(Color::gray());
  window.showWidget("cloud", cloud);
  window.spin();

but this is not described in documentation. Additionally, rendering is quickly getting slow when WCloudCollection grows.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions