Научная статья на тему 'Line-By-Line Prediction Method in Lossy Image Compression'

Line-By-Line Prediction Method in Lossy Image Compression Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
29
9
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
image compression / image fragmentation / line-by-line prediction

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — N. A. Gavrilova, V. A. Khodakovsky

We propose a method of line-by-line prediction in the problem of lossy compression of images within the framework of the so-called structural approach. At the first stage, a partition of each row of the image into non-intersecting fragments with the help of recursive algorithm of peak fragmentation, the result of which is to partition each row of the image into non-intersecting fragments, the boundaries of which are points of local extrema which satisfy the specified requirements. As a result, an array of boundaries of the fragments of image lines is formed. At the second stage, the task of reducing the number of fragments on the basis of the prediction method is set. To do this, a criterion is introduced, which depends on the partitioning of lines into groups and the number of fragments in the group (based on the first line in the group the prediction error for the other lines is found; for line prediction errors the partitioning into fragments is found). To find the partition into groups and the number of fragments in each group, algorithms have been developed that deliver both global and local minimum to the selected criterion. The dynamic programming method is used for global minimization.

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «Line-By-Line Prediction Method in Lossy Image Compression»

Line-By-Line Prediction Method in Lossy Image Compression

Nadezhdi Gavrilovaa and Valentin Khodakovskyb

aOOO "Solit-Clouds"( Limited Liability Company), Novodmitrovskaya str., 2k1, Moscow, 127015, Russian Federation

bEmperor Alexander I St. Petersburg State Transport University, Moskovskiy pr, 9, Saint-Petersburg, 190031, Russian Federation

Abstract

We propose a method of line-by-line prediction in the problem of lossy compression of images within the framework of the so-called structural approach. At the first stage, a partition of each row of the image into non-intersecting fragments with the help of recursive algorithm of peak fragmentation, the result of which is to partition each row of the image into non-intersecting fragments, the boundaries of which are points of local extrema which satisfy the specified requirements. As a result, an array of boundaries of the fragments of image lines is formed. At the second stage, the task of reducing the number of fragments on the basis of the prediction method is set. To do this, a criterion is introduced, which depends on the partitioning of lines into groups and the number of fragments in the group (based on the first line in the group the prediction error for the other lines is found; for line prediction errors the partitioning into fragments is found). To find the partition into groups and the number of fragments in each group, algorithms have been developed that deliver both global and local minimum to the selected criterion. The dynamic programming method is used for global minimization.

Keywords

image compression, image fragmentation, line-by-line prediction

1. Introduction

:At carrying out of a number of technical and natural-science researches there is a problem of compression of images in connection with necessity of transfer and the subsequent storage of large volumes of the data. So, for example, at remote sensing of the earth the transmitted images contain millions and tens millions pixels that demands application of procedures of compression of images allowing loss of information at insignificant decrease in quality of images [1].

To date, there are many works [2-11] devoted to methods of solving this problem. Among them, one can distinguish a large group of works within the framework of the so-called structural approach [12], in which an image is divided into some fragments (blocks,

'Intelligent Transport Systems. Transport Security - 2021, May 14, St. Petersburg, Russia

EMAIL: wuuzee.nd@gmail.com (N.A. Gavrilova); hva1104@mail.ru (V.A. Khodakovsky) ORCID: 0000-0002-1948-9833 (N.A.Gavrilova); 0000-0002-2060-4560 (V.A. Khodakovsky);

©□ 2021 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0).

f|CEUR Workshop Proceedings (CEUR-WS.org)

areas of different configuration) with their subsequent analysis and transformation in order to obtain a compressed representation of both the fragments themselves and the image as a whole. So in works [2-6] the initial image is divided into non-intersecting blocks of the fixed size, for each block the orthogonal transformation is performed. Discrete Fourier Transform (DFT), Discrete Walsh Transform (DWT), Discrete Cosine Transform (DCT) and others are used as orthogonal transforms.

A comparative analysis of the efficiency of blockwise discrete orthogonal transformations of images was carried out in [2]. It is shown that DCT provides packing the largest amount of information in the smallest number of coefficients (for most real images) in comparison with DFT and DWT, and also minimizes the effect of appearance of block structure, manifested in the fact that in the image become visible boundaries between neighboring blocks. The latter is due to the fact that one-dimensional DCT uses an even continuation of the data sequence. These advantages of DCT led to the fact that it found application in one of the most popular standards of compression of grayscale images JPEG. At the same time, it is noted in a

number of works [3-7] that small details and blurred contours on images are distorted when using DCT, and at high compression ratios the block structure effect is manifested.

