简体   繁体   English

如何在iOS的Metal中使用OpenCV函数?

[英]How to use OpenCV functions in Metal on iOS?

I have developed the Xcode project that uses OpenCV functions for image processing when the iPhone camera live stream. 我已经开发了Xcode项目,该项目使用OpenCV功能在iPhone摄像机直播时进行图像处理。 It takes some time to process one frame and doesn't look like real time. 处理一帧需要花费一些时间,看起来并不实时。 Is it possible to accelerate the calculation by integrating OpenCV and Metal? 通过集成OpenCV和Metal可以加速计算吗?

For example, OpenCV function "grabCut" takes more than 1 second to detect certain foreground objects. 例如,OpenCV函数“ grabCut”花费1秒钟以上的时间来检测某些前景对象。 How can I reduce the processing time down to 10ms at least using Metal? 如何至少使用Metal缩短处理时间至10ms?

You can't call OpenCV functions from Metal. 您不能从Metal调用OpenCV函数。

If you want to speed up this algorithm, you could try porting it to Metal but that's only an option if the algorithm -- or major parts of it -- are highly parallel. 如果要加快此算法的速度,可以尝试将其移植到Metal,但这仅是算法(或其主要部分)高度并行的一种选择。

Now, it looks like grabCut has a CUDA implementation (which I found by googling for "grabcut cuda"), which means that implementing this in Metal might actually be worth doing. 现在,好像grabCut具有CUDA实现(我通过谷歌搜索“ grabcut cuda”发现),这意味着在Metal中实现此功能可能确实值得。 If you can find the CUDA source code, it's usually a relatively straightforward port. 如果可以找到CUDA源代码,那么它通常是一个相对简单的端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM