Skip to content

RgbdPlane sample #23

@ilysenkov

Description

@ilysenkov

Hi,

I'm trying to use RgbdPlane on a depth image located in object_recognition_transparent_objects/sample/depth.xml.gz but I get a segmentation fault when calling RgbdPlane::operator(..). I use ecto_opencv from the commit c2eda93 and here is my code:

#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/rgbd/rgbd.hpp>

using namespace cv;

int main()
{
  const string depthFilename = "depth.xml.gz";

  //read depth image
  Mat depth;
  FileStorage fs(depthFilename, FileStorage::READ);
  CV_Assert(fs.isOpened());
  fs["depth_image"] >> depth;
  fs.release();
  CV_Assert(!depth.empty());
  imshow("depth", depth);
  waitKey(3000);

  Mat cameraMatrix = (Mat_<double>(3, 3) << 525.,   0., 3.1950000000000000e+02,
                                              0., 525., 2.3950000000000000e+02,
                                              0.,   0., 1.);

  Mat points3d;
  depthTo3d(depth, cameraMatrix, points3d);
  RgbdNormals normalsEstimator(depth.rows, depth.cols, depth.depth(), cameraMatrix);
  Mat normals = normalsEstimator(points3d);

  RgbdPlane planeEstimator;
  Mat planesMask;
  vector<Vec4f> planeCoefficients;
  //planeEstimator(depth, planesMask, planeCoefficients);
  planeEstimator(depth, normals, planesMask, planeCoefficients);

  return 0;
}

Also I get a segmentation fault if I call the plane estimator this way: planeEstimator(depth, planesMask, planeCoefficients). Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions