参考:https://community.arm.com/graphics/b/blog/posts/cartoonifying-images-on-raspberry-pi-with-the-compute-library?CommentSortBy=CreatedDate&CommentSortOrder=Descending

根据官方博客进行测试ACL:Cartoonifying Images on Raspberry Pi with the Compute Library

我的情况是:我借助matlab实现与树莓派的远程连接,matlab的作用主要是传输文件用的和远程连接。

1、我是在树莓派上进行编译的

官方代码是:

# Install dependencies (g++, git and scons)
sudo apt-get install g++ git scons # Clone Compute Library
git clone https://github.com/Arm-software/ComputeLibrary.git # Enter ComputeLibrary folder
cd ComputeLibrary # Build the library and the examples
scons Werror=1 debug=0 asserts=0 neon=1 opencl=0 examples=1 build=native -j2

我是直接在电脑上载好的,然后传给树莓派,直接下太慢了
用:putFile(mypi,'C:/Users/NEVERGUVEIP/ComputeLibrary-#master.zip','/home/pi/')  进行文件的传输,然后进行解压

当我进行第一次编译时,应该是没有问题的,但是当我安装第二个ACL库,经行第二次编译时,系统报错,说是没有target “-j2”.

(我直接运行scons,后面的一堆参数都没用,我感觉只删除‘-j2’应该就行了,因为直接scons的话,编译时间太长了。还有这个-j2我现在都不知道啥意思。)

2、进行测试时

LD_LIBRARY_PATH=build/ ./build/examples/neon_convolution

我从git上直接下载的ACL版本应该时最新版的吧,这时的neon_convolution不在build下,而是在examples文件夹下,这样测试时就能通过了。直接运行官方代码会报错。说找不到文件。

3、运行实例时

我把他们的代码直接复制到树莓派,新建一个test.cpp文件. 然后用g++编译。

home/pi/ComputeLibrary下面放的就是ACM的相关文件

一开始用g++ test.cpp,报错,说找不到头文件。

3.1 编译报错(1)

arm_compute/runtime/NEON/NEFunctions.h:28:69: fatal error:

arm_compute/runtime/NEON/functions/NEAbsoluteDifference.h:No such file or directory

#include "arm_compute/runtime/NEON/functions/NEAbsoluteDifference.h"

解决方法:编译时要添加路径:就是-I后面的路径,不然总是报错,找不到头文件。

g++ -I/home/pi/ComputeLibrary test.cpp 

3.2 编译报错(2)

/home/pi/ComputeLibrary/support/Half.h:36:25: fatal error: half/half.hpp: No such file or directory

#include "half/half.hpp"

解决办法:

这是因为half.cpp文件已经不在half文件下了,用sudo find -name  half.hpp可以发现这个文件在include文件夹下,所以修改

/home/pi/ComputeLibrary/support/Half.h文件中#include "half/half.hpp"为:#include "include/half/half.hpp"

3.3 继续编译报错(3)

utils/Utils.h:33:26: fatal error: libnpy/npy.hpp: No such file or directory

#include "libnpy/npy.hpp"

这个和上个错误一样,打开utils/Utils.h文件,修改为 #include "include/libnpy/npy.hpp"

3.4  编译继续报错

test.cpp:24:5: error: ‘PPMLoader’ was not declared in this scope
     PPMLoader ppm;
     ^~~~~~~~~
test.cpp:25:5: error: ‘ppm’ was not declared in this scope
     ppm.open(argv[1]);

心里mmp呀,这TM还能让人好好玩耍吗。

解决办法:PPMLoader是在:#include "utils/ImageLoader.h"头文件下。把这个代码加到头文件中

3.5 还报错,我已经到崩坏的边缘了,别惹我

In file included from test.cpp:4:0:
utils/ImageLoader.h:36:27: fatal error: stb/stb_image.h: No such file or directory
 #include "stb/stb_image.h"

解决方法:和前俩个错误一样,修改ImageLoader.h的文件的中“ #include "stb/stb_image.h"”,为 #include "include/stb/stb_image.h"
。。。。。。。。。。。。。。。。

3.6 理论上经过修改的代码是没有问题了,可是进行g++编译时,还是报错,这次的错,呵呵,感觉解决不了,或者说这就不应该这样编译。因为我使用g++对系统自带的源码进行编译时,报了同样的错。

