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. 指令——less

    一.Liunx系统下的一般命令格式. 命令——实际上就是在Liunx终端中,在命令行中输入的内容. Liunx中一个命令的完整格式为: #指令主体(空格) [选项](空格) [操作对象] 指令主体—— ...

  2. python 第一节 脚本 import from reload exec

    环境Ubuntu 14.04, 不写交互式命令行了,直接脚本开始. # first Python script import sys print(sys.platform) print(2**4) x ...

  3. 如何通过模仿提升Paper写作能力?

    对于大部分初到国外留学的中国留学生们来说要想自己独立完成一篇Paper可能难度会很大,从Paper字体字号要求.Paper写作格式.Paper写作结构等等诸多因素都会影响留学生们写Paper的效率.对 ...

  4. Java中的static关键字和new关键字作用介绍

    一.static关键字的作用 1.可以用于修改类的成员变量.代码块和类 通过static可以将类的成员声明为静态成员,静态的成员归属于整个类,而不是属于某个对象.无论通过类还是对象访问静态成员,操作的 ...

  5. (22)Canny算法

    基础知识,主要是看这个博客:https://blog.csdn.net/qq_41167777/article/details/84863351

  6. CGridCtrl设置行列不可拉伸

    m_HFlexGrid.SetColumnResize(FALSE); m_HFlexGrid.SetRowResize(FALSE);

  7. Java算法练习——盛最多水的容器

    题目链接 题目描述 给定 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) .在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) ...

  8. JS ~ 返回上一步

      <a href=" javascript:window.history.back() "> 返回上一步 </a>

  9. 文献阅读报告 - Social GAN: Socially Acceptable Trajectories with Generative Adversarial Networks

    paper:Gupta A , Johnson J , Fei-Fei L , et al. Social GAN: Socially Acceptable Trajectories with Gen ...

  10. SQL约束攻击

    本文转载自https://blog.csdn.net/kkr3584/article/details/69223010 目前值得高兴的是,开发者在建立网站时,已经开始关注安全问题了--几乎每个开发者都 ...