计算“亮度”的好方法UIImage 的?

发布于 2024-09-28 13:07:09 字数 86 浏览 0 评论 0原文

我正在编写一个应用程序,它将提供 iPhone 相机捕获的图像的 OCR 功能。我想在执行 OCR 分析之前测试图像,看看是否有足够的照明。有人有什么想法吗?

I'm writing an app that will offer OCR of an image captured by the iPhone camera. I want to test the image before I perform the OCR analysis to see if there is sufficient lighting. Anyone have any ideas?

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

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

发布评论

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

评论(1

坦然微笑 2024-10-05 13:07:09

最灵活的方法是为红绿蓝颜色通道生成直方图,然后用它来确定平均亮度、中值亮度、黑/白点、对比度或其他自定义函数。

使用 CGBitmapContextCreate 创建一个由您创建的缓冲区支持的位图上下文,将图像绘制到其中,然后循环遍历缓冲区中的每个像素以填充直方图。

The most flexible way is to generate a histogram for the red green and blue color channels, and then use it to determine the average lightness, median lightness, black/white points, contrast or other custom functions.

Use CGBitmapContextCreate to create a bitmap context backed by a buffer of your creation, draw your image into it, then loop through each pixel in the buffer to populate the histograms.

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