http://blog.csdn.net/huiguixian/article/details/17288909

  1. public class YuvToRGB {
  2. private static int R = 0;
  3. private static int G = 1;
  4. private static int B = 2;
  5. public static int[] I420ToRGB(byte[] src, int width, int height){
  6. int numOfPixel = width * height;
  7. int positionOfV = numOfPixel;
  8. int positionOfU = numOfPixel/4 + numOfPixel;
  9. int[] rgb = new int[numOfPixel*3];
  10. for(int i=0; i<height; i++){
  11. int startY = i*width;
  12. int step = (i/2)*(width/2);
  13. int startV = positionOfV + step;
  14. int startU = positionOfU + step;
  15. for(int j = 0; j < width; j++){
  16. int Y = startY + j;
  17. int V = startV + j/2;
  18. int U = startU + j/2;
  19. int index = Y*3;
  20. rgb[index+B] = (int)((src[Y]&0xff) + 1.4075 * ((src[V]&0xff)-128));
  21. rgb[index+G] = (int)((src[Y]&0xff) - 0.3455 * ((src[U]&0xff)-128) - 0.7169*((src[V]&0xff)-128));
  22. rgb[index+R] = (int)((src[Y]&0xff) + 1.779 * ((src[U]&0xff)-128));
  23. }
  24. }
  25. return rgb;
  26. }
  27. }

I420转RGB的更多相关文章

  1. libyuv 编译 for android

    libyuv is an open source project that includes is an instrumentation framework for building dynamic ...

  2. webrtc 源码结构

    api WebRTC 接口层.包括 DataChannel, MediaStream, SDP相关的接口.各浏览器都是通过该接口层调用的 WebRTC. call 存放的是 WebRTC “呼叫(Ca ...

  3. 谈谈“色彩空间表示方法”——RGB、YUY2、YUYV、YVYU、UYVY、AYUV

    转自:http://bbs.chinavideo.org/viewthread.php?tid=4143 还可参考http://www.fourcc.org/yuv.php 小知识:RGB与YUV-- ...

  4. yuv rgb 像素格式1

    ===========大小============= 一般,直接采集到的视频数据是RGB24的格式 RGB24一帧的大小size=width×heigth×3 Byte, RGB32的size=wid ...

  5. 转:YUV RGB 常见视频格式解析

    转: http://www.cnblogs.com/qinjunni/archive/2012/02/23/2364446.html YUV RGB 常见视频格式解析 I420是YUV格式的一种,而Y ...

  6. 常用YUV转RGB代码

    常用YUV转RGB [java] view plaincopyprint? public class YuvToRGB { private static int R = 0; private stat ...

  7. YUV数据YUY2到I420

    /* 主要的采样格式有YCbCr 4:2:0.YCbCr 4:2:2.YCbCr 4:1:1和 YCbCr 4:4:4.其中YCbCr 4:1:1 比较常用,其含义为:每个点保存一个 8bit 的亮度 ...

  8. YUV转为RGB24及IplImage格式(I420和YV12)及Java版实现

    http://blog.csdn.net/xy365/article/details/18735849 ———————————————————————————————————————————————— ...

  9. YUV与RGB互转各种公式 (YUV与RGB的转换公式有很多种,请注意区别!!!)

    一. 公式:基于BT.601-6 BT601 UV 的坐标图(量化后): (横坐标为u,纵坐标为v,左下角为原点) 通过坐标图我们可以看到UV并不会包含整个坐标系,而是呈一个旋转了一定角度的八边形, ...

随机推荐

  1. 配置anaconda 的仓库镜像

    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config -- ...

  2. JDBC面试知识点整理(温习用)

    要面试,所以把之前的笔记整理一遍,嘻嘻,加油 JDBC编程 使用JDBC,java程序可以轻松地操作各种主流数据库,Oracle,MySQL,等,使用JDBC编写的程序不仅可以实现跨数据库,还具有跨平 ...

  3. .NET 一次读取几百条数据优化,从原来30分钟优化到30秒

    1.全部数据读取到内存, 不要使用string,而是使用stringbuilder,stringbuilder的效率非常高 2.添加到数据库 不要使用excute,而是使用事务,几百万条数据会请求数据 ...

  4. 对plotTree的解释

    1.>>>a = 1/2/2   >>>a >>>0.25 2.def plotMidText(cntrPt,parentPt,txtString ...

  5. 吴裕雄--天生自然C++语言学习笔记:C++ 文件和流

    如何从文件读取流和向文件写入流.这就需要用到 C++ 中另一个标准库 fstream,它定义了三个新的数据类型: ofstream 该数据类型表示输出文件流,用于创建文件并向文件写入信息. ifstr ...

  6. TX2-刷机完成后安装程序ubuntu_linux命令&TX2学习总结

    Linux教程|菜鸟教程:http://www.runoob.com/linux/linux-tutorial.html 认识linux:ping命令:ping命令是常用的网络命令ping网关:pin ...

  7. java.sql.Date转换

    ---恢复内容开始--- JAVA 处理时间 - java.sql.Date.java.util.Date与数据库中的Date字段的转换方法,以及util包下的Date类与字符串的相互转换 在java ...

  8. jQuery搜索框输入实时进行查询

    在手机上,我们期望在搜索框中输入数据,能够实时更新查询出来的内容,不需要按回车. 实现方式为: $(".search").bind("input propertychan ...

  9. 初学C#之变量、占位符、转义符、还有就是类型转换

    ㈠.定义变量 先定义再赋值 int Num1; Num1 = ; 定义的同时赋值 ; 定义多个变量同时赋值,先决条件变量类型相同,例如: string phome = "1891250888 ...

  10. DRF源码-serializers

    class BaseSerializer(Field) """ The BaseSerializer class provides a minimal class whi ...