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. 解决:Server IPC version 9 cannot communicate with client version 4

    使用idea的maven项目运行mapreduce程序Server IPC version 9 cannot communicate with client version 4 原因: Java初始化 ...

  2. 剑指offer - 栈的压入弹出序列 - JavaScript

    题目描述 输入两个整数序列,第一个序列表示栈的压入顺序,请判断第二个序列是否可能为该栈的弹出顺序.假设压入栈的所有数字均不相等.例如序列 1,2,3,4,5 是某栈的压入顺序,序列 4,5,3,2,1 ...

  3. servlet中urlpatterns注意事项

    在servlet中, @WebServlet(urlPatterns="/newsAdd")接收 resp.sendRedirect("/wedding/houtai/N ...

  4. 十、JavaScript之文本相加

    一.代码如下 二.执行效果如下 <!DOCTYPE html> <html> <meta http-equiv="Content-Type" cont ...

  5. 十九、SAP查询所有数据库表的所有数据

    一.我们打款SAP自带的一个演示数据库SCARR 二.表结构如下 三.代码如下 四.执行结果如下 我们对比一下数据库的内容,很perfect 不忘初心,如果您认为这篇文章有价值,认同作者的付出,可以微 ...

  6. 简单javascript学习总结

    2019-10-19 //文章汇总于绿叶学习网 console.log()                              //控制台输出 目录 数据类型:.... 2 函数:.... 3 ...

  7. C#不显示在任务栏

    在我用c#写一些小程序是总是希望,程序窗体不在任务栏上显示程序的窗体,c# Form提供了一个 属性值可以很好的解决这个问题 这个属性就是 ShowInTaskbar 在微软的官方声明格式为: pub ...

  8. ACM-Divide Tree

    题目描述:Divide Tree   As we all know that we can consider a tree as a graph. Now give you a tree with n ...

  9. 使用jackson转换类型时报Unrecognized field

    调用 objectMapper.convertValue(obj, valueType ); 时报错 原因 obj 的属性多于 valueType 导致,添加一条语句即可 objectMapper.c ...

  10. springboot+thymeleaf项目中使用th:replace访问templates子目录下的模板,会报错找不到模板路径

    解决方法: 先将模板路径放置templates目录下,发现可以访问,说明th:replace是可以用的. 那可能是出现在路径问题上面. 于是我开始调错,改路径. 后来在网上查找资料.说了很多种方法. ...