奥比中光Astra Pro VS2019 openni2.3 配置

19 篇文章 2 订阅
18 篇文章 3 订阅

Astra Pro官方参数:http://www.orbbec.com.cn/sys/37.html

资料下载:

http://www.orbbec.com.cn/sys/list/11.html

1. 下载安装驱动:

 

直接搜索 :Astra Pro驱动,下载SensorDriver_V4.3.0.4

直接双击.exe运行就行。
 

2. 在Visual Studio中安装配置SDK

SDK下载

https://orbbec3d.com/develop/

在解压的SDK包下的doc文件夹下有相关说明,打开。

Installation / Setup for Visual Studio

When you develop with Visual Studio on a Windows platform, you have some extra work to do.The Astra SDK works fine depends on the OpenNI SDK and Orbbec sensor driver for Windows.So, you should install them rightly first.

  1. Download OpenNI SDK and install it.
  2. Download Orbbec Sensor Driver for Windows and install it.

  3. Download Astra SDK according to your Visual Studio distribution.Unzip it to a folder, for example called $ASTRA_HOME.
  4. Open a new project or an existing one.
  5. In the Visual Studio menu, open the Project menu and choose Project properties.
  6. In the C/C++ section, under the General node, find the "Additional Include Directories" and add "$ASTRA_HOME\include".
  7. In the Linker section, under the General node, find the "Additional Library Directories" and add "$ASTRA_HOME\lib","$ASTRA_HOME\lib\Plugins".
  8. In the Linker section, under the Input node, find the "Additional Dependencies" and add astra.lib,astra_core.lib,astra_core_api.lib

   3. 下载 安装配置OpenNI2.3

 直接在上面 Astra SDK说明文档中点击OpenNI SDK下载openni2.3,解压后在OpenNI-Windows-x64-2.3/documentation文件夹下有说明文档。

Installing OpenNI SDK on Windows

Double-click the provided msi file to install the SDK on your Windows machine.

The installation performs the following:

  • Copies the SDK to the target directory (default is C:\Program Files\OpenNI2 or C:\Program Files (x86)\OpenNI2)
  • Installs a USB driver to be used with OpenNI-compliant devices
  • Defines environment variables to be used when developing OpenNI applications (see Visual Studio)

Creating new project that uses OpenNI

Visual Studio

  1. Open a new project or an existing one with which you want to use OpenNI
  2. In the Visual Studio menu, open the Project menu and choose Project Properties.
  3. In the C/C++ section, under the "General" node, select "Additional Include Directories" and add "$(OPENNI2_INCLUDE)" (if you use the 32-bit version) or "$(OPENNI2_INCLUDE64)" (if you use the 64-bit version). These are environment variables that point to the location of the OpenNI Include directory. (The defaults are C:\Program Files\OpenNI2\Include or C:\Program Files (x86)\OpenNI2\Include)我填的是绝对路径。不是绝对路径的话不识别,可能应该需要配置环境变量?
  4. In the Linker section, under the "General" node, select "Additional Library Directories" and add "$(OPENNI2_LIB)" (if you use the 32-bit version) or "$(OPENNI2_LIB64)" (if you use the 64-bit version). These are environment variables that point to the location of the OpenNI Lib directory. (The defaults are C:\Program Files\OpenNI2\Lib or C:\Program Files (x86)\OpenNI2\Lib)
  5. In the Linker section, under the input node, select "Additional Dependencies" and add OpenNI2.lib or OpenNI2.lib
  6. Ensure that you add the Additional Include and Library directories to both your Release and Debug configurations.
  7. Copy all the files from OpenNI's redist directory (see environment variable "$(OPENNI2_REDIST)" or "$(OPENNI2_REDIST64)") to your working directory. (The defaults are C:\Program Files\OpenNI2\Redist or C:\Program Files (x86)\OpenNI2\Redist). Be aware that when you run from command line, the working directory is the directory where the executable can be found, and where you run from Visual Studio the default directory is where the project file (.vcproj, .vcxproj) can be found.

    Note

    You may ask Visual Studio to change working directory when debugging to the directory where the executable is by chaning "Project Properties" -> "Debugging" -> "Working Directory" to "$(TargetDir)". Note that this setting is not kept as part of the project settings, but on a per-user, per-configuration basis.

#include <astra/astra.hpp>

#include <cstdio>
#include <iostream>
int main(int argc, char** argv)
{
	astra::initialize();

	astra::StreamSet streamSet;
	astra::StreamReader reader = streamSet.create_reader();

	reader.stream<astra::DepthStream>().start();

	const int maxFramesToProcess = 100;
	int count = 0;

	do {
		astra::Frame frame = reader.get_latest_frame();
		const auto depthFrame = frame.get<astra::DepthFrame>();

		const int frameIndex = depthFrame.frame_index();
		const short pixelValue = depthFrame.data()[0];

		std::cout << std::endl
			<< "Depth frameIndex: " << frameIndex
			<< " pixelValue: " << pixelValue
			<< std::endl
			<< std::endl;

		count++;
	} while (count < maxFramesToProcess);

	std::cout << "Press any key to continue...";
	std::cin.get();

	astra::terminate();

	std::cout << "hit enter to exit program" << std::endl;
	std::cin.get();

	return 0;
}

运行时出现错误:由于找不到astra_core.dll,无法继续执行代码。重新安装程序可能会解决此问题。

将AstraSDK\bin文件夹下的astra.dll、astra_core.dll、astra_core_api.dll文件复制到C:\Windows\System32文件夹下。

 

  • 2
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 17
    评论
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值