Methods of image compression based on contour extraction [7-9], which allow to keep quality representation of contours on reconstructed images, can be referred to a structural approach. Thus, in works [7,8] contours are firstly selected on the initial image and subjected to the procedure of broadening. Then, the formed binary image -mask is superimposed on the initial image, as a result, a masked image is formed, which contains large "empty" areas. The binary and masked images are compressed using a Kanni detector and a one-dimensional DCT, respectively. A modified bilinear interpolation algorithm, which takes into account the pixel location relative to the image contours, is developed for pixel reconstruction of "empty" regions. The efficiency of the algorithm for low-frequency images is noted, which significantly decreases for detailed images containing a large number of contours.

The works [10,11] analyze the approaches of interpolation of images on the coding side using local continuous functions with predetermined accuracy. In this case a fragment of an image is a part of an image line, which is approximated with a given accuracy by a polynomial of a given degree (zero-order and first-order polynomials are used). A sequential fan-type algorithm [9], which requires determination of local continuous functions for each pixel of the image, is used to determine the boundaries of fragments, which leads to significant computational cost. The aim of this work is to develop image compression algorithms that are close in ideology to the structural methods considered above.

We propose a procedure consisting of two stages. At the first stage there is a partitioning of each line of the image into an unknown number of non-overlapping "same-type" fragments, using the so-called peak fragmentation of images. Then, based on the obtained partitions, algorithms for line-by-line prediction are developed.

2. Recursive algorithm for peak image fragmentation

The proposed recursive algorithm of peak fragmentation consists in splitting the image string into non-intersecting fragments, so that on the boundaries of fragments the corresponding pixel takes a local minimum or maximum. Such a pixel will be called a peak and denoted by pij. We will consider that a peak is Pij=Xij a local maximum if:

X,j-1 ^ Xj > Xj+1 u Xj-1 < Xj > X,j+1, (2.1)

and a local minimum if

-1 ^ x <+1 u Xj-1 > x ^+1 .

(2.2)

Definitions (2.1), (2.2) take into account the presence of so-called "plateaus" in the image, i.e. the presence of a sequence of pixels with the same value.

The operation of the fragmentation algorithm is based on the concept of a sector. A sector is an array of pixels (xin,xin+i,...,xim) and two peaks piq, pis, which are one to the left and one to the right of the pixel array in question,q<n<m<s. The peaks, which when the algorithm works, will be in a certain state are considered as fragment boundaries, their value and position in the string are stored in the array of fragment boundaries.

At the beginning of the algorithm, the sector is the whole string. Then we analyze the sector, search for peaks within the sector, and divide the sector into subsectors according to the peaks found, with the peaks that are in the defined state being stored in the array of fragment boundaries.

For each subsector the sector processing procedure is repeated, new subsectors are defined, and so on. Such recursive procedure continues until further partitioning into subsectors becomes impossible. The array of fragment boundaries formed as a result of the procedure contains the required fragment boundaries.

The procedure converges in a finite number of steps, because each iteration divides the sector into several subsectors or reduces the number of pixels in the sector.

As a result of the described fragmentation algorithm, the following array of image line splits is formed:

