简体   繁体   English

用低对比度分割深度图像

[英]Segment depth image with low contrast

I am trying to segment the hand from this depth image:我试图从这个深度图像中分割出手:

在此处输入图像描述

I tried watershed, region growing, grabcut, but all of them failed mainly because there is not a clear edge.我尝试了分水岭,区域增长,grabcut,但所有这些都失败了,主要是因为没有明确的边缘。 I tried to sharp the image as well, but it didn't give me good results either.我也尝试锐化图像,但它也没有给我带来好的结果。

This might not be the answer you were hoping for, but it might help you step forward a bit.这可能不是您希望的答案,但它可能会帮助您向前迈出一步。 Since I only provide algorithmic hints I will use Matlab rather than opencv.由于我只提供算法提示,我将使用 Matlab 而不是 opencv。

Since this is not an ordinary intensity image, but rather depth image, you should use the implied geometry of the scene.由于这不是普通的强度图像,而是深度图像,因此您应该使用场景的隐含几何形状 The key assumption that can help you here is that the hand is resting on a surface .在这里可以帮助您的关键假设是手放在表面上 If you can estimate the surface equation, you can detect the hand much easier.如果你能估计表面方程,你就能更容易地检测到手。

[y x] = ndgrid( linspace(-1,1,size(img,1)), linspace(-1,1,size(img,2)) );
X = [reshape(x(101:140,141:180),[],1), reshape(y(101:140,141:180),[],1), ones(1600,1)];
srf=(X\reshape(img(101:140,141:180),[],1)); %// solving least-squares for the 40x40 central patch

 aimg = img - x*srf(1) - y*srf(2) - srf(3); %// subtracting the recovered surface

Using median filter to "clean" it a bit, and applying a simple thereshold使用中值滤波器“清理”一下,并应用一个简单的阈值

 medfilt2(aimg,[3 3]) < -1.5

Yields产量

在此处输入图像描述

Not exactly what you were hoping for, but I think it's a step forward ;)不完全是您所希望的,但我认为这是向前迈出的一步;)


PS, PS,
You might find the work of Alpert, Galun, Nadler and Basri Detecting faint curved edges in noisy images (ECCV2010) relevant to your problem.您可能会发现Alpert、Galun、Nadler 和 Basri检测嘈杂图像中微弱的弯曲边缘(ECCV2010)的工作与您的问题相关。

Please check my code implementation.请检查我的代码实现。

void applyClahe(const cv::Mat& src, cv::Mat& dst)
{
    cv::Mat lab;
    cv::cvtColor(src, lab, cv::COLOR_BGR2Lab);

    vector<cv::Mat> labChannels;
    cv::split(lab, labChannels);

    auto clahe = cv::createCLAHE();
    cv::Mat cl; clahe->apply(labChannels[0], cl);
    cl.copyTo(labChannels[0]);

    cv::merge(labChannels, dst);
    cv::cvtColor(dst, dst, cv::COLOR_Lab2BGR);
}

This function will give you the following result and good starting point.此功能将为您提供以下结果和良好的起点。 克拉赫结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM