玩了些时间的D435i 摄像头, c++ 的 rs-example程序,python 的代码图像深度实时显示,我就开始做一个自己的c++工程,hello world。
我是看了一些realsense 代码,想自己测试下,觉得需要建立一个自己的工程。本文主要介绍工程的设置方面。代码呢,基本是复制的rs-example 里的helloworld 代码。代码简单,功能是显示采集图像的中心点的深度。
环境是visual studio 2017 的免费版本,新建一个工程,取名hello-rs,windows 的控制台程序,就有一个hello-rs.cpp 文件,如果编译执行,就是打印一个hello world。
去掉所有的代码内容,只保留#include "pch.h"
然后复制rs-example中 hello world 工程中的代码,当然也可以这里copy,如下:
#include "pch.h"
// License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
#include <librealsense2/rs.hpp> // Include RealSense Cross Platform API
#include <iostream> // for cout
// Hello RealSense example demonstrates the basics of connecting to a RealSense device
// and taking advantage of depth data
int main(int argc, char * argv[]) try
{
// Create a Pipeline -