(L0 = 1 < L[ < L2 <... < Lj <... < L'r = M),

Xl = Xl Xi = ( xi1, Xl 2,---Xlj »■■■» XlM ),

i = 1,2,..., N,

Where L'j and r- are the boundary j-th fragment and the number of fragments for the i-th line of the image, respectively; the pixel values on the boundaries of the resulting partitions are memorized:

xiXj, i = 1,2,...,N, j = 0,...,r.

The compression ratio of the fragmentation

N

algorithm is equal to the ratio (N • M) / ^ 2r .

i=1

Comparison operations are used and the number of operations is proportional to 2N

Next, a line-by-line prediction procedure is performed based on the descriptions obtained at the fragmentation stage.

3. Compression prediction

with line-by-line

Consider the partitioning of the

Li(r) = (L0 = 1 <E1<<... <Lj <... <Lr = M)

i-th line of the original image. Let us connect the pixels located on the borders of the fragments with straight lines and discretize the function thus constructed. As a result, we will get an array = ( Xa, Xt 2,..., XM ), built for i-th line, which we will call a prediction line. Consider the i-th line and calculate

j = 0,..., M.

Let's call Xl the string-error prediction of l-th string. Let us apply the fragmentation procedure to Xl. Denote by L(i,l)- the partition obtained after fragmentation, r(i,l)-the number of fragments of the partition L(i,l). The compression coefficient that can be obtained as a result of applying the prediction procedure to the string on the l basis of the ith string, given by the corresponding partitions, is the ratio r/r(i,l).

Consider splitting image lines into non-overlapping groups, where the first element of the group is the prediction line, the rest of the group's lines are the lines to which the prediction is applied (an illustration of such a division is shown in the Figure 1). Let us introduce a criterion equal to the number of fragments counted for the entire image, with a fixed division of lines into groups and using the prediction method described above:

s Gk+1-1

Q = X r(Gk) + X r(Gk,l) , (3.1)

k=1 1=Gk +1

wheres - number of groups, Gk- number of prediction line k-th group (the first line in the group),r(Gk)=rGk - number of prediction line Gk, r(Gk,l)-number of prediction line partitioning fragments l-th for k-th group. It is required to find such a partitioning into groups that criterion (3.1) takes minimal value.

1st group | -

kth group j -

sth group j----

Figure 1: Splitting image lines into non-intersecting groups, with the first element of the group being the prediction line, the rest of the group lines being the lines to which the prediction is applied.

Criterion (3.1) has the following property. Denote by Gkk=Gk+1-1 - the number of the last row in the k-group. Fix the position of Gkk. Then optimal position of lines G\,...,Gk-1k-i of fragment groups 1,...,k-1 obtained by minimization (3.1) only on G\,...,Gk-1k-1 do not depend on position of lines Gk+lk+\, ..., of fragment groups k+1, ..., s. Really, criterion (3.1) can be presented as a sum of two nonnegative values: Q=Qa+Qb, where

Qa = Qa (G1,..., Gkk:\l Gkk ) =

=1

j=1

r (Gj )

: r(G , D

1=G, +1

Qb = Qb (Gk+11,...,G£l Gkk ) =

= Z

J=k+1

r (Gj ) + : r (Gj , 1 )

1=G, +1

But then, obviously,

arg min Q = arg min Qa

G;,...,Gkk:; G;,...,Gkt:11

It follows from this property that if Gk - is the optimal position of the last line in the k-group, then the optimal position of the lines k-1 of the fragment groups 1, ..., k-1, obtained by minimizing (3.1) only on G11,.,Gk-1k-1, are also optimal.

The considered property of criterion (3.1) allows to use the dynamic programming procedure [13].

Further, a description of the corresponding procedure is given, taking into account that the number of rows in each group does not exceed the given valueNG, and, therefore, the minimum number of groups smin=M/NG. The maximum number of groups is assumed smax to be given.

Denote by R(iJ)- the number of fragments defined in the group of linesi,i+1,...J, where the i-th line is the prediction line, the other lines are prediction liness. If i=J, then the group consists of only one line, the prediction line, R(i,J)=ri. In these notations criterion (3.1) can be written in the form:

Q = ¿R(Gk,Gk+1 -1), G = 1, Gs+1-1 = M. (3.2)

k=1

P1.s=1. Calculated by

&(i) = RG1,i), i = 1,2,...,NG .

P2. s=s+1. Calculated

Qs{l) = min [Qs_j(j) + R(j + 1,l)],

j=s- 1,...,v , (3.3)

l = s,...,min [ sHNG, M ]

Where v=l-1 at /<(s-1)^NG+1, and v=(s-1)NG otherwise.

For each lare memorized

Ts(l)=aarggniin Qs(l).

j=s- 1,...,v

P3. If s smax

Otherwise - to P2.

the transition to P4.

P4. We find the number of groups s criterion (3.2):

s* = arg min Qs (M)

s=sm,n ,...,sm.

P5. By a reverse move we find the optimal position of the predictor lines:

G. = T.(M), G. , = T* ,(G.),...,

s sv 7 s -1 j-^j7

G2 = T2(G3)

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

G. = G. +1, G. = G. ,+1,...,

s s ' s —1 s —1 ^ ^

G2 = G2 +1

The proposed procedure makes it possible to find a partitioning into groups, which delivers the global minimum to criterion (3.1) under the restriction on the number of rows in the groups. As a disadvantage of the algorithm we can note a relatively large amount of calculations.

For real images, the correlation of two lines, as a rule, decreases with increasing distance between them. Taking this circumstance into account, we propose a partitioning procedure delivering a local minimum to criterion (3.1).

Let the predictor string with number Gk<M-1 (Gj = 1) be defined. Then we define Gk+1.

If Gk=M-1, then Gk+l=M. Otherwise, a prediction-error string is sequentially formed l=Gk+1,Gk+2,... for the l-th prediction string Xl on the basis of the prediction string Gk, the

partition and the number L(Gk,l) of fragmentsr(Gk,l), are determined , compared with r(Gk,l) c rh

If for some l line r(Gk,l)>\rh (K< 1) -algorithm parameter, allows to take into account a relatively significant decrease in the number of fragments when predicting), then further we check whether this event is random. To do this, more linesp are looked through (p=min[M-l -1,Po], Po - set) and for each current line the andl calculated

s1 = r (Gk, l *) + r (Gk, l * +1) +... + r (Gk, l) and

s2 = rr+ rr+1+,...,ri.

If for somel° condition s1<As2, the procedure is resumed from the linel°. If for allp liness1<As2, then it is takenGk+i=l .

Then a local optimization of the criterion is carried out. For this purpose the following iterative algorithm is proposed.

Let at the i-th iteration the partitioning of all image lines into groupssis found:

G(i) = [Gk(i),Gk+1 (i)-1], k = 1,2,...,s; G^i) = 1.

