简体   繁体   中英

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. 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?

For example, OpenCV function "grabCut" takes more than 1 second to detect certain foreground objects. How can I reduce the processing time down to 10ms at least using Metal?

You can't call OpenCV functions from Metal.

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.

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. If you can find the CUDA source code, it's usually a relatively straightforward port.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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