YUV420只绘制Y通道
来源:互联网 发布:手机木马软件购买 编辑:程序博客网 时间:2024/06/06 11:38
前段时间整个一个yuv文件,格式为352x240,YUV420格式的,即YYYYUUVV,准备使用Qt进行重绘显示。不知道为什么转换为RGB显示出来乱乱的,
最近做只显示出Y通道的灰度图像,刚做成功。
灰度图像即RGB三颜色是一样的,需要建立一个8位的256级的灰度索引表,用0~255表示颜色的深度。
然后构建一个8位的QImage并设置它的颜色索引表,让它去颜色表中查颜色。
Qt中的QImage提供了对每一个像素的操作。
关键是setPixel这个函数。
void QImage::setPixel(const QPoint & position, uint index_or_rgb)
Sets the pixel index or color at the given position to index_or_rgb.
If the image's format is either monochrome or 8-bit, the given index_or_rgb value must be an index in the image's color table, otherwise the parameter must be a QRgb value.
If position is not a valid coordinate pair in the image, or if index_or_rgb >= colorCount() in the case of monochrome and 8-bit images, the result is undefined.
Warning: This function is expensive due to the call of the internal detach() function called within; if performance is a concern, we recommend the use of scanLine() to access pixel data directly.
上面的代码还是让人费解的。修改为下面的效果是一样的。从代码的理解上也是,从Y平面数组中查找了Y通道的每个像素点的数据
然后查灰度颜色表,再设置QImage每个像素点的颜色。(即灰度)
现在显示Y通道的图像成功了,下一步要加入U,V让图像显示出颜色来以加深根据YUV数据进行RGB图像重构的方法。
以及YUV数据存储跟实际像素的对应关系。
- YUV420只绘制Y通道
- yuv420
- YUV420
- yuv420
- YUV420
- YUV420
- ffmpeg简化方案---只支持h264解码,输出为yuv420
- OpenCV 绘制单通道图片的直方图
- opencv 绘制单通道图片的直方图
- opencv 绘制三通道的直方图
- OPENCV 实现png绘制,alpha通道叠加。
- R语言绘制布林带通道
- PChart绘制连着Y轴的横线
- python matplotlib 绘制双Y轴曲线图
- 共用y轴的双图形绘制
- python matplotlib 绘制双Y轴曲线图
- MATLAB绘制双Y轴图形
- yuv420格式仅y数据转pgm格式 程序小例
- SlidingMenu的使用笔记
- keepalived安装配置
- kettle入门(六) 之kettle抽取变量表名表
- 安卓开发之常见死机问题--log分析
- Android基础之使用Fragment控制切换多个页面
- YUV420只绘制Y通道
- 挑选空气净化器,你知道吗?
- 【Git学习笔记】用git pull取回远程仓库某个分支的更新,再与本地的指定分支自动merge
- 开始iOS 7中自动布局教
- android studio使用说明
- WPF 异步编程
- intent.setFlags方法中的参数值含义
- Ext.window.MessageBox按钮中文的设置问题
- Android 管理Activity中的fragments