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. ORIGIN(起源属性)路由起源骗术

    ORIGIN(起源属性)配置: ①:抓取感兴趣流量——prefix.access ②:创建route-map 流量地图——permit 10 ③:匹配感兴趣流量——match ④:设置起源属性——se ...

  2. 虚拟 DOM 到底是什么?

    虚拟 DOM 到底是什么? 作者:wangshengliang 注意:由于文章太长,对文章有删减,但是不会影响整体阅读 是什么? 虚拟 DOM (Virtual DOM )这个概念相信大家都不陌生,从 ...

  3. 笔记本如何不按Fn键就能实现F键的功能

    笔记本的F1~F12键的附带功能如何改成 不用按Fn键就能实现F1~F12的功能 本人现在使用的是一款ThinkPad的本本,之前在台式机上愉快的玩耍的时候键盘上的F键直接按一下就可以实现相应的功能, ...

  4. 基于Windows平台的Python多线程及多进程学习小结

    python多线程及多进程对于不同平台有不同的工具(platform-specific tools),如os.fork仅在Unix上可用,而windows不可用,该文仅针对windows平台可用的工具 ...

  5. Unity UGUI优化整理

    看了不少UI优化方面的东西,还是记下来方便记忆,优化性能往往是在各种选择之间做出平衡(空间换时间,或者GPU换CPU,舍弃精度等). 主要优化点在减少Drawcall,减少Overdraw. Mask ...

  6. ntpdate更新系统时间时报错Can't find host ntp1.aliyun.com: Servname not supported for ai_socktype (-8)

    ntpdate更新系统时间时报错Can't find host ntp1.aliyun.com: Servname not supported for ai_socktype (-8) 所报错误: [ ...

  7. 使用SSH工具连接WSL

    简单记录下操作过程 我在微软应用商店下载了Ubuntu 18.04 LTS.但是Windows的命令行太丑,我打算使用SSH工具连接WSL,输入密码一直拒绝连接... 查找资料之后解决了这个问题 双击 ...

  8. ROS2学习日志:TurtleSim测试日志(基于ROS2 Eloquent Elusor)

    TurtleSim测试日志(基于ROS2 Eloquent Elusor) 1.ros2 run 1.1 ros2 run turtlesim turtlesim_node --ros-args -- ...

  9. MBE风格图标

    图标的定义 图标是一种通过相似性或类比行来代表对象的符号. 图标的重要性 1.图形以其无与伦比的识别性带来信息传达效率的提升. 2.图形以其百变多样的趣味性带来视觉体验的享受提成用户体验. 3.图形以 ...

  10. HDU 5477: A Sweet Journey

    A Sweet Journey Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...