OpenNI+OpenCV+Qt

OpenNI+OpenCV+Qt,qt,opencv,kinect,openni,Qt,Opencv,Kinect,Openni,我正在尝试使用Kinect OpenNI制作一个应用程序,用GUI处理OpenCV图像 我测试了de-OpenNI+OpenCV和OpenCV+Qt 通常,当我们使用OpenCV+Qt时,我们可以制作一个QWidget来显示摄像机视频捕获的内容。。捕获帧并更新此查询,以便将新帧发送到设备 有了OpenNI和OpenCV,我看到了使用for循环从Kinect传感器图像、深度提取数据的示例,但我不知道如何使这个提取路由更简单。我的意思是,类似于OpenCV帧查询 这个想法被嵌入到一个QWidget中

我正在尝试使用Kinect OpenNI制作一个应用程序,用GUI处理OpenCV图像

我测试了de-OpenNI+OpenCV和OpenCV+Qt

通常,当我们使用OpenCV+Qt时,我们可以制作一个QWidget来显示摄像机视频捕获的内容。。捕获帧并更新此查询,以便将新帧发送到设备

有了OpenNI和OpenCV,我看到了使用for循环从Kinect传感器图像、深度提取数据的示例,但我不知道如何使这个提取路由更简单。我的意思是,类似于OpenCV帧查询

这个想法被嵌入到一个QWidget中,其中包含了从Kinect捕获的图像。QWidget现在将有两个按钮启动Kinect和退出..并在绘图部分下方显示捕获的数据


有什么想法吗?

您可以尝试使用QTimer类以固定的时间间隔查询kinect。在我的应用程序中,我使用下面的代码

void UpperBodyGestures::refreshUsingTimer()
{
    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(MainEventFunction()));
    timer->start(30);
}

void UpperBodyGestures::on_pushButton_Kinect_clicked()
{
    InitKinect();
    ui.pushButton_Kinect->setEnabled(false);
}


// modify the main function to call refreshUsingTimer function

    UpperBodyGestures w;
    w.show();
    w.refreshUsingTimer();
    return a.exec();
然后可以使用标签小部件来查询框架。我在下面发布了一个示例代码:

// Query the depth data from Openni
const XnDepthPixel* pDepth = depthMD.Data();
// Convert it to opencv for manipulation etc
cv::Mat DepthBuf(480,640,CV_16UC1,(unsigned char*)g_Depth);
// Normalize Depth image to 0-255 range (cant remember max range number so assuming it as 10k)
DepthBuf = DepthBuf / 10000 *255; 
DepthBuf.convertTo(DepthBuf,CV_8UC1);
// Convert opencv image to a Qimage object 
QImage qimage((const unsigned char*)DepthBuf.data, DepthBuf.size().width, DepthBuf.size().height, DepthBuf.step, QImage::Format_RGB888);        
// Display the Qimage in the defined mylabel object
ui.myLabel->setPixmap(pixmap.fromImage(qimage,0).scaled(QSize(300,300), Qt::KeepAspectRatio, Qt::FastTransformation));