将arm_compute :: Image转换为cv :: Mat [英] convert arm_compute::Image to cv::Mat

查看:129
本文介绍了将arm_compute :: Image转换为cv :: Mat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多基于开放式cv的代码,但是Arm Compute库可以通过多种方式提高性能,因此id喜欢将一些arm计算库代码集成到我的项目中.有没有人尝试过在两个相应的图像结构之间转换?如果是这样,您做了什么?还是有一种方法可以共享指向基础数据缓冲区的指针,而无需复制图像数据,而只需适当地设置步幅和标志?

I have a lot of code that is based on open cv but there are many ways in which the Arm Compute library improves performance, so id like to integrate some arm compute library code into my project. Has anyone tried converting between the two corresponding Image structures? If so, what did you do? Or is there a way to share a pointer to the underlying data buffer without needing to copy image data and just set strides and flags appropriately?

推荐答案

我能够配置与我的cv :: Mat属性相对应的arm_compute :: Image,分配内存,并将其指向我的cv的数据部分:垫子.

I was able to configure an arm_compute::Image corresponding to my cv::Mat properties, allocate the memory, and point it to the data portion of my cv:Mat.

这样,我可以使用arm_compute有效地处理映像,并维护我在项目其余部分中拥有的opencv基础结构.

This way, I can process my image efficiently using arm_compute and maintain the opencv infrastructure I had for the rest of my project.

// cv::Mat mat defined and initialized above
arm_compute::Image image;

image.allocator()->init(arm_compute::TensorInfo(mat.cols, mat.rows, Format::U8));
image.allocator()->allocate();
image.allocator()->import_memory(Memory(mat.data));

这篇关于将arm_compute :: Image转换为cv :: Mat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