Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and debug OpenNI-Linux-Arm64-2.3.0.66

2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

How to carry out OpenNI-Linux-Arm64-2.3.0.66 installation and debugging, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.

Recently, I have been studying a camera and plugged it into the board of Arm64 through USB for installation and debugging. Here I try to record the process.

1 download SDK

Download the corresponding system and version of SDK from the official website. Here is the Linux-ARM64 version, and the download is OpenNI-Linux-Arm64-2.3.0.66. Or wget link address

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 Mustang 2021-02-08 2015 3.0.66.zip is parsing the host abzg-oss.oss-cn-shenzhen.aliyuncs.com (abzg-oss.oss-cn-shenzhen.aliyuncs.com). 224.0.0.1 connecting 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 is connected. A HTTP request has been issued Waiting for a response. 200 OK length: 3758034 (3.6m) [application/zip] is being saved to: "OpenNI-Linux-Arm64-2.3.0.66.zip" OpenNI-Linux-Arm64-2.3.0.66.zip 100% [= >] 3.58m 7.57MB/s in 0.5s2021-02-08 20:57:27 (7.57MB/s)-saved "OpenNI-Linux-Arm64-2. 3.0.66.zip "[3758034amp 3758034])

Decompress it. The directory structure is as follows

-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 READMEdrwxrwxr-x 3 work work 4096 Jan 12 15:52 Redist-rw-rw-r-- 1 work work 1863 Sep 29 16:54 ReleaseNotes.txtdrwxrwxr-x 12 work work 4096 Jan 12 15 : 52 Samplesdrwxrwxr-x 3 work work 4096 Jan 12 15:52 Toolsdrwxrwxr-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

Read the README file, where

0 OpenNI-Linux-Arm64-2.3.0.66 > cat READMEOpenNI-Website: http://structure.io/openniBuilding Prerequisites==...Linux- GCC 4.x From: http://gcc.gnu.org/releases.html Or via apt: sudo apt-get install grubbing-Python 2.6 From 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-0Murray devo-LibUDEV sudo apt-get install libudev-dev- JDK 6.0From: 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.slnBuilding on Linux / OS X: Run : $makeCross-Compiling for ARM on Linux: The following environment variables should be defined:-ARM_CXX=-ARM_STAGING= Then Run: $PLATFORM=Arm makeBuilding for Android:-Create a workspace in eclipse-Import all projects under root directoryCreating OpenNI2 Package====- Go into the directory 'Packaging'- Run ReleaseVersion.py [x86 | x64 | Arm | Android]-Installer will be placed in the' Final' directoryBuilding 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`).

Some of the dependencies and installation methods needed to run the software are indicated here, so I won't repeat them here. Subsequent building and other operations are not required.

2 configuration

Execute the install.sh file in the unzipped directory

Sudo sh install.sh

The script does two things, adding UDEV rules to the camera device and writing the development environment to the OpenNIDevEnvironment file.

Cat OpenNIDevEnvironmentexport OPENNI2_INCLUDE=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.65/Includeexport OPENNI2_REDIST=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.65/Redist

Notice the Include of the first environment variable, the actual directory name is include, remember to change it (either change the directory name to uppercase, or change the environment variable to lowercase, I choose to change the environment variable here. )

Then load it to make it take effect.

Source OpenNIDevEnvironment

Check it out.

Env | grep OPENNI2_INCLUDEOPENNI2_INCLUDE=/home/work/abc/OpenNI-Linux-Arm64-2.3.0.66/include3 test

In the Samples directory, we can see many examples

Drwxrwxr-x 3 work work 4096 Jan 20 22:10 Bindrwxrwxr-x 2 work work 4096 Jan 20 22:10 ClosestPointViewerdrwxrwxr-x 2 work work 4096 Jan 20 22:10 EventBasedReaddrwxrwxr-x 2 work work 4096 Jan 20 22:10 MWClosestPointdrwxrwxr-x 2 work work 4096 Jan 20 22:10 MWClosestPointAppdrwxrwxr-x 2 work work 4096 Jan 20 22:10 MultiDepthViewerdrwxrwxr-x 3 work work 4096 Feb 8 17:28 MultipleStreamReaddrwxrwxr-x 3 work work 4096 Jan 21 20:06 SimpleReaddrwxrwxr-x 3 work work 4096 Jan 27 10:59 SimpleViewerdrwxrwxr-x 3 work work 4096 Jan 20 22:10 SimpleViewer.java

Let's take SimpleRead as an example to test it. Enter the directory with the following structure:

Total dosage 52drwxrwxr-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. 1 work work 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.cpp3.1 Makefileinclude CommonDefs.makBIN_DIR = BinINC_DIRS =\.. /.. / Include\.. / CommonSRC_FILES = * .cppUSED_LIBS + = OpenNI2EXE_NAME = SimpleReadCFLAGS + =-Wallifndef 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) endifINC_DIRS + = $(OPENNI2_INCLUDE) include CommonCppMakefile.PHONY: copy-redistcopy-redist: cp-R $(OPENNI2_REDIST) / * $(OUT_DIR) $(OUTPUT_FILE): copy-redist

Change the.. /.. / Include\ in INC_DIRS to the actual.. / include\, while the.. / Common directory doesn't really exist and can be commented out.

3.2 Source Code

Main.cpp file

/ * 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 "ASIS" 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 / / 2000msusing 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("[llu] %8d\n", (long long)frame.getTimestamp(), pDepth[middleIndex]); } depth.stop(); depth.destroy(); device.close(); OpenNI::shutdown(); return 0;} 其实是将镜头中心的点所获取到的深度信息不断地进行输出。 3.3 编译make 输出 mkdir -p Bin/Intermediate/Arm64-Release/SimpleReadg++ -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.cppmkdir -p Bin/Arm64-Releasecp -R /home/work/abc/OpenNI-Linux-Arm64-2.3.0.66/Redist/* Bin/Arm64-Releaseg++ -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.cpp3.4 执行0 SimpleRead >

/ Bin/Arm64-Release/SimpleReadWarning: 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...

As you can see, the depth information is output here.

At this point, we have successfully installed OpenNI on Linux/Ubuntu16.04-Arm64.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report