Bayer image compression method

文档序号:1408383 发布日期:2020-03-06 浏览:34次 中文

阅读说明:本技术 一种Bayer图像压缩方法 (Bayer image compression method ) 是由 朱树元 贺康 刘光辉 曾兵 于 2019-11-04 设计创作,主要内容包括:本发明属于图像处理技术领域,具体为一种Bayer图像压缩方法;用以克服现有Bayer图像的压缩方法,要么把两个绿色像素转换成一个、降低了恢复图像的质量,要么针对Y矩阵设计复杂的结构变换、增加了编码所需比特数的问题。本发明首先,通过将Bayer图像的G<Sub>1</Sub>RBG<Sub>2</Sub>颜色排列变换到新的颜色排列Y<Sub>1</Sub>UVY<Sub>2</Sub>,消除了RGB颜色空间的相关性,能够提高压缩比,保证恢复图像的质量;然后,通过重排列-列填充-列DCT-行填充-行DCT的方法对Y矩阵做DCT变换,没有损失任何已有的信息,同时降低了编码Y矩阵的所需要的比特数;综上,本发明在恢复的图像质量相同条件下,具有更大的压缩比,且方法简单,显著降低运算复杂度。(The invention belongs to the technical field of image processing, in particular to a Bayer image compression method; the method is used for overcoming the problems that the quality of a restored image is reduced by converting two green pixels into one pixel, or the number of bits required by coding is increased by designing complex structural transformation aiming at a Y matrix in the conventional Bayer image compression method. The invention firstly uses G of Bayer image 1 RBG 2 Colour permutation conversion to new colour permutation Y 1 UVY 2 The method eliminates the correlation of RGB color space, can improve the compression ratio and ensure the quality of the recovered image; then, by rearrangement-column filling-The method of column DCT-row filling-row DCT performs DCT transformation on the Y matrix without losing any existing information and simultaneously reduces the bit number required for coding the Y matrix; in conclusion, the invention has larger compression ratio under the condition of the same recovered image quality, and the method is simple and obviously reduces the operation complexity.)

1. A Bayer image compression method comprising the steps of:

s1, converting G of Bayer image1RBG2Colour permutation conversion to new colour permutation Y1UVY2

S2, rearranging the Y matrix, performing one-dimensional DCT (discrete cosine transform) transformation after filling numbers in empty positions twice, quantizing and encoding DCT domain data, and sending; the method specifically comprises the following steps:

s21, independently forming U matrix by the U components, independently forming V matrix by the V components, and forming non-Y matrix in the original matrix1And Y2Filling the component positions with zeros to form a Y matrix;

s22, performing zero padding expansion on the Y matrix to enable the number of rows and the number of columns to be integer multiples of 8;

s23, dividing the expanded Y matrix into 8 × 8 pixel blocks, and performing the following processing for each block:

1) rearranging: arranging 32 effective Y pixels in an 8x8 pixel block at the upper left corner in a 'Zig-Zag scanning' manner;

2) column filling: the number of effective pixels is n, the vector formed by the effective numbers is marked as y, then 8-n numbers which need to be inserted are marked as x:

x=Pn*y

wherein, Pn:

Figure FDA0002259131840000011

Figure FDA0002259131840000012

Figure FDA0002259131840000013

Figure FDA0002259131840000021

Figure FDA0002259131840000022

P7=[-0.1989 0.5665 -0.8478 1 0.8478 -0.5665 0.1989]

Corresponding to the inserted position:

Pos2:1 3 4 5 6 8

Pos3:2 3 5 6 8

Pos4:2 4 6 7

Pos5:2 4 6

Pos6:3 6

Pos7:5

3) column DCT: performing row-column DCT transformation on the column filling result;

4) and (3) line filling: completing row filling of the column DCT transformation result by adopting (2) the same treatment;

5) line DCT: performing DCT (discrete cosine transformation) on the line filling result;

6) quantization coding: quantizing the line DCT result according to a JPEG gray quantization table, and encoding the quantization result according to a standard JPEG encoding mode;

s3, performing two-dimensional DCT on the U and V matrixes, and performing JPEG chroma quantization and coding on DCT domain data and sending;

s4, the data is received, and inverse quantization and inverse transformation are performed to reconstruct an image.

