CN106954065B - Recursive prediction image compression method based on gradient direction histogram - Google Patents

Recursive prediction image compression method based on gradient direction histogram Download PDF

Info

Publication number
CN106954065B
CN106954065B CN201710119825.9A CN201710119825A CN106954065B CN 106954065 B CN106954065 B CN 106954065B CN 201710119825 A CN201710119825 A CN 201710119825A CN 106954065 B CN106954065 B CN 106954065B
Authority
CN
China
Prior art keywords
data
matrix
image
pixel
prediction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710119825.9A
Other languages
Chinese (zh)
Other versions
CN106954065A (en
Inventor
张静
李珊珊
李云松
吴仁坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian University of Electronic Science and Technology
Original Assignee
Xian University of Electronic Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xian University of Electronic Science and Technology filed Critical Xian University of Electronic Science and Technology
Priority to CN201710119825.9A priority Critical patent/CN106954065B/en
Publication of CN106954065A publication Critical patent/CN106954065A/en
Application granted granted Critical
Publication of CN106954065B publication Critical patent/CN106954065B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/107Selection of coding mode or of prediction mode between spatial and temporal predictive coding, e.g. picture refresh
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention discloses a recursive prediction image compression method based on a frequency domain direction filter, which mainly solves the problems of low texture direction detection accuracy, high time complexity and large number of prediction coefficients in the prior art. The method comprises the following steps: 1) designing a prototype directional filter; 2) generating a set of directional filters from the prototype directional filter; 3) reading in original gray image data and judging the texture direction; 4) expanding original gray image data; 5) reading the extended image data in units of blocks; 6) establishing a Markov prediction model according to the read block data; 7) performing predictive compression on the read block data; 8) and judging whether the prediction of all the block data is finished, if so, ending the compression, otherwise, jumping the data reading address, and returning to the step 5). The invention can flexibly and accurately detect the texture direction, has low time complexity and small number of prediction coefficients, improves the compression performance and can be used for image compression coding of various digital devices.

Description