/tmp/ccvZEwyw.o: In function `arm_compute::TensorInfo::~TensorInfo()':
neon_cartoon_effect.cpp:(.text._ZN11arm_compute10TensorInfoD2Ev[_ZN11arm_compute10TensorInfoD5Ev]+0x38): undefined reference to `vtable for arm_compute::TensorInfo'
collect2: error: ld returned 1 exit status
/

在解决bug的途中,直到我发现了真相

4、总结(真相)

4.1真相

其实这个例子是包含在ACL中的,在examples 下找到neon_cartoon_effect.cpp 。

在ACM18.11版本中的源码为:这个源码和官方博客中的代码有不点区别了的。我们进行scons时,已经进行编译过了的。

#include "arm_compute/runtime/NEON/NEFunctions.h"#include "arm_compute/core/Types.h"
#include "utils/ImageLoader.h"
#include "utils/Utils.h"using namespace arm_compute;
using namespace utils;class NEONCartoonEffectExample : public Example
{
public:bool do_setup(int argc, char **argv) override{// Open PPM filePPMLoader ppm;if(argc < 2){// Print helpstd::cout << "Usage: ./build/neon_cartoon_effect [input_image.ppm]\n\n";std::cout << "No input_image provided, creating a dummy 640x480 image\n";// Create an empty grayscale 640x480 imagesrc_img.allocator()->init(TensorInfo(640, 480, Format::U8));}else{ppm.open(argv[1]);ppm.init_image(src_img, Format::U8);}// Initialize just the dimensions and format of the images:gaus5x5_img.allocator()->init(*src_img.info());canny_edge_img.allocator()->init(*src_img.info());dst_img.allocator()->init(*src_img.info());// Configure the functions to callgaus5x5.configure(&src_img, &gaus5x5_img, BorderMode::REPLICATE);canny_edge.configure(&src_img, &canny_edge_img, 100, 80, 3, 1, BorderMode::REPLICATE);sub.configure(&gaus5x5_img, &canny_edge_img, &dst_img, ConvertPolicy::SATURATE);// Now that the padding requirements are known we can allocate the images:src_img.allocator()->allocate();dst_img.allocator()->allocate();gaus5x5_img.allocator()->allocate();canny_edge_img.allocator()->allocate();// Fill the input image with the content of the PPM image if a filename was provided:if(ppm.is_open()){ppm.fill_image(src_img);output_filename = std::string(argv[1]) + "_out.ppm";}return true;}void do_run() override{// Execute the functions:gaus5x5.run();canny_edge.run();sub.run();}void do_teardown() override{// Save the result to file:if(!output_filename.empty()){save_to_ppm(dst_img, output_filename); // save_to_ppm maps and unmaps the image to store as PPM}}private:Image                   src_img{}, dst_img{}, gaus5x5_img{}, canny_edge_img{};NEGaussian5x5           gaus5x5{};NECannyEdge             canny_edge{};NEArithmeticSubtraction sub{};std::string             output_filename{};
};/** Main program for cartoon effect test** @param[in] argc Number of arguments* @param[in] argv Arguments ( [optional] Path to PPM image to process )*/
int main(int argc, char **argv)
{return utils::run_example<NEONCartoonEffectExample>(argc, argv);
}

4.2 测试图片

LD_LIBRARY_PATH=build/ ./build/examples/neon_cartoon_effect  school_bus.ppm

4.2 测试效果图

左边是原图,右边是效果图。老子老吃饭去了/ 一个来自对c++不懂人的呐喊

树莓派3B+运行arm_computer_library相关推荐

  1. 树莓派3B运行srsLTE

    树莓派3B运行srsLTE 一.添加SIM卡的配置信息 二.修改enb配置信息 三.修改epc配置信息 四.修改手机SIM卡配置信息 五.运行srsLTE 六.升级srsLTE 七.升级libboos ...

  2. 树莓派3B运行OP-TEE

    需要设备 电脑一台(我的是ubuntu14.04). 树莓派3B(op-tee支持的版本)包括电源.USB转串口模块(例CP2102模块) 一.在电脑上编译OP-TEE 安装需要的包: $sudo a ...

  3. 使用qemu在windows系统下搭建树莓派3b环境运行RT-Thread

    需要下载的资源 表1 下载资源 序号 资源名称 下载地址 说明 1 raspi3b_run_rt_thread_in_Qemu.rar https://download.csdn.net/downlo ...

  4. gpio引脚介绍 树莓派3b_如何让LabVIEW程序运行在树莓派3B(此处有坑)

    上次转载了LabVIEW部署树莓派的文章后,很多小伙伴很兴趣,一个个都说要把压箱底的树莓派拿出来清下灰尘,也不知道到底拿出来没有. 放个之前文章链接如下: 零基础上手树莓派+免费正版LabVIEW C ...

  5. Vxworks7运行在树莓派 3B/3B+

    在树莓派3B+ 上SDK搭建vxworks7 环境 介绍 配置开发环境软件 主机 树莓派3B/3B+ HELLOWORLD 应用程序开发(RTP) DKM程序HelloWorld 参考: 介绍 VxW ...

  6. 树莓派3b写PHP代码可以吗,如何让LabVIEW程序运行在树莓派3B(此处有坑)

    原标题:如何让LabVIEW程序运行在树莓派3B(此处有坑) 上次转载了LabVIEW部署树莓派的文章后,很多小伙伴很兴趣,一个个都说要把压箱底的树莓派拿出来清下灰尘,也不知道到底拿出来没有. 放个之 ...

  7. 树莓派3B+使用0.96 oled 屏幕(附完整可运行代码)

    树莓派3B+使用 0.96寸oled 屏幕(附完整可运行代码) 一.基本配置 先阅读以下博客较为详解,完成基本配置以及相关代码的说明 0.96寸OLED 使用树莓派的I2C协议调用wiringPiI2 ...

  8. 树莓派3b+目标检测: tflite 运行 mobilenet ssd

    1. 硬件环境:树莓派3b+和USB摄像头 2. 操作系统:2019-09-26-raspbian-buster.zip https://downloads.raspberrypi.org/raspb ...

  9. 64位树莓派运行linux,树莓派3B+安装64位debian GUN/Linux系统

    经过前段时间的努力,已经成功的将debian的ARM64版本跑在了树莓派3B+上.独乐乐不如众乐乐,所以将自己努力的成果分享,并详细介绍安装教程,希望能为树莓派爱好者做出些许贡献. 我已经制作好了镜像 ...

最新文章

  1. flask_sqlalchemy 多对多重复插入解决办法
  2. Python的StringIO模块和cStringIO模块
  3. 承载千万级并发的分布式系统架构设计思想
  4. vue 请求多个api_vue 一个input同时请求两个接口
  5. 怎么这两天总能看到刺激我的好东西
  6. pygame render怎么显示中文_PyGame开发游戏(2D)02.基础图元
  7. android textview doubleclick,Android的TextView的双击事件监听
  8. Xshell 登录 AWS CentOS 出现“所选择的用户秘钥未在远程主机上注册“,最终解决办法!...
  9. 【番外篇】ASP.NET MVC快速入门之免费jQuery控件库(MVC5+EF6)
  10. MacBook邮件登陆163邮箱,解决无法验证账户名或密码的问题
  11. 文件系统FatFsR0.09a翻译(三):ff.h
  12. 编译原理 3.28 课堂作业
  13. 单生狗必备之如何用Python给PLMM表白
  14. ClickHouse快速安装-可视化工具连接-创建第一个ck库表(一)
  15. Ubuntu14.04 64位+Python3.4环境下安装matplotlib的方法
  16. Javascript特效:点名册(随机点名)
  17. 适配器模式(对象适配器)
  18. 用PHP进行Web编程
  19. 情感日记:东部华侨城
  20. 魅族搭载鸿蒙的机型,魅族宣布接入鸿蒙系统 魅族鸿蒙系统手机是哪些?

热门文章

  1. js怎么在一个div中嵌入另一网站_好程序员web前端学习路线分享HTML5常见面试题集锦一...
  2. python批量修改word特定位置的内容_利用python批量修改word文件名的方法示例
  3. 科普 | Wi-Fi 6 十问十答
  4. android xutils数据库操作,XUtils3.0之本地数据库操作
  5. oracle 触发器 select :new,帮忙看下这个oracle触发器,在select后面的where语句有有关问题,但不知道什么有关问题...
  6. PHP引用全局作用域中可用的全部变量是,php全局变量之学习笔记
  7. 联想拯救者y7000电池耗电快_游戏新选择:联想2020款拯救者Y7000/R7000爆料
  8. anaconda python_机器学习用Python—Python集成工具包Anaconda安装步骤
  9. Linux 内核态与用户态通信 netlink
  10. 4号团队-团队任务5:项目总结会