如何从opencv 3.0 Beta中的文件读取UMat? [英] How to read UMat from a file in opencv 3.0 Beta?

查看:188
本文介绍了如何从opencv 3.0 Beta中的文件读取UMat?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用UMat,因此我的代码可以使用OpenCL(Op​​enCV 3.0.0 Beta)在GPU和CPU上运行.

I want to use UMat so my code can be run on both GPU and CPU using OpenCL (OpenCV 3.0.0 Beta).

,但是我找不到将图像文件读入UMat或将Mat转换为UMat的方法.

but I can not find a way to read an image file into a UMat or convert a Mat to UMat.

如何将图像读入UMat?

推荐答案

以下是MatUMat转换的示例. Coudlnt可以找到有关此文档.因此,唯一的选择是阅读源代码.

Sample for Mat to UMat conversion is below. Coudlnt' find documentation for this. So only option was to read the source.

UMat img = imread( "lena.jpg", IMREAD_COLOR  ).getUMat( ACCESS_READ );

中的不同访问标志来源

ACCESS_READ, ACCESS_WRITE, ACCESS_RW, ACCESS_FAST

对于不受欢迎的UMat使用情况,可以提供完整的面部检测示例

For undestanding UMat usage, a complete sample for face detection is available here. Also note that documentation still refers to older flags as imread second parameter. You might need to use newer flags as in your OpenCV header file.

这篇关于如何从opencv 3.0 Beta中的文件读取UMat?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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