使用 Android 相机进行图像处理 [英] Image processing with Android Camera
问题描述
我想在将图像显示给用户之前使用 onPreviewFrame 对图像进行后处理(即应用颜色色调、棕褐色等).据我了解,返回回调的 byte[] 数据是用 YUV420sp 编码的.人们是否一直在使用 Java 或使用 NDK(本机代码)将其解码为 RGB?有没有人有将其解码为 RGB 以及之后如何使用 RGB 值的函数示例?
I want to use the onPreviewFrame to post-process the image before displaying it to the user (i.e. apply a color tint, sepia, etc). As I understand, the byte[] data returned to the callback is encoded in YUV420sp. Have people been decoding this to RGB in Java or using NDK (native code)? Does anyone have an example of a function that decodes this to RGB and how the RGB values are used afterwards?
谢谢.
推荐答案
我找到了一个示例应用程序,它将 YUV420 转换为 RGB 并在预览图像上显示(某种)实时直方图.
I found a sample application that translates the YUV420 into RGB and displays (sort of) real time histograms over the preview image.
http://www.stanford.edu/class/ee368/Android/index.html
这篇关于使用 Android 相机进行图像处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!