RU2485591C1 - Method of compressing graphics files - Google Patents
Method of compressing graphics files Download PDFInfo
- Publication number
- RU2485591C1 RU2485591C1 RU2012114277A RU2012114277A RU2485591C1 RU 2485591 C1 RU2485591 C1 RU 2485591C1 RU 2012114277 A RU2012114277 A RU 2012114277A RU 2012114277 A RU2012114277 A RU 2012114277A RU 2485591 C1 RU2485591 C1 RU 2485591C1
- Authority
- RU
- Russia
- Prior art keywords
- frame
- value
- original
- geometric dimensions
- graphic
- Prior art date
Links
- 230000000694 effects Effects 0.000 abstract 1
- 239000000126 substance Substances 0.000 abstract 1
- 238000007906 compression Methods 0.000 description 24
- 230000005540 biological transmission Effects 0.000 description 6
- 238000000034 method Methods 0.000 description 2
- 239000003086 colorant Substances 0.000 description 1
- 230000003068 static Effects 0.000 description 1
Images
Abstract
Description
Изобретение относится к обработке, сжатию и передаче информации, в частности к способу сжатия графических файлов, и может быть использовано в системах передачи и приема сжатых графических файлов.The invention relates to the processing, compression and transmission of information, in particular to a method for compressing graphic files, and can be used in systems for transmitting and receiving compressed graphic files.
Из уровня техники известен способ (US 7020837, 28.03.2006) для эффективного сжатия графического содержания в сложных файлах PDF, содержащих комбинированные сложные графические страницы, каждая из которых составлена из базовой страницы и нуля или более наложений, а также страниц PDF. При этом страницы и графические элементы каждой страницы сохранены в статических файлах PDF.The prior art method (US 7020837, 03/28/2006) for efficiently compressing graphic content in complex PDF files containing combined complex graphic pages, each of which is composed of a base page and zero or more overlay, as well as PDF pages. At the same time, the pages and graphic elements of each page are saved in static PDF files.
Известен способ (CN 1595452, 16.03.2005) сжатия без потерь для графического файла, в котором сжимают графический файл согласно заданным параметрам длины регистра сжатия. Выбирают оптимальный параметр длины регистра сжатия. После этого сжимают графический файл согласно выбранному оптимальному параметру длины. Затем главная информация файла (графическая информация), информация сжатия и так далее вместе со сжатыми данными записываются в файле, тем самым формируя файл сжатия.A known method (CN 1595452, March 16, 2005) lossless compression for an image file in which an image file is compressed according to the specified parameters of the compression register length. Select the optimal compression register length parameter. After that, the graphic file is compressed according to the selected optimal length parameter. Then, the main file information (graphic information), compression information, and so on together with the compressed data are recorded in the file, thereby forming a compression file.
Недостатками известных способов является то, что после передачи сжатых файлов и их декомпрессии графическое изображение на выходе теряет четкость, при том что способы-аналоги обеспечивают относительно низкую степень сжатия, что не позволяет сжатые ими файлы передавать с большой скоростью по каналам передачи данных.The disadvantages of the known methods is that after the transmission of compressed files and their decompression, the graphic image at the output loses clarity, while the analogue methods provide a relatively low degree of compression, which does not allow them to transfer files compressed at high speed over data transmission channels.
Наиболее близким по технической сущности к заявленному является контурный способ сжатия графических файлов (патент РФ №2339998, 06.03.2007 г.). В известном способе-прототипе кадр графического изображения уменьшают при помощи специальной функции (ресайза), по меньшей мере, в 4 раза, сжимают и сохраняют его в сжатом файле, который декомпрессируют и увеличивают, по меньшей мере, в 4 раза. Затем исходный кадр графического изображения накладывают на декомпрессионный увеличенный кадр, производят поиск разницы пиксельных значений между исходным кадром графического изображения и декомпрессионным увеличенным кадром из заданного значения контраста по признаку контрастных элементов при помощи арифметического вычитания друг из друга. Затем, полученный кадр со значениями контура контрастных элементов сжимают без потерь и сохраняют в сжатом файле.Closest to the technical nature of the claimed is a contour method of compressing graphic files (RF patent No. 2339998, 03/06/2007). In the known prototype method, the frame of the graphic image is reduced using a special function (resize) at least 4 times, compressed and stored in a compressed file, which is decompressed and enlarged at least 4 times. Then, the original frame of the graphic image is superimposed on the decompression enlarged frame, the difference between the pixel values between the original frame of the graphic image and the decompression enlarged frame from the given contrast value based on the contrast elements by arithmetic subtraction from each other is searched. Then, the resulting frame with the values of the contour of the contrasting elements is compressed without loss and stored in a compressed file.
Недостаток способа-прототипа состоит в том, что для изображений с достаточно низким показателем контрастности полученный кадр со значениями контура контрастных элементов будет содержать относительно малое число нулевых коэффициентов. В результате для него обеспечивается довольно низкая степень сжатия, что не позволяет сжатые файлы передавать с большой скоростью по каналам передачи данных. Кроме того, известный способ-прототип не обеспечивает максимально возможную степень сжатия кадра графического изображения исходя из заданного качества восстановленного и увеличенного кадра графического изображения.The disadvantage of the prototype method is that for images with a sufficiently low contrast ratio, the resulting frame with the values of the contour of the contrast elements will contain a relatively small number of zero coefficients. As a result, a rather low compression ratio is provided for it, which does not allow compressed files to be transmitted at high speed over data transmission channels. In addition, the known prototype method does not provide the maximum possible compression ratio of a graphic image frame based on a given quality of the restored and enlarged graphic image frame.
Техническим результатом заявляемого способа является повышение степени сжатия графических файлов и скорости их передачи по каналам данных для заданной величины пикового отношения сигнал/шум.The technical result of the proposed method is to increase the degree of compression of graphic files and the speed of their transmission through data channels for a given value of the peak signal to noise ratio.
Это достигается тем, что способ сжатия графических файлов, включающий операции изменения геометрических размеров исходных кадров графического изображения с последующей декомпрессией кадров графического изображения и качественной оценки параметров, отличается тем, что сначала задают число возможных градаций уменьшения геометрических размеров исходного кадра, затем уменьшают его геометрические размеры на величину первой градации, сжимают, декомпрессируют и увеличивают до исходного размера, после чего определяют величину пикового отношения сигнал/шум, характеризующую качество восстановленного кадра по сравнению с исходным, и сравнивают ее с предварительно заданным значением, при этом если полученное значение превысит заданное, то все операции повторяют для второй и последующих градаций до тех пор, пока величина пикового отношения сигнал/шум не станет меньше или равна заданному значению отношения сигнал/шум.This is achieved by the fact that the method of compressing graphic files, including the operation of changing the geometric dimensions of the original frames of the graphic image with subsequent decompression of the frames of the graphic image and a qualitative assessment of the parameters, differs in that they first specify the number of possible gradations for reducing the geometric dimensions of the original frame, then reduce its geometric dimensions by the value of the first gradation, compress, decompress and increase to the original size, after which the value of peak wear signal-to-noise characterizing the quality of the reconstructed frame compared to the original one, and compare it with a predetermined value, and if the obtained value exceeds the specified value, then all operations are repeated for the second and subsequent gradations until the value of the peak signal-to-noise ratio will not be less than or equal to the specified signal-to-noise ratio.
Заявленный способ поясняется чертежами, на которых показаны:The claimed method is illustrated by drawings, which show:
фиг.1 - принцип представления кадра графического изображения на основе 5 возможных градаций уменьшения его исходных геометрических размеров. Здесь L - горизонтальный размер кадра, выраженный в пикселях; H - вертикальный размер кадра, выраженный в пикселях;figure 1 - the principle of representing a frame of a graphic image based on 5 possible gradations of reduction of its original geometric dimensions. Here L is the horizontal frame size, expressed in pixels; H is the vertical frame size, expressed in pixels;
фиг.2 - исходный кадр графического изображения и декомпрессированный кадр после сжатия его алгоритмом JPEG;figure 2 - the original frame of the graphic image and the decompressed frame after compression by the JPEG algorithm;
фиг.3 - увеличенный до исходного размера декомпрессированный кадр после сжатия алгоритмом JPEG его копии, геометрические размеры которой были уменьшены в 2 раза по отношению к исходному размеру, и увеличенный до исходного размера декомпрессированный кадр, после сжатия алгоритмом JPEG его копии, геометрические размеры которой были уменьшены в 3 раза по отношению к исходному размеру;figure 3 - enlarged to its original size decompressed frame after compression by the JPEG algorithm of its copy, the geometric dimensions of which were reduced by 2 times relative to the original size, and enlarged to the original size decompressed frame, after compression by the JPEG algorithm of its copy, the geometric dimensions of which were reduced by 3 times in relation to the original size;
фиг.4 - увеличенный до исходного размера декомпрессированный кадр после сжатия алгоритмом JPEG его копии, геометрические размеры которой были уменьшены в 4 раза по отношению к исходному размеру, и увеличенный до исходного размера декомпрессированный кадр после сжатия алгоритмом JPEG его копии, геометрические размеры которой были уменьшены в 5 раза по отношению к исходному размеру.figure 4 - enlarged to its original size decompressed frame after compression by the JPEG algorithm of its copy, the geometric dimensions of which were reduced by 4 times in relation to the original size, and enlarged to the original size decompressed frame after compression by the JPEG algorithm of its copy, the geometric dimensions of which were reduced 5 times in relation to the original size.
Способ сжатия графических файлов JPEG (файл JPEG - сжатый файл с расширением *.jpg (англ. Joint Photographic Experts Group, по названию организации-разработчика)) реализуется следующим образом.The method of compressing JPEG image files (JPEG file is a compressed file with the extension * .jpg (English Joint Photographic Experts Group, by the name of the developing organization)) is implemented as follows.
В конкретном примере реализации способа число градаций задано равным пяти.In a specific example of the method, the number of gradations is set to five.
1. Определяют число возможных градаций уменьшения геометрических размеров исходного кадра.1. Determine the number of possible gradations for reducing the geometric dimensions of the original frame.
Градация уменьшения геометрических размеров исходного кадра d представляет шаг деления L - горизонтального размера кадра графического изображения в пикселях и H - вертикального размера кадра графического изображения согласно формулам:The gradation of reducing the geometric dimensions of the original frame d represents the division step L - the horizontal frame size of the graphic image in pixels and H - the vertical frame size of the graphic image according to the formulas:
где Ld - горизонтальный размер кадра графического изображения в пикселях для d-й градации (на шаге градации d); Hd - вертикальный размер кадра графического изображения в пикселях для d-й градации (на шаге градации d).where L d is the horizontal frame size of the graphic image in pixels for the d-th gradation (at the gradation step d); H d is the vertical frame size of the graphic image in pixels for the d-th gradation (at the gradation step d).
Согласно формуле (1) для первой градации d=1 (на 1-м шаге градации) геометрические размеры кадра графического изображения не изменяются: L1=L и H1=H. Для второй градации d=2-L2=L/2 и H2=H/2. Для третьей градации d=3-L3=L/3 и H3=H/3 и т.д.According to formula (1) for the first gradation d = 1 (at the 1st gradation step), the geometric dimensions of the frame of the graphic image do not change: L 1 = L and H 1 = H. For the second gradation, d = 2-L 2 = L / 2 and H 2 = H / 2. For the third gradation, d = 3-L 3 = L / 3 and H 3 = H / 3, etc.
Чем ниже пропускная способность и чем меньше свободного места на носителе информации, тем большим выбирают значение градаций.The lower the throughput and the less free space on the storage medium, the higher the gradation value is selected.
В качестве примера на фиг.1 показаны геометрические размеры тестового кадра графического изображения для числа градаций d=5.As an example, figure 1 shows the geometric dimensions of the test frame of the graphic image for the number of gradations d = 5.
Реализовать процедуру уменьшения геометрических размеров кадра графического изображений для второй и последующих градаций можно при помощи ресайза, описанного в патенте РФ №2339998, 06.03,2007 г., или посредством программы «Microsoft office picture manager», которая входит в состав пакета программ «Средства Microsoft Office».The procedure for reducing the geometric dimensions of a graphic image frame for the second and subsequent gradations can be implemented using the resize described in RF patent No. 2339998, March 6, 2007, or through the Microsoft office picture manager program, which is part of the Microsoft Tools software package Office. "
2. Задают качество восстановленного и увеличенного кадра графического изображения величиной пикового отношения сигнал/шум (PSNR) к исходному кадру. С учетом того, что исходное трехцветное изображение имеет 3 компоненты - R, G, B [см. Телевидение (общий курс), Под ред. П.В.Шмакова, М.: «Связь», 1970, с.41], то итоговое выражение для PSNR будет иметь вид:2. The quality of the reconstructed and enlarged frame of the graphic image is set by the value of the peak signal-to-noise ratio (PSNR) to the original frame. Given that the original three-color image has 3 components - R, G, B [see Television (General), Ed. P.V. Shmakova, M .: "Communication", 1970, p.41], the final expression for the PSNR will be:
где L - горизонтальный размер кадра графического изображения в пикселях; H - вертикальный размер кадра графического изображения; (Yk(l, h)- l-е, h-е значение пикселя k-й компоненты исходного кадра графического изображения;where L is the horizontal frame size of the graphic image in pixels; H is the vertical frame size of the graphic image; (Y k (l, h) is the lth, hth pixel value of the kth component of the original frame of the graphic image;
- l-е, h-е значение пикселя k-й компоненты декомпрессированного после сжатия и увеличенного до исходного геометрического размера кадра; B - число битов, отводимых на точку (в зависимости от количества представляемых цветов на каждую точку отводится от 1 до 48 битов); K=3 - число компонентов R, G, B. - the lth, hth pixel value of the kth component decompressed after compression and increased to the original geometric frame size; B - the number of bits allocated to a point (depending on the number of colors presented, each point is allocated from 1 to 48 bits); K = 3 - the number of components R, G, B.
Чем меньше различий в числовых значениях пикселей между исходным кадром графического изображения и декомпрессированным после сжатия и увеличенным до исходного геометрического размера кадра, тем выше значение показателя PSNR. Следовательно, тем меньше претерпевает изменений файл после процедур уменьшения геометрических размеров и сжатия с помощью алгоритма JPEG.The smaller the differences in the numerical values of pixels between the original frame of the graphic image and decompressed after compression and enlarged to the original geometric frame size, the higher the value of the PSNR indicator. Therefore, the less the file undergoes changes after the procedures of reducing the geometric dimensions and compression using the JPEG algorithm.
В исходном состоянии кадр графического изображения хранится в графическом файле BMP (от англ. Bitmap Picture - формат хранения растровых изображений, разработанный компанией Microsoft). После сжатия - в графическом файле JPEG.In the initial state, the frame of the graphic image is stored in the BMP graphic file (from the English. Bitmap Picture - a format for storing raster images developed by Microsoft). After compression, in a JPEG image file.
Выбор заданного качества восстановленного и увеличенного кадра графического изображения PSNRдоп определяется техническими возможностями системы передачи информации или свободным объемом носителя информации. Чем ниже пропускная способность и чем меньше свободного места на носителе информации, тем ниже выбирают исходное значение показателя PSNRдоп.Selecting a given quality reconstituted and enlarged graphical image frame PSNR additional information determined by the technical capabilities of the transmission system or the free volume of medium. The lower the throughput and the less free space on the storage medium, the lower the initial value of the PSNR indicator add .
3. Уменьшают геометрические размеры исходного кадра на значение первой градации L1=L и H1=H, после чего его сжимают.3. Reduce the geometric dimensions of the original frame by the value of the first gradation L 1 = L and H 1 = H, after which it is compressed.
Для градации d=1 геометрические размеры графического кадра не меняются. При сжатии кадра графического изображения используют алгоритм сжатия с потерями JPEG. В результате получают графический файл с расширением *.jpg.For gradation d = 1, the geometric dimensions of the graphic frame do not change. When compressing a frame of a graphic image, a lossy JPEG compression algorithm is used. The result is a graphic file with the extension * .jpg.
Алгоритмы сжатия на базе алгоритма сжатия с потерями JPEG известны и описаны, например, в (Б.Скляр. Цифровая связь. Теоретические основы и практическое применение. Изд. 2-е, испр.: пер. с англ. - М.: Издательский дом «Вильямс», 2003. С.893-896).Compression algorithms based on the lossy compression algorithm JPEG are known and described, for example, in (B. Sklyar. Digital Communication. Theoretical Foundations and Practical Applications. Ed. 2-nd, rev .: English translation. - M.: Publishing House "Williams", 2003. S.893-896).
4. Декомпрессируют сжатый графический файл с расширением *.jpg и увеличивают геометрические размеры графического файла до исходного размера. Для градации d=1 геометрические размеры декомпрессированного графического кадра не увеличивают.4. Decompress the compressed graphic file with the extension * .jpg and increase the geometric dimensions of the graphic file to its original size. For gradation d = 1, the geometric dimensions of the decompressed graphic frame do not increase.
Декомпрессировать сжатый графический файл с расширением *.jpg в графический файл с расширением *.bmp можно посредством программы Paint, которая входит в пакет стандартных программ операционной системы Windows любой версии.You can decompress a compressed graphic file with the extension * .jpg to a graphic file with the extension * .bmp using the Paint program, which is included in the standard program package of the Windows operating system of any version.
Увеличить декомпрессированный файл можно при помощи ресайза, описанного в патенте РФ №2339998, 06.03.2007 г., или посредством программы «Microsoft office picture manager», которая входит в состав пакета программ «Средства Microsoft Office».You can enlarge the decompressed file using the resize described in RF patent No. 2339998, March 6, 2007, or through the Microsoft office picture manager program, which is part of the Microsoft Office Tools software package.
В качестве примера на фиг.2 представлен исходный кадр графического изображения и декомпрессированный кадр после сжатия его алгоритмом JPEG для градации d=1.As an example, figure 2 presents the original frame of the graphic image and the decompressed frame after compression by the JPEG algorithm for gradation d = 1.
5. Оценивают величину PSNR для градации d=1 и сравнивают ее с предварительно заданной величиной PSNRдоп.5. Estimate the value of PSNR for the gradation d = 1 and compare it with a predetermined value of PSNR add .
Для оценки пикового отношения сигнал/шум PSNRd для декомпрессированного и увеличенного до исходного размера кадра графического изображения (для градации d=1 геометрические размеры кадра после декомпрессии не увеличивают) применяют формулу (2).To estimate the peak signal-to-noise ratio PSNR d for the decompressed and enlarged to the original frame size graphic image (for gradation d = 1, the geometric dimensions of the frame do not increase after decompression), formula (2) is used.
Сравнивают величину PSNR1 для d=1 с величиной PSNRдоп.Compare the value of PSNR 1 for d = 1 with the value of PSNR add .
Если PSNR1>PSNRдоп, то этапы 3, 4 и 5 повторяют до тех пор, пока не будет выполнено условие PSNR1≤PSNRдоп.If PSNR 1 > PSNR add , then steps 3, 4 and 5 are repeated until the condition PSNR 1 ≤PSNR add .
Каждая последующая градация уменьшения геометрического размера исходного кадра ведет к ухудшению качества по показателю PSNR для декомпрессированного и увеличенного до исходного размера кадра.Each subsequent gradation of the reduction in the geometric size of the original frame leads to a deterioration in quality in terms of PSNR for decompressed and enlarged to the original frame size.
В качестве примера на фиг.3 и 4 показаны декомпрессированные и увеличенные до исходного размера кадры для градаций d=2, d=3, d=4, d=5.As an example, Figures 3 and 4 show decompressed and enlarged to the original size frames for gradations d = 2, d = 3, d = 4, d = 5.
В качестве итогового сжатого графического файла с расширением *.jpg выбирают файл, полученный на последней градации, если выполняется условие PSNR1=PSNRдоп. В противном случае, если выполняется условие PSNR1<PSNRдоп, в качестве итогового сжатого графического файла с расширением *.jpg выбирают файл, полученный на предыдущей градации уменьшения геометрического размера исходного кадра.As the final compressed graphic file with the extension * .jpg, the file obtained at the last gradation is selected if the condition PSNR 1 = PSNR ext . Otherwise, if the condition PSNR 1 <PSNR add is satisfied, the file obtained on the previous gradation of reducing the geometric size of the original frame is selected as the final compressed graphic file with the * .jpg extension.
В качестве примера, для тестового изображения на фиг.1 представлены оцененные величины по формуле (2) для 1, 2, 3, 4 и 5 градаций: PSNR1=36,9384 дБ, PSNR2=31,9429 дБ, PSNR3=29,4774 дБ, PSNR4=27,8353 дБ, PSNR5=26,7854 дБ.As an example, for the test image, Fig. 1 shows the estimated values according to formula (2) for 1, 2, 3, 4, and 5 gradations: PSNR 1 = 36.9384 dB, PSNR 2 = 31.9429 dB, PSNR 3 = 29.4774 dB, PSNR 4 = 27.8353 dB, PSNR 5 = 26.7854 dB.
Объем исходного файла BMP кадра графического изображения составлял 921654 байт. Объемы сжатых файлов JPEG для 1, 2, 3, 4 и 5 градации соответственно 43943 байта, 13071 байт, 7026 байт, 4589 байт, 3331 байт.The volume of the source file BMP frame of the graphic image was 921654 bytes. The volume of compressed JPEG files for gradations 1, 2, 3, 4, and 5, respectively, is 43,943 bytes, 13,071 bytes, 7026 bytes, 4589 bytes, 3331 bytes.
Таким образом, благодаря новой совокупности существенных признаков, заключающихся в том, что определяют число возможных градаций уменьшения геометрических размеров исходного кадра, среди которых находят такую, при которой PSNR сжатого, а потом декомпрессированного и увеличенного до исходного размера кадра графического изображения к исходному кадру не превысит предварительно заданного PSNR, обеспечивается максимально возможная степень сжатия.Thus, thanks to a new set of essential features, which determine the number of possible gradations for reducing the geometric dimensions of the original frame, among which are those in which the PSNR of the compressed and then decompressed and enlarged to the original frame size graphic image to the original frame does not exceed predefined PSNR, provides the highest possible compression ratio.
Claims (1)
Publications (1)
Publication Number | Publication Date |
---|---|
RU2485591C1 true RU2485591C1 (en) | 2013-06-20 |
Family
ID=
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102523367B (en) | Real time imaging based on many palettes compresses and method of reducing | |
US10839564B2 (en) | Leveraging JPEG discrete cosine transform coefficients in neural networks | |
US8660347B2 (en) | Image processing apparatus and processing method therefor | |
US9891875B2 (en) | Host device for transmitting print data to printer and method of rendering print data via host device | |
US7554557B2 (en) | Device and method for image compression and decompression | |
US20020061140A1 (en) | Image processing apparatus and method, program and storage medium | |
US20070139675A1 (en) | Image processing apparatus, image processing method, image processing program, storage medium and computer data signal | |
US20050286778A1 (en) | Compression unit, decompression unit for image data and programs for compressing and decompressing image data | |
JP3461309B2 (en) | Huffman coded data compression device | |
US20010012397A1 (en) | Image processing apparatus and method | |
KR20070036991A (en) | System and method for image forming | |
EP3180910B1 (en) | Method for optimized chroma subsampling, apparatus for optimized chroma subsampling and storage device | |
EP2869575B1 (en) | Adaptive inter-channel transform for wavelet color image compression | |
US8600181B2 (en) | Method for compressing images and a format for compressed images | |
US8428381B2 (en) | Image compression method with variable quantization parameter | |
RU2485591C1 (en) | Method of compressing graphics files | |
US6829385B2 (en) | Apparatus and method for processing images, and a computer-readable medium | |
US7146058B2 (en) | Compression of images using object maps | |
JP2001145107A (en) | Signal processor using dct and image-compressing device | |
JP5757904B2 (en) | Image compression device | |
EP2958327A1 (en) | Method and device for encoding a sequence of pictures | |
RU2498407C1 (en) | Method of compressing graphics files | |
JP6033461B2 (en) | Image compression / decompression apparatus and image forming apparatus | |
JP5557792B2 (en) | Image processing apparatus and image forming apparatus | |
JP4209174B2 (en) | Color image processing apparatus and method |