将JPEG字节数据转换为原始灰度字节信息的最快方法是什么? [英] What is the fastest way to convert JPEG byte data to raw greyscale byte information?

查看:77
本文介绍了将JPEG字节数据转换为原始灰度字节信息的最快方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于takePhoto的Raw回调不可靠,因此我必须使用JPEG回调...我基本上得到的是一个字节数组,其中以JPEG数据形式保存所有信息.现在,我需要以某种方式使其仅是灰度信息,每个像素的值为0-255 ...

Since the Raw callback from takePhoto is not reliable I have to use the JPEG callback... What I'm basicly getting is a byte array which holds all the information in JPEG data-form. I now need to somehow get this to be only grayscale information with each pixel having a value of 0-255...

此刻,我正在使用BitmapFactory.decodeByteArray将jpeg数据数组转换为Bitmap,然后使用getPixel()将位图转换为灰度,这在性能上是非常糟糕的...

At the moment I'm converting the jpeg data array to Bitmap using BitmapFactory.decodeByteArray and then converting the bitmap to grayscale by using getPixel(), which is pretty bad performance wise...

有人对此有任何经验吗?

Does anyone have any experience with this?

推荐答案

从理论上讲,最快的方法是仅解码Y分量,而忽略流中的Cb和Cr.

Theoretically, the fastest way would be to just decode the Y component and ignore Cb and Cr in the stream.

这篇关于将JPEG字节数据转换为原始灰度字节信息的最快方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