Then the partition G(i+1) at (i+1) iteration is found as follows. Consistently for all k=2,3,.. ,,s predictor strings except for Gk(i) and is determined Gk(i+1). For this purpose, the local minimum of the criterion in the range [max(Gk -) + 1,Gk(i) - q) < Gk < mm(Gk(i) + q,G+i) - 1)] (q - a given number) is searched for. In other words, the position of the k-th predictor string is found such that on the adjacent groups and [Gk), Gk-1] and [Gk, Gk+l(i) -1] the number of fragments is minimal. The resulting predictor string Gk is Gk (i +1).

The procedure ends at iteration i', when either the partitioning is the same as in the previous iteration (G(i*) = G(i* -1)), or i = i (

i - a given maximum number of iterations).

The compression coefficient resulting from the line prediction procedure is determined by the formula:

Z'

/ Z

—k+i -

r (Gk ) + Z r (Gk, l)

The advantage of this formula is that it represents a failure analytical expression that allows you to speculatively estimate the possible values of the compression ratio.

4. Conclusion

The paper considers a method of line-byline prediction in the problem of lossy compression of images within the framework of the so-called structural approach and consisting of two stages. At the first stage (fragmentation stage), a fast recursive algorithm for peak line-by-line fragmentation of images is proposed. As a result of the algorithm's work, the partition of each line of the image into non-intersecting fragments, the boundaries of which are the points of local extremums that satisfy the specified requirements, is found. The high performance of the algorithm is achieved by the fact that in it the comparison operation is the main one.

At the second stage (the prediction stage), based on the partitioning of image lines into fragments obtained at the first stage, the task of reducing the number of fragments of the whole image based on the prediction method is set. For this purpose, a criterion dependent on the partitioning of image lines into groups and the number of fragments in the groups is introduced, and algorithms for its minimization, which deliver both global and local minimum to the selected criterion, are proposed.

We propose to use the developed algorithms for image processing, which allow preserving the structural features of the image without significant loss in the visual quality of the image.

References

[1] Starobinets D.Yu., Khomonenko A.D., Gavrilova N.A. Automatic selection of lossy image compression parameters based on invariant moments during Earth remote sensing. Current problems in remote sensing of the earth from space. 2017.Vol. 14.No. 5. P. 26-36.

[2] Gonzalez R., Woods R. Digital Image Processing. Moscow: Technosphere, 2012.1104 p.

[3] Data compression methods. The device of archivers, image and video compression / D. Vatolin, A. Ratushnyak, M. Smirnov, V. Yukin. MOSCOW: DIALOG-MIFE, 2002. 384 p.

[4] Fisenko V.T., FisenkoT.Yu. Computer Processing and Image Recognition: Tutorial. St. Petersburg: St. Petersburg State University ITMO, 2008. 192 p.

[5] Krasilnikov N. N. Digital Processing of 2D- and 3D-Images: Tutorial. SPb.: BKhV-Peterburg, 2011. 608 p.

[6] Ismagilov I.I., Vasilieva M.Y. Compression of digital images using Walsh transformations. Problems of power engineering. Kazan, 2008. No 910. Pp. 91-99.

[7] Samokhvalov A.V. Development of method of interpolation of half-tone images with large empty areas // Bulletin of Izhevsk State Technical University, 2009. No 2 (42). P. 138-141.

[8] Samokhvalov A.V. Compression of halftone images based on contour coding and interpolation and discrete wavelet

transform // Ph.D. Author's abstract, Izhevsk, Izhevsk State Technical University, 2009. 23 p.

[9] V.G. Ivanov, MG. Lubarsky, Yu.V. Lomonosov. Image compression based on contour compensation in wavelet transform // Problems of Control and Informatics, 2006, No3.P. 89-101.

[10] Davisson L. Data compression using straight line interpolation. IEEE Transactions on Information Theory, 1968, 14(3): 390-394.

[11] Pratt W. Digital Image Processing: Wiley, 2007, 807 p.

[12] Braverman E.M., Muchnik I.B. Structural methods of empirical data processing. Moscow: Nauka, 1983. 464 p.

[13] Bellman R. , Dreyfus S. Applied Problems of Dynamic Programming. Moscow: Nauka. 1969. 457 p.

i Надоели баннеры? Вы всегда можете отключить рекламу.