OpenCV VideoCapture::grab() hangs with OpenNI2 using Asus Xtion Pro Live

852 views Asked by At

I managed to compile and install opencv with OpenNI2 in Lubunutu (Arm architecture). I tested the example provided in /samples/cpp/openni_capture.cpp and it succeeds in communicating with the sensor and displaying the information about it. However, the program reaches a points just before showing the images/data and nothing happens, the program hangs in the line if(!capture.grab() .

for(;;)
{
   ...

    if( !capture.grab() )
    {
        cout << "Can not grab images." << endl;
        return -1;
    }
    else
    {
        if( retrievedImageFlags[0] && capture.retrieve( depthMap, CAP_OPENNI_DEPTH_MAP ) )
        {
            const float scaleFactor = 0.05f;
            Mat show; depthMap.convertTo( show, CV_8UC1, scaleFactor );
            imshow( "depth map", show );
        }

       ...
    }

I wrote some lines to make sure that the problem is in that function and it is, I'm quite sure. It doesn't even show the error message. Does anybody know what's going on or how to solve this? Thanks

1

There are 1 answers

0
eduard626 On BEST ANSWER

Well, in case someone bumps into the same problem, I solved it using a grabber created specifically for the Odroid U3 (Arm) available at http://forum.odroid.com/viewtopic.php?f=15&t=2090

Basically the code stays the same but instead of using the VideoCapture class from OpenCV I used the one from above.

Finally I'm able to use opencv, pcl and ros with the the asus sensor on the Arm board =).

Cheers