java - how is the Y plane from YUV is saved in byte array
问题描述
I am using camera 2 API to take images
I need only the brightness of the images so I use the y buffer only as below
ByteBuffer buffer = image.getPlanes()[0].getBuffer();
byte[] bytes = new byte[buffer.capacity()];
buffer.get(bytes);
as far as i know the y plane has all the image pixels and each value of pixel brightness is stored in the byte array value, whats the sequnce they are stored in ? for example is image is like this :
xxxxx
yyyyy
zzzzz
then the bytes array would be like [xxxxyyyyyzzzzz] or [xyzxyzxyzxyz] ?
I tried both sequence but I keep getting wrong results also when I try different phones I get different results ? while the resolution is fixed the image format is YUV_420 the images that I use are only black or white !
解决方案
推荐阅读
- c# - 如何在本地机器上运行.net项目
- visual-studio - VS2019 Pre 和 Post 构建事件总是以代码 1 失败
- amazon-web-services - 通过 CloudFormation 部署 AWS UserPool 并更新属性
- jsonschema - 在 json 模式项中具有多个属性
- android - 旋转可绘制/渐变
- node.js - 需要帮助来确定问题
- embedded - Segger Embedded Studio 链接错误 STM32F7
- python - 无法查看 allauth 登录和注册页面
- linux - subprocess.Popen 使用 Python3 挂起约 70 秒?
- c# - 通用节点 C# 的通用树