Ask Your Question

Revision history [back]

How to get depth from depth images in OpenCV

Hi everyone, I have depth image sequences and I have to extract the hand from the depth image. How can I read the depth image in opencv and extract the hand.

I am doing something like this roughly but it doesn't work.

Mat frame, hand; cap >> frame; hand = Mat::zeros(frame.cols, frame.rows, CV_8UC1);

    for(int x = 0; x<frame.cols; x++)
    {
        for(int y = 0; y<frame.rows; y++)
        {
            int offset = x + y*frame.rows;
            int d = frame.data[offset];

            if(d<min)
                min = d;
            if(d>max)
                max = d;

            if(d>minThreshold && d<maxThreshold && x>100)
                hand.data[offset] = d;

        }
    }

How to get depth from depth images in OpenCV

Hi everyone, I have depth image sequences and I have to extract the hand from the depth image. How can I read the depth image in opencv and extract the hand.

I am doing something like this roughly but it doesn't work.

 Mat frame, hand;
 cap >> frame;
 hand = Mat::zeros(frame.cols, frame.rows, CV_8UC1);

CV_8UC1);
 for(int x = 0; x<frame.cols; x++)
{
for(int y = 0; y<frame.rows; y++)
{
int offset = x + y*frame.rows;
int d = frame.data[offset];
if(d<min)
min = d;
if(d>max)
max = d;
if(d>minThreshold && d<maxThreshold && x>100)
hand.data[offset] = d;
}
}