[英]Automatic white balance in iOS Objective-C
I'm trying to fix the white balance of a picture on iOS. 我正在尝试修复iOS上图片的白平衡。 In my app, people can take a picture and get 2 things : an OCR and an "improved" version of the image.
在我的应用程序中,人们可以拍照并获得两件事:OCR和图像的“改进”版本。
To do the OCR, I improve the image with GPUImage (using GPUImageAdaptiveThresholdFilter
). 为了进行OCR,我使用
GPUImageAdaptiveThresholdFilter
改进了图像(使用GPUImageAdaptiveThresholdFilter
)。 But that image is made only of black and white pixels. 但是该图像仅由黑白像素组成。 For my "improved" version, I want to have : - the right color balance (meaning my white is really white and not yellow when I take the picture inside) - good contrast.
对于我的“改进”版本,我想要:-正确的色彩平衡(意味着当我在里面拍照时,我的白色是白色,而不是黄色)-良好的对比度。
I tried with GPUImageContrastFilter
and GPUImageWhiteBalanceFilter
. 我尝试使用
GPUImageContrastFilter
和GPUImageWhiteBalanceFilter
。 GPUImageWhiteBalanceFilter
works well but GPUImageWhiteBalanceFilter
takes parameters (like temperature
) and that really depends on the image input. GPUImageWhiteBalanceFilter
可以很好地工作,但是GPUImageWhiteBalanceFilter
可以接受参数(例如temperature
),而这实际上取决于图像输入。
So is there a way to "calculate" these parameters or are there objective c algorithms to fix white balance ? 那么有没有办法“计算”这些参数,或者有客观的c算法来解决白平衡问题? Either ready to use, or simple using GPUImage ?
准备使用还是简单使用GPUImage?
Thanks ! 谢谢 !
You can use CoreImage
to auto enhance images. 您可以使用
CoreImage
自动增强图像。 It will do the analysis for you. 它将为您进行分析。
This is done by acquiring a set of CIFilter
with the necessary modifications that you can just apply to your image. 这是通过获取一组具有必要修改的
CIFilter
来完成的,您只需将其应用于图像即可。
It may take time, but you can use your OCR function as a kind of scoring algorithm for a hill-climbing (or other) optimization algorithm. 这可能会花费一些时间,但是您可以将OCR函数用作爬坡(或其他)优化算法的一种评分算法。
If OCR is too slow -- you may have to pick something else to score with. 如果OCR太慢-您可能必须选择其他东西才能得分。 Perhaps there's a way to compare your output images with known good ones and get a diff.
也许有一种方法可以将您的输出图像与已知的好图像进行比较,并获得差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.