2. The Bayer image compression method according to claim 1, wherein the step S1 is specifically:

s11, conducting zero filling expansion on the Bayer image to enable the number of rows and the number of columns to be integer multiples of 2;

s12, color labeling the expanded Bayer, and labeling it as four components:

G1(m n)=S(2m-1 2n-1)

R(m n)=S(2m-1 2n)

B(m n)=S(2m 2n-1)

G2(m n)=S(2m 2n)

wherein S represents the original Bayer image matrix, G1Representing the green component of odd columns of odd rows, R representing the red component, B representing the blue component, G2Green components of even rows and even columns are represented, and m and n represent the m-th row and the n-th column of the matrix;

s13, matrix transforming the four components of each 2 × 2 block as follows:

four components Y obtained1、U、V、Y2Thereby G will be1RBG2Color arrangement conversion to Y1UVY2Color arrangement;

g of Bayer image1RBG2Colour permutation conversion to new colour permutation Y1UVY2To eliminate the correlation of the RGB color space, the compression ratio can be increased.

3. The Bayer image compression method according to claim 1, wherein the step S4 is specifically:

s41, after receiving the data sent in the steps S2 and S3, decoding the data and reconstructing a quantized matrix;

s42, inverse quantization corresponding to the quantization in S3 and S2 is performed on the quantized matrix;

s43, performing two-dimensional inverse DCT on the U, V matrix two-dimensional DCT transformation result;

s44, the following process is performed for each 8 × 8 block of the Y matrix change result:

1) performing line inverse DCT transformation;

2) line screening: selecting the effective pixels corresponding to the step 4) in the step 23 to be arranged on the left of each line;

3) performing column inverse DCT transformation;

4) column screening: selecting the effective pixels corresponding to the step 2) in the step 23 to be arranged on the upper side of each column;

5) and (3) recovering the arrangement: restoring the original arrangement at a position corresponding to step 1) of S23;

s45, inversely transforming the color arrangement according to the following formula:

Technical Field

The invention belongs to the technical field of image processing, and particularly relates to a Bayer image compression method.

Background

To produce color images, most digital cameras use a single CMOS board with several different color filters and use interpolation techniques to produce full color images. Among several different Color Filter Arrays (CFAs), Bayer-CFA is the most commonly used, with only one color component in each pixel, and so the other two color components of a given pixel must be interpolated using adjacent pixel information. Although there are several possible interpolation algorithms, they all result in an increase in redundancy from an information theory point of view.

Most of the existing compression methods of the CMOS images on the civil digital cameras compress the images after the interpolation of the images, the data volume of the compression is three times of that of the original Bayer images, and the compression method is not beneficial to the image compression real-time performance of the space camera.

Disclosure of Invention

The present invention is directed to overcoming the above-mentioned drawbacks of the prior art and providing a Bayer image compression method which is simple to implement, i.e., does not increase the number of bits required for encoding or degrade the quality of a restored image.

In order to achieve the purpose, the invention adopts the technical scheme that:

a Bayer image compression method comprising the steps of:

s1, converting G of Bayer image1RBG2Colour permutation conversion to new colour permutation Y1UVY2To eliminate the correlation of the RGB color space;

s2, rearranging the Y matrix, filling numbers in empty positions twice to perform one-dimensional DCT transformation to ensure that the two-dimensional DCT domain coefficient has the minimum non-zero value, and carrying out quantization coding on DCT domain data; the method specifically comprises the following steps:

s21, separating the U componentsForming a U matrix, forming a V matrix by the V components independently, and forming non-Y in the original matrix1And Y2Filling the component positions with zeros to form a Y matrix;

s22, performing zero padding expansion on the Y matrix to enable the number of rows and the number of columns to be integer multiples of 8;

s23, dividing the expanded Y matrix into 8 × 8 pixel blocks, and performing the following processing for each block:

1) rearranging: arranging 32 effective Y pixels in an 8x8 pixel block at the upper left corner in a 'Zig-Zag scanning' manner;

2) column filling: the number of effective pixels is n, the vector formed by the effective numbers is y, then 8-n numbers which need to be inserted are recorded, and the vector formed by the inserted numbers is x:

