English|[中文](README_CN.md)
**This sample provides reference for you to learn the Ascend AI Software Stack and is not for commercial purposes.**
**This sample applies to Ascend camera 3.0.0 and later versions, and supports Atlas 200 DK and Atlas 300 ([AI1s](https://support.huaweicloud.com/en-us/productdesc-ecs/ecs_01_0047.html#ecs_01_0047__section78423209366)).**
**This document provides only guidance for running the sample in CLI mode. For details about how to run the sample in MindStudio, see [Running Video Samples in MindStudio](https://gitee.com/ascend/samples/wikis/Mindstudio%E8%BF%90%E8%A1%8C%E8%A7%86%E9%A2%91%E6%A0%B7%E4%BE%8B?sort_id=3170138).**
## Ascend Camera Sample
Function: use a camera to shoot photos or videos.
Input: Camera
Output: The inference results are displayed on the Presenter Server WebUI, or the data is saved to the local host.
### Prerequisites
Before deploying this sample, ensure that:
- The environment has been prepared based on [Preparing Environment and Installing Dependencies](../../../environment).
- The development environment and operating environment of the corresponding product have been installed.
### Preparing Software
1. Obtain the source code package.
You can use either of the following methods to download the source code:
- Command line (The download takes a long time, but the procedure is simple.)
In the development environment, run the following commands as a non-root user to download the source code repository:
**cd $HOME**
**git clone https://gitee.com/ascend/samples.git**
- Compressed package (The download time is short, but the procedure is complex.)
1. Click **Clone or download** in the upper right corner of the samples repository and select **Download ZIP**.
2. Upload the .zip package to the home directory of a common user in the development environment, for example, **$HOME/ascend-samples-master.zip**.
3. In the development environment, run the following commands to decompress the .zip package:
**cd $HOME**
**unzip ascend-samples-master.zip**
### Deploying the Sample
1. Modify the Presenter-related configuration file.
Change **presenter\_server\_ip** and **presenter\_view\_ip** in the **scripts/param.conf** file in the sample directory to the IP addresses that can be pinged in the development environment. The following two cases are used as examples:
- Atlas 200 DK
1. In the development environment, run the **ifconfig** command to view available IP addresses.
2. In the development environment, change **presenter\_server\_ip** and **presenter\_view\_ip** in the **scripts/param.conf** file to the new IP addresses.
![](https://images.gitee.com/uploads/images/2020/1106/160652_6146f6a4_5395865.gif "icon-note.gif") **Note:**
> - 1\. If the development environment and operating environment are deployed on separate servers, the configured virtual NIC IP address is used, for example, **192.168.1.223**.
> - 2\. If the development environment and operating environment are deployed on the same server, the fixed IP address of Atlas 200 DK is used, for example, **192.168.1.2**.
- Atlas 300 AI accelerator card (AI1s cloud inference environment)
1. On the ECS console, check the available intranet IP address in the cloud environment of AI1s, for example, **192.168.0.198**.
2. In the development environment, change **presenter\_server\_ip** and **presenter\_view\_ip** in the **script/param.conf** file to the new IP addresses.
![](https://images.gitee.com/uploads/images/2020/1106/160652_6146f6a4_5395865.gif "icon-note.gif") **Note:**
> - You can also run the **ifconfig** command in the AI1s cloud environment to view the internal IP address.
> - The IP address for logging in to the AI1s cloud environment is the public IP address of the environment. The IP address obtained by running the **ifconfig** command in the AI1s cloud environment is the internal IP address of the environment.
2. Set the environment variables for compiling the dependencies in the command line of the development environment.
You can run the **uname -a** command in the command line to view the CPU architecture of the development environment and operating environment. If **x86\_64** is displayed in the command output, the x86 architecture is used. If **arm64** is displayed in the command output, the ARM architecture is used. Perform the following step based on the actual situation:
- If the CPU architecture of the development environment is the same as that of the operating environment, run the following commands to import environment variables:
**export DDK\_PATH=$HOME/Ascend/ascend-toolkit/latest/x86\_64-linux**
**export NPU\_HOST\_LIB=$DDK\_PATH/acllib/lib64/stub**
![](https://images.gitee.com/uploads/images/2020/1106/160652_6146f6a4_5395865.gif "icon-note.gif") Note:
> - If the version is 3.0.0, change **x86\_64-linux** in the **DDK\_PATH** environment variable to **x86\_64-linux\_gcc7.3.0**.
> - You can run the **uname -a** command in the command line to view the CPU architecture of the development environment and operating environment. If **x86\_64** is displayed in the command output, the x86 architecture is used. If **arm64** is displayed in the command output, the ARM architecture is used.
- If the CPU architecture of the development environment is different from that of the operating environment, run the following commands to import environment variables. If the development environment uses the x86 architecture and the operating environment uses the ARM architecture, the ACLlib of the ARM toolkit needs to be called during app build time because the toolkits of both the x86 and ARM architectures are deployed in the development environment. Therefore, you need to import the path of the ARM ACLlib.
**export DDK\_PATH=$HOME/Ascend/ascend-toolkit/latest/arm64-linux**
**export NPU\_HOST\_LIB=$DDK\_PATH/acllib/lib64/stub**
![](https://images.gitee.com/uploads/images/2020/1106/160652_6146f6a4_5395865.gif "icon-note.gif") **Note:**
> - If the version is 3.0.0, change **arm64-linux** in the **DDK\_PATH** environment variable to **arm64-linux\_gcc7.3.0**.
3. Go to the **ascendcamera** directory and create a directory for storing compilation files. For example, the created directory in this document is **build/intermediates/host**.
**cd $HOME/samples/cplusplus/level1\_single\_api/5\_200dk\_peripheral/ascendcamera**
**mkdir -p build/intermediates/host**
4. Go to the **build/intermediates/host** directory and run the **cmake** command to generate a compilation file.
- If the development environment and operating environment have the same OS architecture, run the following commands to perform compilation.
**cd build/intermediates/host**
**make clean**
**cmake ../../../src -DCMAKE\_CXX\_COMPILER=g++ -DCMAKE\_SKIP\_RPATH=TRUE**
- When the OS architecture of the development environment is different from that of the operating environment, you need to use the cross compiler for compilation. For example, if the development environment uses the x86 architecture and the operating environment uses the ARM architecture, run the following commands to perform cross compilation:
**cd build/intermediates/host**
**make clean**
**cmake ../../../src -DCMAKE\_CXX\_COMPILER=aarch64-linux-gnu-g++ -DCMAKE\_SKIP\_RPATH=TRUE**
5. Run the **make** command. The generated executable file **main** is stored in the **ascendcamera/out** directory.
**make**
### Running the Sample (Saving the Image to the Local Host)
**Note: If the development environment and operating environment are deployed on the same server, skip step 1 and go to [step 2](#step_2).**
1
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
软件学院嵌入式物联网大作业-使用其搭载的垃圾分类算法进行分类基于python实现+源代码+文档说明+报告 - 小白不懂运行,下载完可以私聊问,可远程教学 该资源内项目源码是个人的课程设计,代码都测试ok,都是运行成功后才上传资源,答辩评审平均分达到96分,放心下载使用! ## 项目备注 1、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 2、本项目适合计算机相关专业(如计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载学习,也适合小白学习进阶,当然也可作为毕设项目、课程设计、作业、项目初期立项演示等。 3、如果基础还行,也可在此代码基础上进行修改,以实现其他功能,也可用于毕设、课设、作业等。 下载后请首先打开README.md文件(如有),仅供学习参考, 切勿用于商业用途。 --------
资源推荐
资源详情
资源评论
收起资源包目录
软件学院嵌入式物联网大作业-使用其搭载的垃圾分类算法进行分类基于python实现+源代码+文档说明+报告 (160个子文件)
feature_tests.bin 13KB
CMakeDetermineCompilerABI_CXX.bin 9KB
CMakeDetermineCompilerABI_C.bin 8KB
.build_project 209B
CMakeCCompilerId.c 18KB
feature_tests.c 688B
cmake.check_cache 85B
CMakeCXXCompiler.cmake 5KB
DependInfo.cmake 4KB
cmake_install.cmake 2KB
CMakeCCompiler.cmake 2KB
Makefile.cmake 2KB
cmake_clean.cmake 844B
CMakeDirectoryInformation.cmake 817B
CMakeSystem.cmake 402B
logging.conf 498B
param.conf 434B
config.conf 381B
host_version.conf 64B
ascend_camera_parameter.cpp 31KB
CMakeCXXCompilerId.cpp 17KB
main_process.cpp 14KB
camera.cpp 11KB
parameter_utils.cpp 10KB
output_info_process.cpp 9KB
gpio.cpp 9KB
utils.cpp 9KB
main.cpp 6KB
dvpp_resize.cpp 6KB
dvpp_jpege.cpp 4KB
dvpp_process.cpp 2KB
main.cpp 964B
led.cpp 602B
list.css 3KB
testvideo.css 1KB
dialog.css 1KB
base.css 1KB
feature_tests.cxx 10KB
loading.gif 8KB
.gitignore 56B
.gitignore 18B
ascend_camera_parameter.h 12KB
sample_venc.h 6KB
main_process.h 6KB
output_info_process.h 5KB
camera.h 5KB
parameter_utils.h 4KB
utils.h 4KB
ascend_camera_common.h 3KB
dvpp_jpegd.h 3KB
dvpp_resize.h 2KB
gpio.h 2KB
dvpp_jpege.h 2KB
dvpp_process.h 1KB
common.h 482B
led.h 118B
home.html 6KB
view.html 5KB
ascendcamera.iml 384B
CXX.includecache 15KB
depend.internal 14KB
socket.io.js 205KB
jquery-1.10.2.min.js 91KB
socket.io.min.js 71KB
dialog.js 3KB
dialog.min.js 2KB
index.js 0B
acl.json 2B
.keep 0B
.keep 0B
LICENSE 11KB
CMakeOutput.log 49KB
display.log 2KB
display.log 2KB
main 943KB
build.make 27KB
depend.make 18KB
flags.make 635B
progress.make 236B
Makefile 14KB
Makefile 536B
Makefile 29B
Makefile2 3KB
progress.marks 3B
README.md 17KB
README_CN.md 10KB
README.md 9KB
README.md 2KB
ascend_camera_parameter.cpp.o 1.58MB
parameter_utils.cpp.o 1.46MB
utils.cpp.o 144KB
camera.cpp.o 75KB
main_process.cpp.o 57KB
dvpp_resize.cpp.o 52KB
dvpp_jpege.cpp.o 50KB
output_info_process.cpp.o 49KB
main.cpp.o 38KB
dvpp_process.cpp.o 18KB
garbage_yuv.om 7.02MB
a.out 9KB
共 160 条
- 1
- 2
资源评论
机智的程序员zero
- 粉丝: 1954
- 资源: 4202
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功