ios - GPUImage 直方图均衡化

标签 ios objective-c image-processing opengl-es gpuimage

我想将 GPUImage 的直方图均衡过滤器 ( link to .h ) ( link to .m ) 用于相机应用。我想实时使用它,并将其作为一个选项呈现,以应用于实时摄像头。我知道这可能是一项昂贵的操作并会导致一些延迟。

我对这个过滤器的工作原理感到困惑。在 GPUImage 的示例项目 (Filter Showcase) 中选择时,滤镜显示非常暗的图像,偏向红色和蓝色,这似乎不是均衡工作的方式。

直方图类型 kGPUImageHistogramLuminance 和 kGPUImageHistogramRGB 之间有什么区别? Filter Showcase 使用 kGPUImageHistogramLuminance 但 init 中的默认值是 kGPUImageHistogramRGB。如果我将 Filter Showcase 切换为 kGPUImageHistogramRGB,我只会看到黑屏。我的目标是整体对比度优化。

有没有人有使用过这个过滤器的经验?或者在某处记录了此过滤器的当前限制?

最佳答案

RGB 图像的直方图均衡是使用亮度完成的,因为单独均衡 RGB channel 会使颜色信息变得无用。

您基本上将 RGB 转换为将颜色与强度信息分开的颜色空间。然后均衡强度图像,最后将其重新转换为 RGB。

根据文档:http://oss.io/p/BradLarson/GPUImage

GPUImageHistogramFilter: This analyzes the incoming image and creates an output histogram with the frequency at which each color value occurs. The output of this filter is a 3-pixel-high, 256-pixel-wide image with the center (vertical) pixels containing pixels that correspond to the frequency at which various color values occurred. Each color value occupies one of the 256 width positions, from 0 on the left to 255 on the right. This histogram can be generated for individual color channels (kGPUImageHistogramRed, kGPUImageHistogramGreen, kGPUImageHistogramBlue), the luminance of the image (kGPUImageHistogramLuminance), or for all three color channels at once (kGPUImageHistogramRGB).

我不是很熟悉所使用的编程语言,所以我无法判断实现是否正确。但最终,颜色不应该改变太多。像素应该只是变得更亮或更暗。

关于ios - GPUImage 直方图均衡化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41450698/

相关文章:

iphone - NSManagedObjectContext,传递它的最佳方式?访问它?

android - 如何在 OpenCv 中将浮点图像转换为 32 位单 channel ?

ios - 当笔画在 Metal 中相互交叉时混合

iphone - 为什么我的 UIToolbar 出现在奇怪的位置?

ios - 如何处理IOS图像裁剪中的图像旋转问题

python - 是否可以将 ppm 文件从 p3 转换为 p6 或使用 Pillow 库打开 ppm p3 文件

image-processing - 对文档的褪色图像实现 Otsu 二值化

ios - 为 iOS 9 启用 Bitcode 会使 IPA 大小增加 3 倍,这是 App Store 上的大小吗?

ios - NSArray 中对象的说明

objective-c - NSAttributeDescription,访问可选属性