简体   繁体   English

使用华硕Xtion Pro Live将OpenCV VideoCapture :: grab()与OpenNI2挂起

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

I managed to compile and install opencv with OpenNI2 in Lubunutu (Arm architecture). 我设法在Lubunutu(Arm体系结构)中使用OpenNI2编译并安装了opencv。 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. 我测试了/samples/cpp/openni_capture.cpp中提供的示例,该示例成功与传感器通信并显示了有关该传感器的信息。 However, the program reaches a points just before showing the images/data and nothing happens, the program hangs in the line if(!capture.grab() . 但是,程序在显示图像/数据之前就达到了一个点,并且什么也没有发生,程序挂在了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 好吧,以防万一有人遇到相同的问题,我使用专门为Odroid U3(Arm)创建的抓取器解决了该问题,该抓取器可从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. 基本上,代码保持不变,但不是使用OpenCV的VideoCapture类,而是使用上面的代码。

Finally I'm able to use opencv, pcl and ros with the the asus sensor on the Arm board =). 最后,我可以将opencv,pcl和ros与Arm板上的asus传感器一起使用=)。

Cheers 干杯

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

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