Recursive prediction image compression method based on gradient direction histogram
Technical Field
The invention relates to the technical field of image processing, in particular to an image compression method which can be used for compressing and coding images of various digital devices.
Background
In the information age, people increasingly rely on computers to acquire and utilize information, and digitalized multimedia information has mass data performance and has a great difference with computer storage resources and network bandwidth which can be provided by the current hardware technology, so that great difficulty is caused in information storage and transmission. The image information is the most important resource on the computer, and the effective compression processing is undoubtedly necessary, which also brings great benefits to people. The image compression is not only the basis of various dynamic image compression and transmission, but also is an important factor influencing the effect.
Predictive coding, which is the most important and basic method for image compression, is often used in some fields requiring high quality of image compression, such as text images and medical images. Predictive coding generally comprises two parts: one part is decorrelation, most of the methods adopt a predictor, and the gray value of a pixel to be coded is predicted by utilizing the gray value of a coded neighborhood pixel; the other part is entropy coding of the prediction error.
Predictors are generally classified into three categories:
(1) global predictor: predicting different pixels in different pictures or in one picture by adopting a group of fixed prediction coefficients;
(2) local predictor: predicting different parts of the image by adopting different prediction coefficients;
(3) fully adaptive predictor: the prediction coefficient changes with the change of the image pixel point.
The main prediction-based method is a Median Edge Detection (MED) method adopted in the still image compression standard JPEG-LS, which encodes pixels of an image pixel by pixel from top to bottom and from left to right, and essentially performs simple gradient calculation on a current region and then performs prediction along a direction parallel to a boundary. For the prediction of the current pixel X, different variable length coding modes are selected according to the gradient between adjacent pixels, then the current pixel is predicted, the current pixel and the predicted pixel are subtracted to obtain a predicted difference value, and finally the predicted difference value is subjected to entropy coding.
Compared with JPEG-LS, the context-based adaptive lossless image coding method CALIC uses a more complex gradient-based adaptive prediction method GAP. The method comprises the steps of calculating the horizontal gradient and the vertical gradient of a current pixel according to a context template to obtain a difference value of the horizontal gradient and the vertical gradient, judging whether a horizontal edge or a vertical edge exists according to the difference value, and selecting the weight of an adjacent pixel appropriately according to the change degree of the horizontal edge or the vertical edge to calculate the predicted value of the current pixel.
Although the JPEG-LS and CALIC adopt the context-based adaptive prediction algorithm to predict the pixels, the JPEG-LS and CALIC adopt simpler gradient calculation and cannot well track the trend of the texture, so the compression precision needs to be improved. In recent years, many scholars research on fast intra prediction mode selection and introduce a Canny edge direction histogram method to more fully utilize the texture characteristics of images.
An article published in 2011 Xiaohua super and Zhou inspection, "LMS-based image adaptive prediction coding", provides a prediction method of an adaptive update weight, electronic design engineering, 2011.19(4): p.109-112. The method has the essence that the weight values of the adjacent pixels adopted in the prediction are continuously updated to obtain a smaller prediction difference value, and although the prediction is more accurate, the time complexity is too high because the texture characteristic of the image is not fully utilized.
In 2012, the homengcheng discloses a method for quickly selecting an intra-frame prediction mode based on texture similarity judgment in a published paper "intra-frame prediction quick algorithm research based on texture similarity judgment", the university of western electronic technology, 2012. Although the method can avoid a full search mode and greatly reduce the time complexity of intra-frame prediction, linear prediction is adopted for prediction of each pixel in various prediction modes, so that the number of prediction coefficients is large, and the data volume to be compressed is increased.
Disclosure of Invention
The present invention is directed to overcome the above deficiencies of the prior art, and provide a recursive predictive image compression method based on a gradient direction histogram, so as to reduce time complexity, reduce the number of prediction coefficients and prediction differences, and achieve the improvement of compression performance.
The technical scheme for realizing the purpose of the invention is as follows: combining a method based on a Sobel gradient direction histogram with a recursive Markov prediction model, firstly judging the texture direction of an image block, then establishing the recursive Markov prediction model by utilizing a plurality of reference pixels adjacent to the direction, and obtaining a weight coefficient of the reference pixels in the prediction model by adopting least square estimation, wherein the method comprises the following specific steps:
(1) reading an original gray image with the size of M multiplied by M and the suffix of raw format from a natural image set, wherein M represents the width and the height of the original gray image, and x represents the multiplication operation;
(2) judging the texture direction of the original image:
(2a) carrying out boundary expansion on the original gray image in the step (1) in a row from top to bottom and a column from left to right to obtain an expanded image with the size of (M +2) × (M + 2);
(2b) calculating the gradient direction angle of each pixel point of the expanded image, which does not comprise the boundary expansion, by using a Sobel gradient operator according to the sequence from left to right and from top to bottom, and further obtaining a gradient direction angle matrix G of the original gray image;
(2c) uniformly dividing the gradient direction angle matrix G into block matrixes with the size of N multiplied by N, reading the block matrixes, and initializing the reading times k to be 1, wherein N represents the row number and the column number of the block matrixes and takes the value of 4 or 8;
(2d) counting a gradient direction histogram of the k block matrix to obtain an angle corresponding to a peak value of the gradient direction histogram
Figure GDA0002251050150000031
And determining the angle of the texture main direction of the image data block as
Figure GDA0002251050150000032
(2e) And (4) judging whether the texture direction judgment of all the original gray image data blocks is finished or not, if so, executing the step (3), otherwise, increasing the k by 1 and returning to the step (2 d).
(3) Carrying out boundary extension on the original gray-scale image data in the step (1) by three rows at the upper part and three columns at the lower part and three columns at the left part and the right part to obtain extended image data with the size of (M +6) × (M +6), and initializing a data reading address to be an initial address position of the extended image data;
(4) reading the extended image data in units of blocks having a size of (N +3) × (N +3) from the data read address;
(5) establishing a Markov prediction model according to the read block data:
(5a) estimating weight coefficients of reference pixels in the recursive Markov prediction model by using a least square estimation method;
(5b) according to the texture main direction obtained in the step (2), establishing a two-dimensional recursive Markov prediction model for each pixel point which does not comprise three lines at the upper side and three lines at the left side in the block data by utilizing a plurality of reference pixel points adjacent to the texture direction;
(6) prediction of block data:
(6a) predicting each pixel of the block data, which does not comprise the upper three rows and the left three columns, according to the established recursive Markov prediction model in the step (5) to obtain a predicted value matrix;
(6b) subtracting the gray value of each pixel excluding the upper three rows and the left three columns in the block data from the corresponding predicted value in the predicted value matrix to obtain a difference value matrix R, performing Discrete Cosine Transform (DCT) on the difference value matrix R to obtain a transform coefficient matrix T, and then quantizing and entropy coding the transform coefficient matrix T to obtain a compressed code;
(6c) decoding, inversely quantizing and inversely DCT transforming the compressed code to obtain a restored difference matrix R ', adding the R' and the difference matrix R to obtain a reconstruction value matrix, and updating the pixel value at the corresponding address in the extended image data block according to the reconstruction value matrix;
(7) and (4) judging whether the predictive compression of all the block data is finished, if so, ending the compression, otherwise, jumping the data reading address to the starting address of the next block data, and returning to the step (4).
Compared with the prior art, the invention has the following advantages:
1. time complexity is reduced.
According to the invention, the texture direction of the image block is judged in advance according to the Sobel gradient direction histogram, so that the speed of selecting the prediction mode is increased, and the time complexity is reduced.
2. The prediction performance and the compression performance are improved.
According to the invention, the original gray level image data is subjected to boundary expansion of three lines at the top and bottom and three lines at the left and right to obtain the expanded image data with the size of (M +6) x (M +6), and the expanded image data is read by taking the block with the size of (N +3) x (N +3) as a unit, so that the reading of the reference pixel reconstruction values of three lines at the top and left of the block data is considered, the problem of inaccurate result caused by simply partitioning the image in the prior art is solved, the prediction residual error is reduced, and the prediction performance is improved; meanwhile, the method based on the Sobel gradient histogram is combined with the recursive Markov prediction model, and prediction of all pixels in the same block data refers to the same group of weight coefficients, so that the number of prediction coefficients is reduced, local texture characteristics of the image can be better adapted, more accurate pixel prediction values are obtained, prediction difference values are reduced, and the compression performance is further improved.
Drawings
FIG. 1 is a flow chart of an implementation of the present invention;
Detailed Description
The following detailed description of the present invention will be made with reference to the accompanying drawings and examples, which are provided for illustration of the present invention and are not intended to limit the scope of the present invention.
Referring to fig. 1, the implementation steps of the invention are as follows:
reading in original gray image data.
Reading an original gray image with the size of M multiplied by M and the suffix of raw format from a natural image set, wherein M represents the width and the height of the original gray image, and x represents the multiplication operation.
And step two, judging the texture direction of the original gray image data.
2.1) carrying out boundary expansion on the original gray-scale image in the first step in upper and lower rows and left and right columns to obtain an expanded image with the size of (M +2) x (M +2), wherein the boundary expansion of the upper and lower rows and the left and right columns refers to carrying out mirror image assignment on pixel points in the upper and lower rows and the left and right columns in the expanded image data by taking edge pixel points of the original gray-scale image as the center;
2.2) according to the order from left to right, from top to bottom, the gradient direction angle of each pixel point of the extension image not including the boundary extension is calculated by utilizing a Sobel gradient operator:
2.2a) selecting a Sobel gradient operator template matrix as follows:
Figure GDA0002251050150000051
wherein SxAs a horizontal gradient operator, SyA vertical gradient operator;
2.2b) reacting SxConvolving with 3 multiplied by 3 neighborhood of the current pixel point to obtain a horizontal gradient GxAnd then S isyConvolving with 3 multiplied by 3 neighborhood of the current pixel point to obtain a vertical gradient Gy
2.2c) calculating the gradient direction angle theta (x, y) of the current pixel point according to the result of the step (2.2 b):
Figure GDA0002251050150000052
2.3) counting the gradient direction angle of each pixel point to obtain a gradient direction angle matrix G of the original gray level image;
2.4) uniformly dividing the gradient direction angle matrix G into block matrixes with the size of N multiplied by N, reading the block matrixes, and initializing the reading times k to be 1, wherein N represents the row number and the column number of the block matrixes and takes the value of 4 or 8;
2.5) counting the gradient direction histogram of the k block matrix to obtain the angle corresponding to the peak value of the gradient direction histogram
Figure GDA0002251050150000053
And determining the texture main direction angle of the image data block according to the orthogonal relation between the image texture direction and the image gradient directionDegree of
Figure GDA0002251050150000054
2.6) judging whether the texture direction judgment of all the original gray image data blocks is finished, if so, executing the step three, otherwise, increasing k by itself by 1, and returning to the step (2.5).
Through the first step and the second step, the texture direction judgment of the original gray level image data can be completed, and the gray level image is subjected to prediction compression through the following steps:
and step three, expanding the original gray image data.
And (2) performing boundary expansion of three rows from top to bottom and three columns from left to right in the original gray image data in the step one to obtain expanded image data with the size of (M +6) x (M +6), and initializing a data reading address to an address initial position of the expanded image data, wherein the boundary expansion of three rows from top to bottom and three columns from left to right refers to performing mirror image assignment on pixel points of three rows from top to bottom and three columns from left to right in the expanded image data by taking edge pixel points of the original gray image as a center.
And step four, reading the extended image data in units of blocks with the size of (N +3) × (N +3) from the data reading address.
4.1) initializing a (N +3) × (N +3) two-dimensional matrix to store block data and initializing the reading time i to 0, and in this step, allocating 3 × 3 matrix units to store pixel reconstruction values of adjacent and predicted blocks since prediction of pixels in block data excluding the upper three rows and the left three columns requires reference to pixel reconstruction values of adjacent and predicted blocks;
4.2) reading N +3 data starting from the data reading address and assigning the data to the first row of the two-dimensional matrix;
4.3) increasing the data reading address by M +6 and increasing i by 1;
4.4) judging whether i is equal to N +3, if so, finishing reading the block data, otherwise, returning to the step 4.2).
And step five, establishing a Markov prediction model according to the read block data.
5.1) according to the texture main direction obtained in the fourth step, establishing a two-dimensional recursive Markov prediction model by using a plurality of reference pixel points adjacent to the texture direction for each pixel point which does not comprise three lines at the upper side and three lines at the left side in the block data as follows:
u(i,j)=ρ1u1(i,j)+ρ2u2(i,j)+ρ3u3(i,j)+ρ4u4(i,j)+e(i,j),i、j=0,1,2…N
wherein u (i, j) represents the predicted value of the pixel point with the coordinate (i, j), and u (i, j) represents the predicted value of the pixel point with the coordinate (i, j)1(i,j),u2(i,j),u3(i,j),u4(i, j) represent the gray values, ρ, of the four reference pixels, respectively1234The weight coefficients of the four reference pixels are respectively, and e is white noise;
according to the different values of the direction number L of a set of designed directional filters, four reference pixels at different positions can be selected, and taking the case that L is 8 as an example, the gray values of the four reference pixels selected in eight texture directions are as follows:
in the horizontal 0 degree direction:
u1(i,j)=u(i-1,j)
u2(i,j)=u(i-2,j)
u3(i,j)=u(i-3,j)
u4(i,j)=u(i-2,j-1)
in the counterclockwise direction at 22.5 degrees to the positive x-axis half:
u1(i,j)=u(i,j-1)
u2(i,j)=u(i+1,j-1)
u3(i,j)=u(i+2,j-1)
u4(i,j)=u(i+2,j-2)
in the counterclockwise direction at 45 degrees to the positive x-axis half:
u1(i,j)=u(i,j-1)
u2(i,j)=u(i+1,j-1)
u3(i,j)=u(i+1,j-2)
u4(i,j)=u(i+2,j-2)
in the counterclockwise direction at 67.5 degrees to the positive x-axis half:
u1(i,j)=u(i,j-1)
u2(i,j)=u(i+1,j-1)
u3(i,j)=u(i,j-2)
u4(i,j)=u(i+1,j-2)
in the counterclockwise direction at a 90 degree angle to the positive x-axis half:
u1(i,j)=u(i,j-1)
u2(i,j)=u(i+1,j-1)
u3(i,j)=u(i+1,j-2)
u4(i,j)=u(i+2,j-2)
in the counterclockwise direction at an angle of 112.5 degrees to the positive x-axis half:
u1(i,j)=u(i,j-1)
u2(i,j)=u(i-1,j-1)
u3(i,j)=u(i-1,j-2)
u4(i,j)=u(i,j-2)
in the counterclockwise direction at a 135 degree angle to the positive x-axis half:
u1(i,j)=u(i-1,j)
u2(i,j)=u(i-1,j-1)
u3(i,j)=u(i,j-1)
u4(i,j)=u(i-2,j-2)
in the counterclockwise direction at 157.5 degrees to the positive x-axis half:
u1(i,j)=u(i-1,j)
u2(i,j)=u(i-2,j-1)
u3(i,j)=u(i-1,j-1)
u4(i,j)=u(i,j-1)
when L is larger than 8, respectively adopting a quadratic interpolation method aiming at L texture directions, and calculating four equidirectional pixel gray values from near to far in the texture directions to be used as gray values of four reference pixels;
5.2) estimating the weight coefficient of the reference pixel in the recursive Markov prediction model by using a least square estimation method according to the following steps:
5.2a) the sum of the square of the prediction errors E (i, j) for each pixel in the block data excluding the top three rows and the left three columns is expressed as follows:
E(i,j)=(u(i,j)-ρ1u1(i,j)-ρ2u2(i,j)-ρ3u3(i,j)-ρ4u4(i,j))2
wherein u (i, j) represents the predicted value of the pixel point with the coordinate (i, j), and u (i, j) represents the predicted value of the pixel point with the coordinate (i, j)1(i,j),u2(i,j),u3(i,j),u4(i, j) represent the gray values, ρ, of the four reference pixels, respectively1234The weighting coefficients of four reference pixels are respectively, i and j are 1,2 and … N, wherein N represents the number of rows and columns of an area which does not comprise three rows at the upper side and three columns at the left side in the block data, and the value is 4 or 8;
5.2b) adding the square sum of the prediction errors E (i, j) of each pixel not comprising the upper three rows and the left three columns in the block data to obtain the square sum of the prediction errors E (i, j) of the block datatotal
Figure GDA0002251050150000081
Wherein
Figure GDA0002251050150000082
Means that E (i, j) is accumulated in the range of i 1,2, … N, j 1,2, … N;
5.2c) according to the sum of squares of prediction errors E of the block datatotalEstablishing an equation set:
Figure GDA0002251050150000083
wherein
Figure GDA0002251050150000084
Denotes a reaction of EtotalWeight coefficient rho for the first reference pixel1The partial differential is calculated, and the partial differential,
Figure GDA0002251050150000085
denotes a reaction of EtotalWeight coefficient rho for the second reference pixel2Partial differentiation
Figure GDA0002251050150000086
Denotes a reaction of EtotalWeight coefficient rho for the third reference pixel3The partial differential is calculated, and the partial differential,
Figure GDA0002251050150000087
denotes a reaction of EtotalWeight coefficient rho for the fourth reference pixel4Partial differentiation is calculated;
5.2d) solving the equation set in the step (5.2c) to obtain a reference pixel weight coefficient vector
Figure GDA0002251050150000088
Further obtaining weight coefficients rho of four reference pixels1234
And step six, performing predictive compression on the original image block data.
6.1) predicting each pixel which does not comprise the upper three rows and the left three columns in the block data according to the established recursive Markov prediction model in the step five to obtain a predicted value matrix;
6.2) subtracting the gray value of each pixel which does not comprise the upper three rows and the left three columns in the block data from the corresponding predicted value in the predicted value matrix to obtain a difference value matrix R, performing Discrete Cosine Transform (DCT) on the difference value matrix R to obtain a transformation coefficient matrix T, and then quantizing and entropy coding the transformation coefficient matrix T to obtain a compression code, wherein if the quantization step is omitted, a lossless compression code can be obtained;
6.3) decoding, inversely quantizing and inversely DCT transforming the compressed code to obtain a restored difference matrix R ', adding the R' and the difference matrix R to obtain a reconstruction value matrix, and updating the pixel value at the corresponding address in the extended image data block according to the reconstruction value matrix.
And step seven, judging whether the prediction of all the block data is finished, if so, ending the compression, otherwise, jumping the data reading address to the initial address of the next block data, and returning to the step four.
The foregoing description is only an example of the present invention and should not be construed as limiting the invention, as it will be apparent to those skilled in the art that various modifications and variations in form and detail can be made without departing from the principle and structure of the invention, but these modifications and variations will still fall within the scope of the appended claims.

