符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
如何进行OpenNI-Linux-Arm64-2.3.0.66安装与调试,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。
创新互联建站-专业网站定制、快速模板网站建设、高性价比雷州网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式雷州网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖雷州地区。费用合理售后完善,10年实体公司更值得信赖。
最近在研究某摄像头,通过USB插入到Arm64的板子上进行安装调试,这里尝试着把过程记录下来。
从官网上下载相应系统和版本的SDK,我这里是Linux-ARM64版本的,下载的是 OpenNI-Linux-Arm64-2.3.0.66 。或者wget链接地址
proxychains4 wget https://abzg-oss.oss-cn-shenzhen.aliyuncs.com/files/OpenNI-Linux-Arm64-2.3.0.66.zip [proxychains] config file found: /etc/proxychains.conf [proxychains] preloading /usr/local/lib/libproxychains4.so [proxychains] DLL init: proxychains-ng 4.14 --2021-02-08 20:57:26-- https://abzg-oss.oss-cn-shenzhen.aliyuncs.com/files/OpenNI-Linux-Arm64-2.3.0.66.zip 正在解析主机 abzg-oss.oss-cn-shenzhen.aliyuncs.com (abzg-oss.oss-cn-shenzhen.aliyuncs.com)... 224.0.0.1 正在连接 abzg-oss.oss-cn-shenzhen.aliyuncs.com (abzg-oss.oss-cn-shenzhen.aliyuncs.com)|224.0.0.1|:443... [proxychains] Strict chain ... 172.18.6.135:8001 ... abzg-oss.oss-cn-shenzhen.aliyuncs.com:443 ... OK 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度: 3758034 (3.6M) [application/zip] 正在保存至: “OpenNI-Linux-Arm64-2.3.0.66.zip” OpenNI-Linux-Arm64-2.3.0.66.zip 100% [===================================>] 3.58M 7.57MB/s in 0.5s 2021-02-08 20:57:27 (7.57 MB/s) - 已保存 “OpenNI-Linux-Arm64-2.3.0.66.zip” [3758034/3758034])
解压,目录结构如下
-rw-rw-r-- 1 work work 9753 Sep 29 16:54 CHANGES.txt -rw-rw-r-- 1 work work 11358 Sep 29 16:54 LICENSE -rw-rw-r-- 1 work work 31653 Sep 29 16:54 NOTICE -rw-rw-r-- 1 work work 5615 Sep 29 16:54 README drwxrwxr-x 3 work work 4096 Jan 12 15:52 redist -rw-rw-r-- 1 work work 1863 Sep 29 16:54 ReleaseNotes.txt drwxrwxr-x 12 work work 4096 Jan 12 15:52 Samples drwxrwxr-x 3 work work 4096 Jan 12 15:52 Tools drwxrwxr-x 8 work work 4096 Jan 12 15:52 include -rw-rw-r-- 1 work work 2138 Mar 10 2020 install.sh -rw-rw-r-- 1 work work 1221 Sep 29 16:54 orbbec-usb.rules
阅读README文件,其中
0 OpenNI-Linux-Arm64-2.3.0.66 > cat README OpenNI ------ Website: http://structure.io/openni Building Prerequisites ====================== ... Linux ----- - GCC 4.x From: http://gcc.gnu.org/releases.html Or via apt: sudo apt-get install g++ - Python 2.6+/3.x From: http://www.python.org/download/ Or via apt: sudo apt-get install python - LibUSB 1.0.x From: http://sourceforge.net/projects/libusb/files/libusb-1.0/ Or via apt: sudo apt-get install libusb-1.0-0-dev - LibUDEV sudo apt-get install libudev-dev - JDK 6.0 From: http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html Or via apt: sudo apt-get install openjdk-6-jdk - FreeGLUT3 From: http://freeglut.sourceforge.net/index.php#download Or via apt: sudo apt-get install freeglut3-dev - Doxygen From: http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc Or via apt: sudo apt-get install doxygen - GraphViz From: http://www.graphviz.org/Download_linux_ubuntu.php Or via apt: sudo apt-get install graphviz ... Building ======== Building on Windows: Open the solution OpenNI.sln Building on Linux / OS X: Run: $ make Cross-Compiling for ARM on Linux: The following environment variables should be defined: - ARM_CXX=- ARM_STAGING= Then, run: $ PLATFORM=Arm make Building for Android: - Create a workspace in eclipse - Import all projects under root directory Creating OpenNI2 Package ======================== - Go into the directory 'Packaging' - Run ReleaseVersion.py [x86|x64|Arm|Android] - Installer will be placed in the 'Final' directory Building in an armhf qemu-enabled docker container ================================================== - Note: we're building from the osrf fork which has a couple of minor tweaks compared to the orbbec upstream repo (https://github.com/orbbec/OpenNI2/compare/orbbec-dev...osrf:orbbec-dev?expand=1): - don't force soft-float in third-party software (because we're building with hard-float) - disable documentation generation (because we don't need it, and also because doxygen seems to just hang in this environment). - Check out the code (because git doesn't work inside qemu): $ git clone https://github.com/osrf/OpenNI2 $ cd OpenNI2 $ git checkout orbbec-dev $ cd .. - Start docker, mounting in the git repo: $ docker run -ti -v `pwd`/OpenNI2:/tmp/OpenNI2 osrf/ubuntu_armhf:trusty bash - Now inside docker, install prereqs (we're removing udev because it somehow conflicts with libudev-dev; we're leaving out doxygen and graphviz because we're not going to build docs): # apt-get update # apt-get remove -y --force-yes udev # apt-get install -y build-essential python libusb-1.0-0-dev libudev-dev openjdk-6-jdk freeglut3-dev - Still inside docker, build the release package (note that, instead of running `ReleaseVersion.py` inside `Packaging`, you could just run `make HAS_JAVA=1 release` at the top level): # cd /tmp/OpenNI2/Packaging # ./ReleaseVersion.py Arm - If all goes well, there will be a file in the docker container called something like `/tmp/OpenNI2/Packaging/Final/OpenNI-Linux-Arm-2.3.tar.bz2`. It's also in the corresponding place in the host filesystem, so it will survive exiting the container. That file contains the compiled libraries (importantly, `OpenNI-Linux-Arm-2.3/Redist/libOpenNI2.so`).
这里指明了一些软件运行所需的依赖和安装方法,这里就不再赘述。后续的 building 等不是必须的操作。
在解压后的目录中,执行 install.sh 文件
sudo sh install.sh
该脚本一共做了两件事,为摄像头设备增加UDEV规则,把开发环境写到 OpenNIDevEnvironment
文件中。
cat OpenNIDevEnvironment export OPENNI2_INCLUDE=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.65/Include export OPENNI2_REDIST=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.65/Redist
注意第一个环境变量的Include,实际的目录名称为 include,记得改过来(要么把目录名称改成大写,要么把环境变量改成小写,我这里是选择改环境变量。)
然后再进行加载使其生效。
source OpenNIDevEnvironment
检查一下
env | grep OPENNI2_INCLUDE OPENNI2_INCLUDE=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.66/include
在Samples目录下,我们可以看到很多样例
drwxrwxr-x 3 work work 4096 Jan 20 22:10 Bin drwxrwxr-x 2 work work 4096 Jan 20 22:10 ClosestPointViewer drwxrwxr-x 2 work work 4096 Jan 20 22:10 EventBasedRead drwxrwxr-x 2 work work 4096 Jan 20 22:10 MWClosestPoint drwxrwxr-x 2 work work 4096 Jan 20 22:10 MWClosestPointApp drwxrwxr-x 2 work work 4096 Jan 20 22:10 MultiDepthViewer drwxrwxr-x 3 work work 4096 Feb 8 17:28 MultipleStreamRead drwxrwxr-x 3 work work 4096 Jan 21 20:06 SimpleRead drwxrwxr-x 3 work work 4096 Jan 27 10:59 SimpleViewer drwxrwxr-x 3 work work 4096 Jan 20 22:10 SimpleViewer.java
我们就以SimpleRead为例,来测试一下。进入目录,结构如下:
总用量 52 drwxrwxr-x 2 work work 4096 Jan 12 15:52 . drwxrwxr-x 12 work work 4096 Jan 12 15:52 .. -rw-rw-r-- 1 work work 5080 Mar 10 2020 CommonCppMakefile -rw-rw-r-- 1 work work 1710 Mar 10 2020 CommonDefs.mak -rw-rw-r-- 1 work work 538 Mar 10 2020 CommonTargets.mak -rw-rw-r-- 1 work work 631 Mar 10 2020 Makefile -rw-rw-r-- 1 work work 3535 Mar 10 2020 OniSampleUtilities.h -rw-rw-r-- 1 work work 493 Mar 10 2020 Platform.Arm -rw-rw-r-- 1 work work 521 Mar 10 2020 Platform.Arm64 -rw-rw-r-- 1 work work 150 Mar 10 2020 Platform.x64 -rw-rw-r-- 1 work work 531 Mar 10 2020 Platform.x86 -rw-rw-r-- 1 work work 3500 Mar 10 2020 main.cpp
include CommonDefs.mak BIN_DIR = Bin INC_DIRS = \ ../../Include \ ../Common SRC_FILES = *.cpp USED_LIBS += OpenNI2 EXE_NAME = SimpleRead CFLAGS += -Wall ifndef OPENNI2_INCLUDE $(error OPENNI2_INCLUDE is not defined. Please define it or 'source' the OpenNIDevEnvironment file from the installation) else ifndef OPENNI2_REDIST $(error OPENNI2_REDIST is not defined. Please define it or 'source' the OpenNIDevEnvironment file from the installation) endif INC_DIRS += $(OPENNI2_INCLUDE) include CommonCppMakefile .PHONY: copy-redist copy-redist: cp -R $(OPENNI2_REDIST)/* $(OUT_DIR) $(OUTPUT_FILE): copy-redist
把 INC_DIRS 中的 ../../Include \ 改成实际的 ../../include \,而 ../Common 目录其实并不存在,也可以注释掉。
main.cpp 文件
/***************************************************************************** * * * OpenNI 2.x Alpha * * Copyright (C) 2012 PrimeSense Ltd. * * * * This file is part of OpenNI. * * * * Licensed under the Apache License, Version 2.0 (the "License"); * * you may not use this file except in compliance with the License. * * You may obtain a copy of the License at * * * * http://www.apache.org/licenses/LICENSE-2.0 * * * * Unless required by applicable law or agreed to in writing, software * * distributed under the License is distributed on an "AS IS" BASIS, * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * * See the License for the specific language governing permissions and * * limitations under the License. * * * *****************************************************************************/ #include#include #include "OniSampleUtilities.h" #define SAMPLE_READ_WAIT_TIMEOUT 2000 //2000ms using namespace openni; int main(int argc, char* argv[]) { Status rc = OpenNI::initialize(); if (rc != STATUS_OK) { printf("Initialize failed\n%s\n", OpenNI::getExtendedError()); return 1; } Device device; if (argc < 2) rc = device.open(ANY_DEVICE); else rc = device.open(argv[1]); if (rc != STATUS_OK) { printf("Couldn't open device\n%s\n", OpenNI::getExtendedError()); return 2; } VideoStream depth; if (device.getSensorInfo(SENSOR_DEPTH) != NULL) { rc = depth.create(device, SENSOR_DEPTH); if (rc != STATUS_OK) { printf("Couldn't create depth stream\n%s\n", OpenNI::getExtendedError()); return 3; } } rc = depth.start(); if (rc != STATUS_OK) { printf("Couldn't start the depth stream\n%s\n", OpenNI::getExtendedError()); return 4; } VideoFrameRef frame; while (!wasKeyboardHit()) { int changedStreamDummy; VideoStream* pStream = &depth; rc = OpenNI::waitForAnyStream(&pStream, 1, &changedStreamDummy, SAMPLE_READ_WAIT_TIMEOUT); if (rc != STATUS_OK) { printf("Wait failed! (timeout is %d ms)\n%s\n", SAMPLE_READ_WAIT_TIMEOUT, OpenNI::getExtendedError()); continue; } rc = depth.readFrame(&frame); if (rc != STATUS_OK) { printf("Read failed!\n%s\n", OpenNI::getExtendedError()); continue; } if (frame.getVideoMode().getPixelFormat() != PIXEL_FORMAT_DEPTH_1_MM && frame.getVideoMode().getPixelFormat() != PIXEL_FORMAT_DEPTH_100_UM) { printf("Unexpected frame format\n"); continue; } DepthPixel* pDepth = (DepthPixel*)frame.getData(); int middleIndex = (frame.getHeight()+1)*frame.getWidth()/2; printf("[%08llu] %8d\n", (long long)frame.getTimestamp(), pDepth[middleIndex]); } depth.stop(); depth.destroy(); device.close(); OpenNI::shutdown(); return 0; }
其实是将镜头中心的点所获取到的深度信息不断地进行输出。
make
输出
mkdir -p Bin/Intermediate/Arm64-Release/SimpleRead g++ -MD -MP -MT "./Bin/Intermediate/Arm64-Release/SimpleRead/main.d Bin/Intermediate/Arm64-Release/SimpleRead/main.o" -c -march=armv8-a -O3 -fno-tree-pre -fno-strict-aliasing -ftree-vectorize -ffast-math -funsafe-math-optimizations -flax-vector-conversions -Wall -O2 -DNDEBUG -I../../include -I/home/work/abc/OpenNI-Linux-Arm64-2.3.0.66/include -DXN_NEON -fPIC -fvisibility=hidden -Werror -o Bin/Intermediate/Arm64-Release/SimpleRead/main.o main.cpp mkdir -p Bin/Arm64-Release cp -R /home/work/abc/OpenNI-Linux-Arm64-2.3.0.66/Redist/* Bin/Arm64-Release g++ -o Bin/Arm64-Release/SimpleRead ./Bin/Intermediate/Arm64-Release/SimpleRead/main.o -LBin/Arm64-Release -lOpenNI2 -Wl,-rpath ./
会发现目录下多了一个 Bin 目录
├── Bin │ ├── Arm64-Release │ │ ├── OpenNI.ini │ │ ├── OpenNI2 │ │ ├── SimpleRead │ │ ├── libDepthUtils.a │ │ ├── libOpenNI2.so │ │ └── libSonixCamera.a │ └── Intermediate │ └── Arm64-Release ├── CommonCppMakefile ├── CommonDefs.mak ├── CommonTargets.mak ├── Makefile ├── OniSampleUtilities.h ├── Platform.Arm ├── Platform.Arm64 ├── Platform.x64 ├── Platform.x86 └── main.cpp
0 SimpleRead > ./Bin/Arm64-Release/SimpleRead Warning: USB events thread - failed to set priority. This might cause loss of data... [00000000] 3501 [00033688] 3501 [00067376] 3537 [00101065] 3501 [00303195] 3501 [00336884] 3537 [00370572] 3501 [00404261] 3501 . . .
可以看到,这里就输出了深度信息。
至此,我们就把OpenNI在Linux/Ubuntu16.04-Arm64上安装成功了。
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。