安卓SDK之YUV-Image
来源:互联网 发布:mac地址 冲突 编辑:程序博客网 时间:2024/06/06 03:06
类参考链接:http://api.apkbus.com/reference/android/graphics/YuvImage.html
1. 引入包:
import java.io.ByteArrayOutputStream;import android.hardware.Camera;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.graphics.YuvImage;import android.graphics.ImageFormat;import android.graphics.Rect;import android.graphics.Region;
安卓YUV_IMage包含四元组的YUV数据,contains YUV data and provides a method that compresses a region of the YUV data to a Jpeg,提供了一个向jpeg格式压缩的方法。
Construct an YuvImage.
Compress a rectangle region in the YuvImage to a jpeg.
释义:
Construct an YuvImage.
参数
PixelFormat
.抛出
2. 使用到的缓存类
参考链接:http://www.apihome.cn/api/java/ByteArrayOutputStream.html
参考链接:http://blog.chinaunix.net/uid-9789791-id-1997411.html3. 转换为矩阵数据使用的代码
参考链接:http://eyehere.net/2011/android-camera-2/
//@Overridepublic void changeYUV(byte[] data, Bitmap bmp){final int Width = myCamera.getParameters().getPreviewSize().width;final int Height = myCamera.getParameters().getPreviewSize().height; YuvImage image = new YuvImage(data, ImageFormat.NV21,Width, Height, null); if(image!=null){ ByteArrayOutputStream stream = new ByteArrayOutputStream(); image.compressToJpeg(new Rect(0, 0, Width, Height), 80, stream); //Bitmap bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size()); bmp = BitmapFactory.decodeByteArray(stream.toByteArray(), 0, stream.size()); stream.close(); }}
0 0
- 安卓SDK之YUV-Image
- 安卓SDK更新之hosts文件
- 【安卓随笔】轻度自虐之使用CMake开发NDK(案例:YUV转RGB)
- 安卓sdk 安装
- sdk(安卓)
- 安卓SDK崩溃
- 安卓SDK
- SDK接入安卓
- 安装安卓SDK之曲线谷歌dl-ssl
- 安卓SDK更新出错
- 安卓sdk下载地址
- 安卓SDK环境配置
- 安卓SDK更新问题
- 安卓SDK API下载
- 安卓SDK文件目录
- 安卓开发常用SDK
- 导入安卓sdk源码
- 安卓sdk更新代理
- android界面优化技巧
- 轮盘抽奖代码
- [DM814x笔记]DDR相关配置
- Google Java编程风格指南
- OpenLayers跨域请求WFS服务在Tomcat环境下的实现cgi
- 安卓SDK之YUV-Image
- 二、SpringMvc 进阶
- Stepping in as the new leader
- JQ DOM节点篇
- Linux系统高级编程系列教程
- 《威胁建模:设计和交付更安全的软件》
- Ubuntu1404 :aclocal-1.14' is missing on your system
- 天声人語 20150623
- Spring实现自动任务调度-------------task