Claims (5)

1. The recursive prediction image compression method based on the gradient direction histogram comprises the following specific steps:
(1) reading an original gray image with the size of M multiplied by M and the suffix of raw format from a natural image set, wherein M represents the width and the height of the original gray image, and x represents the multiplication operation;
(2) judging the texture direction of the original image:
(2a) carrying out boundary expansion on the original gray image in the step (1) in a row from top to bottom and a column from left to right to obtain an expanded image with the size of (M +2) × (M + 2);
(2b) calculating the gradient direction angle of each pixel point of the expanded image, which does not comprise the boundary expansion, by using a Sobel gradient operator according to the sequence from left to right and from top to bottom, and further obtaining a gradient direction angle matrix G of the original gray image;
(2c) uniformly dividing the gradient direction angle matrix G into block matrixes with the size of N multiplied by N, reading the block matrixes, and initializing the reading times k to be 1, wherein N represents the row number and the column number of the block matrixes and takes the value of 4 or 8;
(2d) counting a gradient direction histogram of the k block matrix to obtain an angle corresponding to a peak value of the gradient direction histogram
Figure FDA0002205721840000011
And determining the angle of the texture main direction of the image data block as
(2e) Judging whether the texture direction judgment of all the original gray image data blocks is finished, if so, executing the step (3), otherwise, increasing the k by self by 1, and returning to the step (2 d);
(3) carrying out boundary extension on the original gray-scale image data in the step (1) by three rows at the upper part and three columns at the lower part and three columns at the left part and the right part to obtain extended image data with the size of (M +6) × (M +6), and initializing a data reading address to be an initial address position of the extended image data;
(4) reading the extended image data in units of blocks having a size of (N +3) × (N +3) from the data read address;
(5) establishing a Markov prediction model according to the read block data:
(5a) estimating weight coefficients of reference pixels in the recursive Markov prediction model by using a least square estimation method;
(5b) according to the texture main direction obtained in the step (2), establishing a two-dimensional recursive Markov prediction model for each pixel point which does not comprise three lines at the upper side and three lines at the left side in the block data by utilizing a plurality of reference pixel points adjacent to the texture direction;
(6) prediction of block data:
(6a) predicting each pixel of the block data, which does not comprise the upper three rows and the left three columns, according to the established recursive Markov prediction model in the step (5) to obtain a predicted value matrix;
(6b) subtracting the gray value of each pixel excluding the upper three rows and the left three columns in the block data from the corresponding predicted value in the predicted value matrix to obtain a difference value matrix R, performing Discrete Cosine Transform (DCT) on the difference value matrix R to obtain a transform coefficient matrix T, and then quantizing and entropy coding the transform coefficient matrix T to obtain a compressed code;
(6c) decoding, inversely quantizing and inversely DCT transforming the compressed code to obtain a restored difference matrix R ', adding the R' and the difference matrix R to obtain a reconstruction value matrix, and updating the pixel value at the corresponding address in the extended image data block according to the reconstruction value matrix;
(7) and (4) judging whether the predictive compression of all the block data is finished, if so, ending the compression, otherwise, jumping the data reading address to the starting address of the next block data, and returning to the step (4).
2. The method of claim 1, wherein the gradient direction angle of each pixel point of the original gray image is calculated in step (2b) according to the following steps:
(2b1) selecting a Sobel gradient operator template matrix as follows:
Figure FDA0002205721840000021
wherein SxAs a horizontal gradient operator, SyA vertical gradient operator;
(2b2) will SxConvolving with 3 multiplied by 3 neighborhood of the current pixel point to obtain a horizontal gradient GxAnd then S isyConvolving with 3 multiplied by 3 neighborhood of the current pixel point to obtain a vertical gradient Gy
(2b3) According to the result of the step (2b2), calculating the gradient direction angle theta (x, y) of the current pixel point:
Figure FDA0002205721840000022
3. the method according to claim 1, wherein the extended image data is read in units of (N +3) x (N +3) blocks in the step (4) by:
(4a) initializing a (N +3) × (N +3) two-dimensional matrix to store block data, and initializing the reading times i to 1;
(4b) starting from the data reading address, reading N +3 data, and assigning the data to a first row of the two-dimensional matrix;
(4c) increasing the data reading address by M +6 and increasing i by 1;
(4d) and (4) judging whether i is equal to N +3, if so, finishing the reading of the block data, and otherwise, returning to the step (4 b).
4. The method of claim 1, wherein the two-dimensional recursive markov prediction model in step (5b) is represented as follows:
u(i,j)=ρ1u1(i,j)+ρ2u2(i,j)+ρ3u3(i,j)+ρ4u4(i,j)+e(i,j),i、j=0,1,2…N
wherein u (i, j) represents the predicted value of the pixel point with the coordinate (i, j), and u (i, j) represents the predicted value of the pixel point with the coordinate (i, j)1(i,j),u2(i,j),u3(i,j),u4(i, j) represent the gray values, ρ, of the four reference pixels, respectively1234The weight coefficients of the four reference pixels, e (i, j) is white noise.
5. The method of claim 1, wherein the estimating of the weight coefficients of the reference pixels in the recursive markov prediction model in step (5a) is performed as follows:
(5a1) the sum of the square of the prediction errors E (i, j) of the respective pixels excluding the upper three rows and the left three columns in the block data is expressed as follows:
E(i,j)=(u(i,j)-ρ1u1(i,j)-ρ2u2(i,j)-ρ3u3(i,j)-ρ4u4(i,j))2
wherein u (i, j) represents the predicted value of the pixel point with the coordinate (i, j), and u (i, j) represents the predicted value of the pixel point with the coordinate (i, j)1(i,j),u2(i,j),u3(i,j),u4(i, j) represent the gray values, ρ, of the four reference pixels, respectively1234Weight coefficients of four reference pixels, i and j are 1,2 and … N, where N represents the number of rows of the block data excluding the area of the three rows above and three columns leftThe number of columns is 4 or 8;
(5a2) the sum of the square of the prediction errors E (i, j) of each pixel excluding the upper three rows and the left three columns in the block data
Adding to obtain the square sum of prediction error E of block datatotal
Figure FDA0002205721840000031
Wherein
Figure FDA0002205721840000032
Means that E (i, j) is accumulated in the range of i 1,2, … N, j 1,2, … N;
(5a3) according to the sum of squares of prediction errors E of block datatotalEstablishing an equation set:
Figure FDA0002205721840000041
wherein
Figure FDA0002205721840000042
Denotes a reaction of EtotalWeight coefficient rho for the first reference pixel1The partial differential is calculated, and the partial differential,
Figure FDA0002205721840000043
denotes a reaction of EtotalWeight coefficient rho for the second reference pixel2The partial differential is calculated, and the partial differential,
Figure FDA0002205721840000044
denotes a reaction of EtotalWeight coefficient rho for the third reference pixel3The partial differential is calculated, and the partial differential,
Figure FDA0002205721840000045
denotes a reaction of EtotalWeight coefficient rho for the fourth reference pixel4Partial differentiation is calculated;
(5a4) for the system of equations in step (5a3)Solving is carried out to obtain a reference pixel weight coefficient vector
Figure FDA0002205721840000046
Further obtaining weight coefficients rho of four reference pixels1234
CN201710119825.9A 2017-03-01 2017-03-01 Recursive prediction image compression method based on gradient direction histogram Active CN106954065B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710119825.9A CN106954065B (en) 2017-03-01 2017-03-01 Recursive prediction image compression method based on gradient direction histogram

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710119825.9A CN106954065B (en) 2017-03-01 2017-03-01 Recursive prediction image compression method based on gradient direction histogram

