OpenCV 3.0 RGBD深度清洁器 [英] OpenCV 3.0 RGBD DepthCleaner

查看:294
本文介绍了OpenCV 3.0 RGBD深度清洁器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用方法= DEPTH_CLEANER_NIL来使用功能DepthCleaner()清理深度图像时遇到一些困难.此功能在OpenCV 3.0.0中已发布.因此,为该功能找到有用的文档还为时过早.如果您中的任何人已经使用过此功能,请告诉我我用于获取清晰深度图像的功能和代码集.假设我有一个来自Kinect1的深度图像,名为"Img1.png".我声明图像并按如下方式使用DepthCleaner:

I am having some difficulties to use the function DepthCleaner () with method = DEPTH_CLEANER_NIL to clean a depth image. This function is released in OpenCV 3.0.0. So, it's too early to find useful documentation for this function. If anyone of you have already used this function, could you please inform me which set of functions and codes I use to get a clean depth image. Let's say, I have a depth image from Kinect1 named as 'Img1.png'. I am declaring the image and using DepthCleaner as follows:

    char fileName[64];
    Mat depth_image = Mat(480, 640, CV_16UC1);
    Mat output = Mat(480, 640, CV_16U);

    snprintf(fileName, sizeof(fileName), "Depth_Image/Img1.png");
    depth_image = imread(fileName, -1);
    namedWindow("Input image",WINDOW_AUTOSIZE);
    imshow ("Input image",depth_image);

    DepthCleaner* depthc = new DepthCleaner(CV_16U, 3, DepthCleaner::DEPTH_CLEANER_NIL);

    depthc->operator ()(depth_image,output);
    namedWindow("depthCleaner",WINDOW_AUTOSIZE);
    imshow ("depthCleaner",output);

我正在使用C ++.但是,我没有正确的结果.我想我在代码中做错了什么.我也尝试过使用以下代码集:

I am using C++. But, I am not having correct result. I guess I am doing something wrong in the codes. I have also tried using this set of codes:

char fileName[64];
Mat depth_image = Mat(480, 640, CV_16UC1);
Mat output = Mat(480, 640, CV_16U);

float fx = 525.0f, // default
          fy = 525.0f,
          cx = 319.5f,
          cy = 239.5f;
    Mat cameraMatrix = Mat::eye(3,3,CV_32FC1);
    {
        cameraMatrix.at<float>(0,0) = fx;
        cameraMatrix.at<float>(1,1) = fy;
        cameraMatrix.at<float>(0,2) = cx;
        cameraMatrix.at<float>(1,2) = cy;
    }

snprintf(fileName, sizeof(fileName), "Depth_Image/Img1.png");
depth_image = imread(fileName, -1);
namedWindow("Input image",WINDOW_AUTOSIZE);
imshow ("Input image",depth_image);

Mat point3DMat;
depthTo3d(depth_image, cameraMatrix, point3DMat);

DepthCleaner* depthc = new DepthCleaner(CV_16U, 3, DepthCleaner::DEPTH_CLEANER_NIL);

depthc->operator ()(point3DMat,output);
namedWindow("depthCleaner",WINDOW_AUTOSIZE);
imshow ("depthCleaner",output);

但是,它也对我没有帮助;在上面的代码段中,此行出现编译器错误:

But, it did not help me either; getting compiler error for this line in the above piece of code:

depthc->operator ()(point3DMat,output);). 

如果您能指出正确的方向,那将对您有很大的帮助.

It would be a great help if you can point me to the right direction.

推荐答案

OpenCV Error: Assertion failed (depth.type() == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((5) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((2) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((3) & ((1 << 3) - 1)) + (((1)-1) << 3))) in depthTo3d, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/opencv_contrib/rgbd/src/depth_to_3d.cpp, line 232

terminate called after throwing an instance of 'cv::Exception'

   what():  /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/opencv_contrib/rgbd/src/depth_to_3d.cpp:232: error: (-215) depth.type() == (((6) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((5) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((2) & ((1 << 3) - 1)) + (((1)-1) << 3)) || depth.type() == (((3) & ((1 << 3) - 1)) + (((1)-1) << 3)) in function depthTo3d

我找到了关于它的问题.什么?

I found the question about it . what?

这篇关于OpenCV 3.0 RGBD深度清洁器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