iPhone 上的图像处理

发布于 2024-08-19 01:46:50 字数 139 浏览 6 评论 0 原文

我想对 iPhone 拍摄的照片进行图像处理。 此处理将涉及 2D 矩阵卷积等。

我担心嵌套 NSArray 的性能会非常糟糕。操作基于像素的图像的正确方法是什么?我应该简单地使用通过 malloc 分配的 C 数组吗?

I would like to apply image processing on pictures taken on the iPhone.
This processing would involve 2D matrix convolutions etc.

I'm afraid that the performance with nested NSArrays would be pretty bad. What is the right way to manipulate pixel based images? Should I simply use C arrays allocated with malloc?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

傲世九天 2024-08-26 01:46:50

您是否看过Quartz 2D 引擎?或者也许是核心显卡? Apple 有一个很好的概述文档,描述了所有可用的不同成像技术在 iPhone 上。不幸的是,iPhone 上还没有像 ImageKit 这样好的东西。

Have you looked at the Quartz 2D engine available in the iPhone SDK? Or perhaps Core Graphics? Apple has a nice overview document describing all the different imaging technologies available on the iPhone. Unfortunately there isn't anything as nice as ImageKit on the iPhone yet.

请叫√我孤独 2024-08-26 01:46:50

我建议使用 OpenCV 图像处理库,因为它包含几乎适合您想要的任何内容的优化算法。 OpenCV 肯定比使用 NSArray 进行手动处理要快。
但有一个主要缺点 - OpenCV 库是用 C/C++ 编写的,因此您必须将 NSImage 转换为原生 OpenCV 图像格式才能进行处理。但用谷歌搜索如何做到这一点真的很容易。
我在自己的 iPhone 项目中使用 OpenCV,这里是为 iPhone 构建 OpenCv 的小帖子:http://computer-vision-talks.com/2010/12/building-opencv-for-ios/

I suggest to use OpenCV image processing library since it contains well optimized algorithms almost for anything you want. OpenCV will be definitely faster than using manual processing with NSArray.
But there are one major drawback - OpenCV library is written on C/C++, so you will have to convert your NSImage to native OpenCV image format to do processing. But it's really easy to google how to do this.
I use OpenCV in my own iPhone project, here is small how-to post of building OpenCv for IPhone: http://computer-vision-talks.com/2010/12/building-opencv-for-ios/

几度春秋 2024-08-26 01:46:50

是的,您可以使用 C 数组,因为这就是您获取像素数据的方式。

如前所述,您应该查看是否可以使用 Quartz2D 来执行您感兴趣的操作,因为基于硬件它可能会表现得更好。如果没有,只需对像素数组进行自己的操作即可。

Yes, you would use a C array since that's how you get back the pixel data anyway.

As mentioned, you should look and see if you can use Quartz2D to do the manipulations you are interested in as it would probably perform better being hardware based. If not, just do your own over the array of pixels.

过去的过去 2024-08-26 01:46:50

iPhone还支持OpenCL,它的GPU比CPU具有更强的处理能力。

The iPhone also supports OpenCL, and it's GPU has way more processing power than the CPU.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文