Publications (2)

Publication Number Publication Date
CN106954065A CN106954065A (en) 2017-07-14
CN106954065B true CN106954065B (en) 2020-01-07

Family

ID=59467108

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710119825.9A Active CN106954065B (en) 2017-03-01 2017-03-01 Recursive prediction image compression method based on gradient direction histogram

Country Status (1)

Country Link
CN (1) CN106954065B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112070788B (en) * 2020-09-03 2023-03-10 武汉工程大学 Image processing method for rapidly counting deformation twin crystal based on block gradient segmentation
CN112967207B (en) * 2021-04-23 2024-04-12 北京恒安嘉新安全技术有限公司 Image processing method and device, electronic equipment and storage medium
CN116071242B (en) * 2023-03-17 2023-07-14 山东云海国创云计算装备产业创新中心有限公司 Image processing method, system, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007035387A2 (en) * 2005-09-16 2007-03-29 Sony Electronics, Inc. Adaptive motion estimation for temporal prediction filter over irregular motion vector samples
CN101977323A (en) * 2010-11-16 2011-02-16 上海交通大学 Method for reconstructing distributed video coding based on constraints on temporal-spatial correlation of video
CN103856776A (en) * 2013-12-26 2014-06-11 辽宁师范大学 Image coding and decoding method for boundary and curvature drive repairing
CN105069819A (en) * 2015-07-23 2015-11-18 西安交通大学 Predicted value compensation method based on MED predication algorithm
CN106231322A (en) * 2016-07-21 2016-12-14 北京奇艺世纪科技有限公司 Lossless image compression method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2007035387A2 (en) * 2005-09-16 2007-03-29 Sony Electronics, Inc. Adaptive motion estimation for temporal prediction filter over irregular motion vector samples
CN101977323A (en) * 2010-11-16 2011-02-16 上海交通大学 Method for reconstructing distributed video coding based on constraints on temporal-spatial correlation of video
CN103856776A (en) * 2013-12-26 2014-06-11 辽宁师范大学 Image coding and decoding method for boundary and curvature drive repairing
CN105069819A (en) * 2015-07-23 2015-11-18 西安交通大学 Predicted value compensation method based on MED predication algorithm
CN106231322A (en) * 2016-07-21 2016-12-14 北京奇艺世纪科技有限公司 Lossless image compression method and device

