iPhone 中图像的直方图
我正在寻找一种在 iPhone 上获取图像直方图的方法。 OpenCV 库太大,无法包含在我的应用程序中(OpenCV 编译后大约有 70MB),但我可以使用 OpenGL。但是,我不知道如何执行其中任何一个。
我已经找到了如何获取图像的像素,但无法形成直方图。这看起来应该很简单,但我不知道如何将 uint8_t 存储到数组中。
以下是查找像素的相关问题/答案:
I am looking for a way to get a histogram of an image on the iPhone. The OpenCV library is way too big to be included in my app (OpenCV is about 70MB compiled), but I can use OpenGL. However, I have no idea on how to do either of these.
I have found how to get the pixels of the image, but cannot form a histogram. This seems like it should be simple, but I don't know how to store uint8_t into an array.
Here is the relevant question/answer for finding pixels:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
uint8_t* 只是一个指向 ac 数组的指针,其中包含给定颜色的字节,即 {r, g, b, a} 或图像缓冲区的任何颜色字节布局。
因此,参考您提供的链接以及直方图的定义:
The uint8_t* is just a pointer to a c array containing the bytes of the given color, i.e. {r, g, b, a} or whatever the color byte layout is for your image buffer.
So, referencing the link you provided, and the definition of histogram:
您可以使用 CGRef 获取图像的 RGB 颜色。看看我为此使用的以下方法。
You can take RGB color of your image with CGRef. Look at the below method which I used for this.