当前位置:首页 > > FPGA开源工作室

基于FPGA的比特平面分层

1 背景知识

像素是由比特组成的数字。例如,在256级灰度图像中,每个像素的灰度是由8比特(也就是1个字节)组成。一幅8比特图像可以认为由81比特平面组成,如图1所示,其中平面1包含图像中所有像素的最低阶比特,而平面8包含图像中所有像素的最高阶比特。

1  8比特图像8层示意

把一幅图像分解为比特平面,对于分析图像中每个比特的相对重要性是很有用的,这一处理可帮助我们确定用于量化该图像的比特数的充分性。

2 FPGA实现

2 FPGA内部模块结构框图

FPGA源码:

//------------------------------------------------------------------------------------------------------

// layer

//------------------------------------------------------------------------------------------------------

//assign TFT_rgb = {o_y_8b[7],4'b0,o_y_8b[7],5'b0,o_y_8b[7],4'b0}; //Y The eighth layer

//assign TFT_rgb = {o_y_8b[6],4'b0,o_y_8b[6],5'b0,o_y_8b[6],4'b0}; //Y The seventh layer

//assign TFT_rgb = {o_y_8b[5],4'b0,o_y_8b[5],5'b0,o_y_8b[5],4'b0}; //Y The sixth layer

//assign TFT_rgb = {o_y_8b[4],4'b0,o_y_8b[4],5'b0,o_y_8b[4],4'b0}; //Y The fifth layer

//assign TFT_rgb = {o_y_8b[3],4'b0,o_y_8b[3],5'b0,o_y_8b[3],4'b0}; //Y The fourth layer

//assign TFT_rgb = {o_y_8b[2],4'b0,o_y_8b[2],5'b0,o_y_8b[2],4'b0}; //Y The third layer

//assign TFT_rgb = {o_y_8b[1],4'b0,o_y_8b[1],5'b0,o_y_8b[1],4'b0}; //Y The second layer

assign TFT_rgb = {o_y_8b[0],4'b0,o_y_8b[0],5'b0,o_y_8b[0],4'b0}; //Y The first layer

实验结果:

3 实验原图

4 The eighth layer

5 The seventh layer

6 The sixth layer

7 The fifth layer

8 The fourth layer

9 The third layer

10 The second layer

11 The first layer

结果分析:

对于图3中(x,y)点的灰度值由8比特层平面相应点组成。灰度图像的分层对图像压缩很有作用,在图像压缩中,重建一幅图像时所用的平面要比全部平面少。

12 灰度图像重建

12 a使用比特平面87重建的图像;b使用比特平面8,76重建的图像;c使用比特8,7,65重建的图像。将图c与图a进行对比。

本站声明: 本文章由作者或相关机构授权发布,目的在于传递更多信息,并不代表本站赞同其观点,本站亦不保证或承诺内容真实性等。需要转载请联系该专栏作者,如若文章内容侵犯您的权益,请及时联系本站删除( 邮箱:macysun@21ic.com )。
关闭