x=Pn*y

wherein, Pn:

Figure BDA0002259131850000021

Figure BDA0002259131850000022

Figure BDA0002259131850000024

Figure BDA0002259131850000025

P7=[-0.1989 0.5665 -0.8478 1 0.8478 -0.5665 0.1989]

Corresponding to the inserted position:

Pos2:1 3 4 5 6 8

Pos3:2 3 5 6 8

Pos4:2 4 6 7

Pos5:2 4 6

Pos6:3 6

Pos7:5

3) column DCT: performing row-column DCT transformation on the column filling result;

4) and (3) line filling: completing row filling of the column DCT transformation result by adopting (2) the same treatment;

5) line DCT: performing DCT (discrete cosine transformation) on the line filling result;

6) quantization coding: quantizing the line DCT result according to a JPEG gray quantization table, and encoding the quantization result according to a standard JPEG encoding mode;

s3, performing two-dimensional DCT on the U and V matrixes, and performing JPEG chroma quantization and coding on DCT domain data and sending;

s4, the data is received, and inverse quantization and inverse transformation are performed to reconstruct an image.

Further, the step S1 specifically includes:

s11, conducting zero filling expansion on the Bayer image to enable the number of rows and the number of columns to be integer multiples of 2;

s12, color labeling the expanded Bayer, and labeling it as four components:

G1(m n)=S(2m-1 2n-1)

R(m n)=S(2m-1 2n)

B(m n)=S(2m 2n-1)

G2(m n)=S(2m 2n)

wherein S represents the original Bayer image matrix, G1Representing the green component of odd columns of odd rows, R representing the red component, B representing the blue component, G2Green components of even rows and even columns are represented, and m and n represent the m-th row and the n-th column of the matrix;

s13, matrix transforming the four components of each 2 × 2 block as follows:

Figure BDA0002259131850000031

four components Y obtained1、U、V、Y2Thereby G will be1RBG2Color rowColumn to Y1UVY2Color arrangement;

g of Bayer image1RBG2Colour permutation conversion to new colour permutation Y1UVY2To eliminate the correlation of the RGB color space, the compression ratio can be increased.

Further, in step S3, the two-dimensional DCT transform, quantization, and encoding all use the standard JPEG compression encoding method.

Further, the step S4 is specifically:

s41, after receiving the data sent in the steps S2 and S3, decoding the data and reconstructing a quantized matrix;

s42, inverse quantization corresponding to the quantization in S3 and S2 is performed on the quantized matrix;

s43, performing two-dimensional inverse DCT on the U, V matrix two-dimensional DCT transformation result;

s44, the following process is performed for each 8 × 8 block of the Y matrix change result:

1) performing line inverse DCT transformation;

2) line screening: selecting the corresponding effective pixels in the step 4) in the step 23 to be arranged on the left side of each line;

3) performing column inverse DCT transformation;

4) column screening: selecting the corresponding effective pixels in the step 2) in the step 23 to be arranged on the upper side of each column;

5) and (3) recovering the arrangement: restoring the original arrangement at a position corresponding to step 1) of S23;

s45, inversely transforming the color arrangement according to the following formula:

Figure BDA0002259131850000041

the invention has the beneficial effects that:

the invention provides a Bayer image compression method, firstly, G of the Bayer image is compressed1RBG2Colour permutation conversion to new colour permutation Y1UVY2The method eliminates the correlation of RGB color space, can improve the compression ratio and ensure the quality of the recovered image; then go toThe method of rearrangement-column filling-column DCT-row filling-row DCT is used for performing DCT transformation on the Y matrix, no existing information is lost, and the bit number required for coding the Y matrix is reduced; in conclusion, the invention has larger compression ratio under the condition of the same recovered image quality, and the method is simple and obviously reduces the operation complexity.

Drawings

Fig. 1 is a schematic flow chart of a Bayer image compression method according to the present invention.

Fig. 2 is a schematic diagram of colors of each pixel point of a Bayer pattern image in the embodiment of the present invention.

FIG. 3 is a G of a Bayer image in an embodiment of the invention1RBG2Colour permutation conversion to new colour permutation Y1UVY2Schematic representation.