Also Published As

Publication number Publication date
CN106954065A (en) 2017-07-14

Similar Documents

Publication Publication Date Title
US8705611B2 (en) Image prediction encoding device, image prediction encoding method, image prediction encoding program, image prediction decoding device, image prediction decoding method, and image prediction decoding program
CN112203095B (en) Video motion estimation method, device, equipment and computer readable storage medium
KR100809354B1 (en) Apparatus and method for up-converting frame-rate of decoded frames
WO2016141609A1 (en) Image prediction method and related device
US10291925B2 (en) Techniques for hardware video encoding
CN103119945A (en) Method and apparatus for encoding and decoding image through intra prediction
CN106952314B (en) Recursive prediction method for compressing image based on frequency domain direction filter
JP2009147807A (en) Image processing apparatus
KR102254986B1 (en) Processing of equirectangular object data to compensate for distortion by spherical projections
US20040151392A1 (en) Image encoding of moving pictures
CN106954065B (en) Recursive prediction image compression method based on gradient direction histogram
JP4405516B2 (en) Rectangular motion search
WO2012086829A1 (en) Movement estimation device, movement estimation method, movement estimation program, and video image encoding device
US10855983B2 (en) Encoding video using two-stage intra search
CN101873490B (en) Image processing method and image information coding apparatus using the same
CN115567722A (en) Application acceleration
CN105263026A (en) Global vector acquisition method based on probability statistics and image gradient information
JP4957780B2 (en) Motion compensated predictive coding apparatus, motion compensated predictive coding method, and program
CN106101731B (en) Lossless Image Compression Algorithm method and device
JP2011199868A (en) Adaptive search area in motion estimation process
US10187656B2 (en) Image processing device for adjusting computational complexity of interpolation filter, image interpolation method, and image encoding method
JP7411785B2 (en) Interpolation filtering method and device, computer program and electronic device for intra prediction
CN107431821B (en) Efficient low complexity video compression
US10129543B2 (en) Image compressing device and image compressing method
Mishra et al. Comparative study of motion estimation techniques in video

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant