duanyikai 2021-04-13 10:19 采纳率: 0%
浏览 73

vs2019openNi无法程序运行,报错全是无法解析的外部符号

想要打开奥比中光的双目摄像头的深度图像,按照官网环境配置完全一样,但是一运行程序就报错,具体如下

这是配置的环境与代码错误,源程序摘与一位博客主的原创代码

#include<opencv2/opencv.hpp>
#include<OpenNI.h>
#include <stdio.h>

using namespace openni;

int main(int argc,char ** argv[])
{
    int m = 2;
    //初始化OpenNI SDK
      OpenNI::initialize();

    //打开设备
    Device device;
    device.open(ANY_DEVICE);
    //创建深度流
    VideoStream depthStream;
    depthStream.create(device, SENSOR_DEPTH);

    //配置深度流的模式
    VideoMode depthMode;
    depthMode.setResolution(640, 480);
    depthMode.setPixelFormat(PIXEL_FORMAT_DEPTH_1_MM);
    depthMode.setFps(30);
    depthStream.setVideoMode(depthMode);
    //打开深度流
    depthStream.start();
    VideoFrameRef frame;


    while (true)
    {
        VideoStream* pstream = &depthStream;

        int changedStreamDummy;
        //等待一帧
        Status rc = OpenNI::waitForAnyStream(&pstream, 1, &changedStreamDummy, 100);

        if (rc != STATUS_OK)
        {
            continue;
        }

        //获取深度帧数据
        rc = depthStream.readFrame(&frame);
        if (rc == STATUS_OK)
        {
            auto depth = frame.getData();
            auto depthWidth = frame.getWidth();
            auto depthHeight = frame.getHeight();

            //处理并渲染深度帧数据
            cv::Mat rawMat(depthHeight, depthWidth, CV_16UC1, (void*)depth);
            cv::Mat depthMat;
            rawMat.convertTo(depthMat, CV_8UC1);

            cv::imshow("Depth Viewer", depthMat);

        }

        //按ESC退出
        int key = cv::waitKey(100);
        if (key == 27)
            break;
    }

    depthStream.stop();
    depthStream.destroy();

    device.close();

    OpenNI::shutdown();

    return 0;
},

想请大佬们帮忙解决麻烦,困扰小白好久了,谢谢!

  • 写回答

1条回答 默认 最新

  • 赵4老师 2024-07-18 12:01
    关注

    附加库目录
    附加库

    评论

报告相同问题?

悬赏问题

  • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
  • ¥15 安装quartus II18.1时弹出此error,怎么解决?
  • ¥15 keil官网下载psn序列号在哪
  • ¥15 想用adb命令做一个通话软件,播放录音
  • ¥30 Pytorch深度学习服务器跑不通问题解决?
  • ¥15 部分客户订单定位有误的问题
  • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
  • ¥15 Bug traq 数据包 大概什么价
  • ¥15 在anaconda上pytorch和paddle paddle下载报错
  • ¥25 自动填写QQ腾讯文档收集表