Fig. 4 is a schematic diagram illustrating the separate processing of the Y matrix and the U, V matrix in the embodiment of the present invention.

FIG. 5 is a diagram illustrating DCT transformation according to an embodiment of the present invention.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings and examples.

The invention provides a Bayer image compression method, wherein one-dimensional DCT change is involved, and the known one-dimensional DCT change can be represented by a matrix form:

Figure BDA0002259131850000051

where C denotes a transform matrix, y denotes a vector composed of significant digits, x denotes a vector composed of values to be inserted, and the coefficients of the highest few bits of frequency in the DCT domain are 0, there are:

Figure BDA0002259131850000052

changing the position of the x interpolation so that C11Minimum condition number, assume C11Minimum condition number

Figure BDA0002259131850000053

Is denoted by PnAnd then:

x=Pn*y

wherein n is the number of significant digits.

Based on this, the Bayer image compression method in this embodiment, as shown in fig. 1, includes the following steps:

step S1, converting G of Bayer image1RBG2Colour permutation conversion to new colour permutation Y1UVY2To eliminate the correlation of the RGB color space;

the method specifically comprises the following steps:

s11, conducting zero filling expansion on the Bayer image to enable the number of rows and the number of columns to be integer multiples of 2; thus, in the following steps, the image can be divided into 2x2 blocks for color arrangement conversion;

s12, color marking the expanded Bayer, as shown in FIG. 2, specifically marking the upper left corner of each 2x2 pixel block as G1The top right pixel of every 2x2 pixel block is labeled R, the bottom left pixel of every 2x2 pixel block is labeled B, the bottom right pixel of every 2x2 pixel block is labeled G2The subsequent operation is convenient;

s13, performing color arrangement conversion on the color marked Bayer image, as shown in fig. 3, where the conversion matrix is:

Figure BDA0002259131850000054

step S2, rearranging the Y matrix, filling numbers at the empty position (0 position) twice to perform one-dimensional DCT transformation to ensure that the two-dimensional DCT domain has the least non-zero value, and carrying out quantization coding on DCT domain data;

the method comprises the following specific steps:

s21, as shown in FIG. 4, the U components are formed into U matrix separately, the V components are formed into V matrix separately, and Y is1And Y2The composed matrix is called Y matrix;

s22, expanding the Y matrix to make the number of rows and the number of columns be integer multiples of 8, so that the Y matrix can be divided into 8x8 blocks for processing respectively;

s23, as shown in fig. 5, the expanded Y matrix is divided into 8 × 8 pixel blocks, and the following processing is performed for each block:

1) rearranging: the target is that after the two-dimensional DCT transformation of each block, the high 32-dimensional coefficient is 0, so that the information quantity cannot be increased, and therefore, 32 effective Y pixels in an 8x8 pixel block are arranged at the upper left corner in a 'Zig-Zag scanning' mode;

2) column filling: the number of effective pixels in one column is n, the column vector formed by the effective numbers is y, then the 8-n numbers to be inserted are needed, the column vector formed by the inserted numbers is x:

x=Pn*y

Pnand the locations where insertion is required have been listed in the summary;

3) column DCT: performing row-column DCT transformation on the column filling result;

4) and (3) line filling: and (3) filling the row DCT conversion result, wherein the number of effective pixels in a row is n, a column vector formed by effective numbers is marked as y, then 8-n numbers which need to be inserted are marked as x:

x=Pn*y

Pnand the locations where insertion is required have been listed in the summary;

5) line DCT: performing DCT (discrete cosine transformation) on the line filling result;

6) quantization coding: quantizing the line DCT result according to a JPEG gray quantization table, and encoding the quantization result according to a standard JPEG encoding mode;

s3, performing two-dimensional DCT on the U and V matrixes, performing quantization coding on DCT domain data, and sending the DCT domain data;

step S4, restoring the image in the reverse order of steps S1-S3.

The Bayer image compression method has the advantages of higher compression ratio, simple algorithm and reduced operation complexity when the restored image quality is the same.

While the invention has been described with reference to specific embodiments, any feature disclosed in this specification may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise; all of the disclosed features, or all of the method or process steps, may be combined in any combination, except mutually exclusive features and/or steps.

11页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:与扩展四叉树相关的分割的二值化

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类