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. 降维之奇异值分解(SVD)

    看了几篇关于奇异值分解(Singular Value Decomposition,SVD)的博客,大部分都是从坐标变换(线性变换)的角度来阐述,讲了一堆坐标变换的东西,整了一大堆图,试图“通俗易懂”地 ...

  2. 微信公众号开发之根据OpenID列表群发(十四)

    上一篇我们讲述了<微信公众号开发之根据标签进行群发(十二)>,这次我们讲解一下[根据OpenID列表群发] 根据OpenID列表群发[订阅号不可用,服务号认证后可用] 接口调用请求说明 h ...

  3. RabbitMQ消息队列帮助类

    调用 //消息队列发消息 MqConfigInfo config = new MqConfigInfo(); config.MQExChange = "DrawingOutput" ...

  4. ACM-AK吧!少年

    题目描述:AK吧!少年 AK is an ACM competition finished all of the problems. AC This problem is one of the ste ...

  5. oracle11g数据库的安装

     先在 Oracle官网上下载11g  oracle Database 11g 第 2 版 (11.2.0.1.0) 标准版.标准版 1 以及企业版,适用于 Microsoft Windows (x6 ...

  6. tx2--开机启动

    TX2上电自动开机 参考:http://121.42.13.250/?p=168 问题描述 Jetson TX2在接通电源后,按下板子上的PWOER BTN开机键(S4)后,便能够正常启动.但这对于一 ...

  7. Arduino --structure

    The elements of Arduino (C++) code. Sketch loop() setup() Control Structure break continue do...whil ...

  8. linux 批量kill php进程

    一.执行以下命令 ps -ef|grep php|grep -v grep|cut -c 9-15|xargs kill -9     管道符“|”用来隔开两个命令,管道符左边命令的输出会作为管道符右 ...

  9. Django xadmin图片上传与缩略图处理

    基本摘要 用python django开发时,个人选中Xadmin后台管理系统框架,因为它*内置功能丰富, 不仅提供了基本的CRUD功能,还内置了丰富的插件功能.包括数据导出.书签.图表.数据添加向导 ...

  10. URAL_1146/uva_108 最大子矩阵 DP 降维

    题意很简单,给定一个N*N的大矩阵,求其中数值和最大的子矩阵. 一开始找不到怎么DP,没有最优子结构啊,后来聪哥给了我思路,化成一维,变成最大连续和即可.为了转化成一维,必须枚举子矩阵的宽度,通过预处 ...