简体   繁体   中英

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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