深度图优化之ThreadDepthCleaner

github地址:ThreadedDepthCleaner

按github上的说明配置环境:

git clone https://github.com/juniorxsound/ThreadedDepthCleaner --recursive
mkdir build && cd build && cmake ../ && make -j4

这一步容易出现undefined reference to symbol ‘dlclose@@GLIBC_2.2.5‘
和undefined reference to symbol ‘pthread_create‘报错,
解决方法见:
undefined reference to symbol dlclose
undefined reference to symbol ‘pthread_create‘

github中的main.cpp是直接连接realsense相机的,这里没有用相机,直接优化深度图,
所以要改一下代码,最后cleanedDepth就是优化后的深度图。

Mat rawDepthMat = imread("depth.png", cv::IMREAD_UNCHANGED);
const int w = rawDepthMat.cols;
const int h = rawDepthMat.rows;

// Create an openCV matrix for the DepthCleaner instance to write the output to
Mat cleanedDepth(Size(w, h), CV_16U);

//Run the RGBD depth cleaner instance
depthc->operator()(rawDepthMat, cleanedDepth);

//补空洞
const unsigned char noDepth = 0; // change to 255, if values no depth uses max value
Mat temp, temp2;

// Downsize for performance, use a smaller version of depth image (defined in the SCALE_FACTOR macro)
Mat small_depthf;
resize(cleanedDepth, small_depthf, Size(), SCALE_FACTOR, SCALE_FACTOR);

// Inpaint only the masked "unknown" pixels
inpaint(small_depthf, (small_depthf == noDepth), temp, 5.0, INPAINT_TELEA);

// Upscale to original size and replace inpainted regions in original depth image
resize(temp, temp2, cleanedDepth.size());
temp2.copyTo(cleanedDepth, (cleanedDepth == noDepth));  // add to the original signal
  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蓝羽飞鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值