CN110191345B - Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding - Google Patents
Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding Download PDFInfo
- Publication number
- CN110191345B CN110191345B CN201910304947.4A CN201910304947A CN110191345B CN 110191345 B CN110191345 B CN 110191345B CN 201910304947 A CN201910304947 A CN 201910304947A CN 110191345 B CN110191345 B CN 110191345B
- Authority
- CN
- China
- Prior art keywords
- picture
- component
- base
- foreground
- background
- 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
Links
- 238000007906 compression Methods 0.000 title claims abstract description 49
- 230000006835 compression Effects 0.000 title claims abstract description 48
- 238000000926 separation method Methods 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 title claims abstract description 14
- 238000007689 inspection Methods 0.000 claims description 13
- 238000003491 array Methods 0.000 claims description 10
- 238000012545 processing Methods 0.000 claims description 5
- 230000014509 gene expression Effects 0.000 claims description 2
- 239000011159 matrix material Substances 0.000 claims description 2
- 238000005516 engineering process Methods 0.000 abstract description 6
- 230000000694 effects Effects 0.000 abstract description 4
- 230000002354 daily effect Effects 0.000 description 4
- 230000006837 decompression Effects 0.000 description 2
- 230000003203 everyday effect Effects 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000007418 data mining Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012800 visualization Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/182—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/20—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding
- H04N19/23—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding with coding of regions that are present throughout a whole video segment, e.g. sprites, background or mosaic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/42—Methods 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
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本发明公开了一种基于霍夫曼编码的前景、背景分离的图片增量式无损压缩方法。本发明通过采集装置拍摄在同一场景下的目标物体的批量图片组,采用基于霍夫曼编码的无损压缩技术,将同一场景下拍摄的大量图片进行作差式增量压缩,并通过前景、背景分离的方式使差值分布更加集中,以获得尽可能短的编码长度,获得最佳的无损压缩效果,减小存储空间的占用,并且可实现迅速解码还原图片,以供图片后续上层使用,对于新增的图片,也可以根据阈值及作差基底信息实现上述功能,具有较大的应用价值及经济意义。
The invention discloses a picture incremental lossless compression method based on Huffman coding separation of foreground and background. The invention uses the collection device to capture batch pictures of target objects in the same scene, adopts the lossless compression technology based on Huffman coding, and performs differential incremental compression on a large number of pictures captured in the same scene, and passes the foreground and background. The separation method makes the difference distribution more concentrated, so as to obtain the shortest possible coding length, obtain the best lossless compression effect, reduce the occupation of storage space, and can quickly decode and restore the picture for the subsequent upper layer use of the picture. The newly added pictures can also realize the above functions according to the threshold and the difference base information, which has great application value and economic significance.
Description
技术领域technical field
本发明属于图像压缩领域,涉及一种基于霍夫曼编码的增量式无损压缩方法。The invention belongs to the field of image compression, and relates to an incremental lossless compression method based on Huffman coding.
背景技术Background technique
为满足电网设备日常运营检查需要,国家电网某供电局变电站启用了智能巡检机器人,对电网的搭接面以及仪表进行日常拍照,提高运维效率。巡检机器人在工作场景中沿着既定路径对变电站关键设备以及搭接面进行巡检拍照,识别相关仪表的读数以及搭接面温度等信息。但是,机器人日常海量数据,包括可见光照片、红外照片、红外数据三大类,图片格式主要有jpg、bmp、png等且机器人所产生数据皆为本地普通PC存储。海量数据为供电站运维的数据挖掘提供了基础,但数据的大规模、异构、多源特性也给数据的存储以及使用带来了巨大的挑战,因此需要对海量图片进行有效压缩以减轻存储压力,同时需要实现无损解压缩以不丢失信息,为后续使用提供支持。In order to meet the daily operation inspection needs of power grid equipment, a substation of a power supply bureau of the State Grid has launched an intelligent inspection robot to take daily photos of the overlapping surfaces and instruments of the power grid to improve the efficiency of operation and maintenance. In the working scene, the inspection robot takes pictures of the key equipment of the substation and the overlapping surface along the established path, and identifies the readings of the relevant instruments and the temperature of the overlapping surface. However, the daily massive data of the robot includes three categories of visible light photos, infrared photos, and infrared data. The main image formats are jpg, bmp, png, etc., and the data generated by the robot are all stored in local ordinary PCs. Mass data provides the basis for data mining of power station operation and maintenance, but the large-scale, heterogeneous, and multi-source characteristics of data also bring huge challenges to data storage and use. Therefore, it is necessary to effectively compress massive images to reduce Storage pressure, and at the same time need to achieve lossless decompression so as not to lose information, to provide support for subsequent use.
霍夫曼编码是一种应用广泛的无损压缩方法,它以字符出现概率来构造异字头的平均长度最短的码字以实现使全部字符编码长度最短的目的,可以有效减小数据的存储空间,使用的限制条件较少,具有极强的通用性,易于通过编程实现。Huffman coding is a widely used lossless compression method. It uses the probability of occurrence of characters to construct codewords with the shortest average length of different prefixes to achieve the purpose of shortest encoding length of all characters, which can effectively reduce the storage space of data. , has fewer restrictions, has strong versatility, and is easy to implement through programming.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于针对电网变电站的智能巡检机器人产生的海量图片,造成存储压力且不方便使用的问题,采用基于霍夫曼编码的无损压缩技术,将同一场景下拍摄的大量图片进行作差式增量压缩,并通过前景、背景分离的方式是使差值分布更加集中,以获得尽可能短的编码长度,获得最佳的无损压缩效果,减小存储空间的占用,并且可实现迅速解码还原图片,以供图片后续上层使用,对于新增的图片,也可以根据阈值及作差基底信息实现上述功能,具有较大的应用价值及经济意义。The purpose of the present invention is to deal with the problem of storage pressure and inconvenience caused by the massive pictures generated by the intelligent inspection robot of the power grid substation, adopting the lossless compression technology based on Huffman coding, to make a difference between a large number of pictures taken in the same scene It can achieve the shortest possible encoding length, obtain the best lossless compression effect, reduce the storage space occupation, and realize rapid decoding. The image is restored for the subsequent use of the upper layer of the image. For the newly added image, the above functions can also be implemented according to the threshold and the difference base information, which has great application value and economic significance.
本发明的目的是通过以下技术方案来实现的:一种基于霍夫曼编码的前景、背景分离的图片增量式无损压缩方法,该方法包括以下步骤:The object of the present invention is achieved by the following technical solutions: a picture incremental lossless compression method based on the separation of foreground and background of Huffman coding, the method comprises the following steps:
(1)通过采集装置拍摄在同一场景下的目标物体的批量图片组X,并以数组的形式存储,表示为:(1) The batch image group X of the target object in the same scene is captured by the acquisition device, and stored in the form of an array, which is expressed as:
其中,Xj为第j张图片的三维矩阵数组存储形式,m为采集装置在同一场景下拍摄的图片总数;Wherein, X j is the three-dimensional matrix array storage form of the jth picture, and m is the total number of pictures taken by the acquisition device in the same scene;
将m张图片的存储空间S记为:Denote the storage space S of m pictures as:
其中,Sj为第j张图片压缩前的存储空间;Among them, S j is the storage space before the jth picture is compressed;
(2)在进行图片的压缩处理时,按图片的R,G,B三个分量将原始图片分为三个维度分别进行处理,并分开存储为Xr,Xg,Xb三个数组,表示为:(2) When compressing the picture, divide the original picture into three dimensions according to the R, G and B components of the picture for processing, and store them separately as three arrays of X r , X g , and X b , Expressed as:
其中,Xrj为第j张图片R分量存储的数组,Xgj为第j张图片G分量存储的数组,Xbj为第j张图片B分量存储的数组;Wherein, X rj is the array stored in the R component of the jth picture, X gj is the array stored in the G component of the jth picture, and X bj is the array stored in the B component of the jth picture;
(3)在同一场景中拍摄的图片组中任取Q张图片,取Q张图片同一像素点位置像素值的平均值,作为基底图片该像素点位置的像素值,得到基底图片,之后将该场景下所有图片的R,G,B分量分别与基底R,G,B分量进行作差,得到差值数组ΔXr,ΔXg,ΔXb,可分别表示为:(3) arbitrarily take Q pictures from the picture group taken in the same scene, take the average value of the pixel values at the same pixel position of the Q pictures, and use it as the pixel value of the pixel position of the base picture to obtain the base picture, and then use the The R, G, B components of all the pictures in the scene are differentiated with the base R, G, B components, respectively, to obtain the difference arrays ΔX r , ΔX g , ΔX b , which can be expressed as:
其中,ΔXri为第i张图片R分量与基底R分量的差值数组;ΔXgi为第i张图片G分量与基底G分量的差值数组;ΔXbi为第i张图片B分量与基底B分量的差值数组;Among them, ΔX ri is the difference array between the R component of the ith picture and the base R component; ΔX gi is the difference array of the G component of the ith picture and the base G component; ΔX bi is the ith picture B component and the base B array of differences of components;
(4)取迭代次数k=0,根据差值数组数值的分布范围确定前景背景分离的阈值分布区间[εmin,εmax],选取前景背景分离的初始阈值εk=εmin(例如在10-200区间选取初始阈值εk=10);根据阈值εk,像素差值大于等于εk的部分存储为前景部分,小于εk的部分存储为背景部分,由此将图片数组划分为前景与背景两部分,分开进行存储,并分别记为ΔXrq,ΔXrb,ΔXgq,ΔXgb,ΔXbq,ΔXbb,表示为:(4) Take the number of iterations k = 0, determine the threshold distribution interval [ε min , ε max ] of the foreground and background separation according to the distribution range of the difference array values, and select the initial threshold of the foreground and background separation ε k = ε min (for example, in 10 The initial threshold ε k = 10) is selected in the -200 interval; according to the threshold ε k , the part with pixel difference greater than or equal to ε k is stored as the foreground part, and the part less than ε k is stored as the background part, so that the picture array is divided into foreground and The two parts of the background are stored separately and recorded as ΔX rq , ΔX rb , ΔX gq , ΔX gb , ΔX bq , ΔX bb , which are expressed as:
ΔXrq=[ΔXrq1,ΔXrq2,...,ΔXrqm]T ΔX rq =[ΔX rq1 ,ΔX rq2 ,...,ΔX rqm ] T
ΔXrb=[ΔXrb1,ΔXrb2,...,ΔXrbm]T ΔX rb =[ΔX rb1 ,ΔX rb2 ,...,ΔX rbm ] T
ΔXgq=[ΔXgq1,ΔXgq2,...,ΔXgqm]T ΔX gq =[ΔX gq1 ,ΔX gq2 ,...,ΔX gqm ] T
ΔXgb=[ΔXgb1,ΔXgb2,...,ΔXgbm]T ΔX gb =[ΔX gb1 ,ΔX gb2 ,...,ΔX gbm ] T
ΔXbq=[ΔXbq1,ΔXbq2,...,ΔXbqm]T ΔX bq =[ΔX bq1 ,ΔX bq2 ,...,ΔX bqm ] T
ΔXbb=[ΔXbb1,ΔXbb2,...,ΔXbbm]T ΔX bb =[ΔX bb1 ,ΔX bb2 ,...,ΔX bbm ] T
其中,ΔXrqi为第i张图片前景红色分量与基底红色分量的差值数组;ΔXrbi为第i张图片背景红色分量与基底红色分量的差值数组;ΔXgqi为第i张图片前景绿色分量与基底绿色分量的差值数组;ΔXgbi为第i张图片背景绿色分量与基底绿色分量的差值数组;ΔXbqi为第i张图片前景蓝色分量与基底蓝色分量的差值数组;ΔXbbi为第i张图片背景蓝色分量与基底蓝色分量的差值数组;Among them, ΔX rqi is the difference array between the foreground red component and the base red component of the ith picture; ΔX rbi is the difference array of the background red component and the base red component of the ith picture; ΔX gqi is the foreground green component of the ith picture Difference array with the base green component; ΔX gbi is the difference array between the background green component and base green component of the ith picture; ΔX bqi is the difference array between the foreground blue component and the base blue component of the ith picture; ΔX bbi is the difference array between the background blue component and the base blue component of the ith picture;
(5)获取以上分布较集中的R,G,B差值数组后,采用经典霍夫曼编码对ΔXrqi,ΔXrbi,ΔXgqi,ΔXgbi,ΔXbqi,ΔXbbi进行无损压缩存储,得到平均编码长度表示为:(5) After obtaining the above R, G, B difference arrays with relatively concentrated distribution, use classical Huffman coding to compress and store ΔX rqi , ΔX rbi , ΔX gqi , ΔX gbi , ΔX bqi , ΔX bbi losslessly, and obtain the average Code length Expressed as:
其中,为第i张图片前景红色分量与基底红色分量的差值数组的平均编码长度,张图片前景红色分量与基底红色分量的差值数组第a个像素点的编码长度,nrqi为第i张图片前景红色分量与基底红色分量的差值数组像素点的个数,其他符号含义可以此类推,为避免赘述,此处不再详细说明;in, is the average encoding length of the difference array between the foreground red component and the base red component of the ith picture, The coding length of the a-th pixel of the difference array between the foreground red component and the base red component of the picture, n rqi is the number of pixels in the difference array between the foreground red component and the base red component of the ith picture, and the meanings of other symbols can be And so on, in order to avoid redundant description, it will not be described in detail here;
(6)获得前景和背景的R,G,B三个维度平均编码长度后,计算第i张图片R,G,B三个分量的无损压缩比Cri,Cgi,Cbi,表达式如下:(6) After obtaining the average coding length of the three dimensions of R, G and B of the foreground and background, calculate the lossless compression ratios C ri , C gi , C bi of the three components of R, G and B of the i-th picture, and the expressions are as follows :
其中,nri为第i张图片R分量像素点总数;ngi为第i张图片G分量像素点总数;nbi为第i张图片B分量像素点总数,且nri=ngi=nbi=ni/3,均等于第i张图片像素点总数ni的1/3。Wherein, n ri is the total number of R component pixels of the ith picture; n gi is the total number of G component pixels of the ith picture; n bi is the total number of B component pixels of the ith picture, and n ri =n gi =n bi =n i /3, which are equal to 1/3 of the total number of pixels n i in the i-th picture.
(7)第i张图片的无损压缩比为Ci,可表示为:(7) The lossless compression ratio of the ith picture is C i , which can be expressed as:
当待压缩图片总数为n时,总无损压缩比C0为:When the total number of pictures to be compressed is n, the total lossless compression ratio C 0 is:
(8)当εk=εmax时,进入步骤(9);当εk<εmax时,k=k+1,εk=εk-1+Δε,Δε为阈值步长(可选择取10),重复步骤(4)至步骤(7),得出新的总无损压缩比Ck;(8) When ε k =ε max , go to step (9); when ε k <ε max , k=k+1, ε k =ε k-1 +Δε, Δε is the threshold step size (optional 10), repeat step (4) to step (7), obtain new total lossless compression ratio C k ;
(9)选择总无损压缩比最小时对应的阈值作为该场景下图片压缩的最终阈值进行批量图片的无损压缩处理;图片i经无损压缩之后,以三个维度前景、背景的像素点差值存储为六组霍夫曼编码;(9) Select the threshold corresponding to the minimum total lossless compression ratio as the final threshold for picture compression in this scene to perform lossless compression processing of batch pictures; after picture i is lossless compressed, it is stored with the pixel point difference value of the foreground and background in three dimensions Code for six groups of Huffman;
(10)对图片i进行还原时,将各维度前景、背景编码还原为压缩前像素点,再与基底像素点求和后,将三个维度一并显示出来即可得到无损压缩前的原始图片,依此原理,可实现批量已压缩图片的无损还原,以支持后续上层使用。(10) When restoring picture i, restore the foreground and background codes of each dimension to the pixels before compression, and then sum with the base pixels, and display the three dimensions together to obtain the original picture before lossless compression , according to this principle, the lossless restoration of batches of compressed pictures can be achieved to support subsequent upper-layer use.
进一步地,该方法应用于某变电站智能巡检机器人在同一场景下沿固定路线定点拍摄目标物体的批量图片组,并对图片进行压缩。由于巡检机器人沿固定路线进行定点拍摄的图片,拍摄背景(天空等)与拍摄前景(电线杆等)两部分区别明显,使其根据阈值进行分离后,差值分布较分离前更为集中。Further, the method is applied to a substation intelligent inspection robot in the same scene to shoot a batch of pictures of the target object at fixed points along a fixed route, and compress the pictures. Because the inspection robot takes pictures at fixed points along a fixed route, the background (sky, etc.) and the foreground (telephone poles, etc.) are obviously different, so that after separation according to the threshold, the difference distribution is more concentrated than before separation.
本发明的有益效果是:本发明采用基于霍夫曼编码的无损压缩技术,将同一场景下拍摄的大量图片进行作差式增量压缩,并通过前景、背景分离的方式是使差值分布更加集中,以获得尽可能短的编码长度,获得最佳的无损压缩效果,减小存储空间的占用,并且可实现迅速解码还原图片,以供图片后续上层使用,对于新增的图片,也可以根据阈值及作差基底信息实现上述功能,具有较大的应用价值及经济意义。The beneficial effects of the present invention are: the present invention adopts the lossless compression technology based on Huffman coding, performs differential incremental compression on a large number of pictures taken in the same scene, and separates the foreground and the background to make the difference distribution more centralized to obtain the shortest encoding length as possible, obtain the best lossless compression effect, reduce the storage space occupation, and can quickly decode and restore the picture for the subsequent upper layer of the picture. The threshold value and the difference base information realize the above functions, and have great application value and economic significance.
附图说明Description of drawings
图1是本发明基于霍夫曼编码的前景、背景分离的增量式无损压缩方法的流程图;Fig. 1 is the flow chart of the incremental lossless compression method of the present invention based on Huffman coding foreground, background separation;
图2是某图片R分量差值数组可视化图片;Figure 2 is a visual picture of the R component difference array of a certain picture;
图3是经阈值进行前景、背景分离的差值数组可视化图片。Figure 3 is a visual image of the difference array with the foreground and background separated by thresholding.
具体实施方式Detailed ways
下面结合附图和具体实施例对本发明作进一步描述。以下实例仅用于更加清楚地说明本发明的技术方案,而不能以此来限制本发明的保护范围。The present invention will be further described below with reference to the accompanying drawings and specific embodiments. The following examples are only used to illustrate the technical solutions of the present invention more clearly, and cannot be used to limit the protection scope of the present invention.
为满足智能运检的需要,电力公司在日常变电运行中不断加大对巡检机器人的投入,从一定程度上替代了人工巡检。机器人巡检每日产生海量图片,目前采用的存储技术难以应对大规模的图片增量,因此今后需要投入大量资金用以扩建数据、图片等资源的储存设备。获取同一场景下的图片研究发现,拍摄背景基本相同,拍摄前景差异相对较大,通过提取共同背景(即基底图像),并且从每个像素上将图片与共同背景求差值,差值分块明显,因此本发明根据巡检机器人每天沿固定路线,定点拍照使同一场景下拍摄内容相似度较高的特点,采用一种基于霍夫曼编码的前景、背景分离的无损增量式图片压缩技术,减少海量图片的存储压力,实现无损压缩图像数据的统一储存管理,为今后大规模应用机器人数据提供压缩存储、快速检索和传输以及智能分析提供支撑。In order to meet the needs of intelligent inspection, power companies continue to increase investment in inspection robots in daily substation operations, replacing manual inspections to a certain extent. Robot inspections generate a large number of pictures every day, and the current storage technology cannot cope with large-scale picture increments. Therefore, a lot of money will be needed to expand storage equipment for data, pictures and other resources in the future. The research of obtaining pictures in the same scene found that the shooting background is basically the same, and the shooting foreground is relatively different. By extracting the common background (ie, the base image), and from each pixel, the difference between the picture and the common background is calculated, and the difference is divided into blocks Obviously, the present invention adopts a lossless incremental image compression technology based on Huffman coding based on the separation of foreground and background according to the feature that the inspection robot takes pictures at fixed points along a fixed route every day, so that the similarity of the shooting content in the same scene is high. , reduce the storage pressure of massive pictures, realize the unified storage management of lossless compressed image data, and provide support for compressed storage, rapid retrieval and transmission, and intelligent analysis of large-scale application of robot data in the future.
本发明提出的一种基于霍夫曼编码的前景、背景分离的增量式无损压缩方法,可用于对一类具有共同背景的图片实现压缩,如图1所示,包括以下步骤:An incremental lossless compression method based on Huffman coding for the separation of foreground and background proposed by the present invention can be used to compress a class of pictures with a common background, as shown in FIG. 1 , including the following steps:
(1)本实例中以温州电网某变电站为例,选取机器人巡检塔接线拍摄场景下一个月内拍摄的.bmp格式图片(大小均为240*320)进行无损压缩处理,使用MATLAB读取图片后,以一张.bmp图片为例,得到240*320*3的三维数组:(1) In this example, a substation in Wenzhou Power Grid is taken as an example, and the .bmp format pictures (both 240*320 in size) taken within one month of the robot inspection tower wiring shooting scene are selected for lossless compression processing, and MATLAB is used to read the pictures Then, take a .bmp image as an example to get a three-dimensional array of 240*320*3:
(2)在进行压缩处理时,将原始图片分为R,G,B,三个维度分别进行处理,并分开存储为Xr,Xg,Xb三个数组,可分别得到大小为240*320的三个数组:(2) During the compression process, the original image is divided into three dimensions of R, G, B, and processed separately, and stored separately as three arrays of X r , X g , and X b , which can be respectively obtained with a size of 240* Three arrays of 320:
(3)以采集10张图片为例,将10张图片的压缩前的存储空间S记为(单位:bit):(3) Taking the collection of 10 pictures as an example, record the storage space S of the 10 pictures before compression as (unit: bit):
(4)从同一场景的拍摄图片中任取20张图片,并取其各像素点平均值作为基底,并将该场景下其他图片的R,G,B分量分别与基底R,G,B分量进行作差,得到差值数组ΔXr,ΔXg,ΔXb,以一张待压缩图片为例,其ΔXr可视化如下图2所示:(4) Take any 20 pictures from the shooting pictures of the same scene, and take the average value of each pixel point as the base, and compare the R, G, B components of other pictures in this scene with the base R, G, B components respectively. Make a difference to get the difference arrays ΔX r , ΔX g , ΔX b , take a picture to be compressed as an example, the visualization of ΔX r is shown in Figure 2 below:
(5)根据差值数组的数值分布情况,以10为步长,在0-200间选取并确定最佳阈值,使压缩比最小,并将前景与背景的差值分开存储,并分别记为ΔXrq,ΔXrb,ΔXgqΔXgb,ΔXbq,ΔXbb,此处阈值取50,以一张待压缩图片为例,其前景、背景经过分离的ΔXrq,ΔXrb可视化如下图3所示。(5) According to the numerical distribution of the difference array, take 10 as the step, select and determine the optimal threshold between 0 and 200, so as to minimize the compression ratio, and store the difference between the foreground and the background separately, and record them as ΔX rq , ΔX rb , ΔX gq ΔX gb , ΔX bq , ΔX bb , the threshold here is 50, taking a picture to be compressed as an example, the foreground and background of which are separated ΔX rq , ΔX rb are visualized as shown in Figure 3 below .
(6)获取以上分布较集中的R,G,B差值数组后,采用经典霍夫曼编码对ΔXrqi,ΔXrbi,ΔXgqi,ΔXgbi,ΔXbqi,ΔXbbi进行无损压缩存储,可得平均编码长度其中一张待压缩图片的各平均编码长度如下表1所示:(6) After obtaining the above R, G, B difference arrays with relatively concentrated distribution, use classical Huffman coding to perform lossless compression and storage on ΔX rqi , ΔX rbi , ΔX gqi , ΔX gbi , ΔX bqi , ΔX bbi , we can get average code length The average encoding length of one of the pictures to be compressed is shown in Table 1 below:
表1Table 1
(7)获得前景和背景的R,G,B三个维度平均编码长度后,计算第i张图片R,G,B三个分量的无损压缩比Cri,Cgi,Cbi,以其中一张待压缩图片为例,其R,G,B分量的压缩比如下表2所示:(7) After obtaining the average coding length of the three dimensions of R, G, and B of the foreground and background, calculate the lossless compression ratios C ri , C gi , and C bi of the three components of R, G, and B of the ith picture, and use one of them Taking a picture to be compressed as an example, the compression ratio of its R, G, and B components is shown in Table 2 below:
表2Table 2
(8)则该张图片的无损压缩比为C为:(8) The lossless compression ratio of the picture is C:
当待压缩图片总数为n=10时,总无损压缩比C为:When the total number of pictures to be compressed is n=10, the total lossless compression ratio C is:
(9)根据对应的解码技术,再将待解压图片与基底求和后,可实现解压,即实现批量压缩图片的快速无损还原,以支持后续上层使用。(9) According to the corresponding decoding technology, after summing the to-be-decompressed picture and the base, decompression can be realized, that is, fast and lossless restoration of batch compressed pictures can be realized to support subsequent upper-layer use.
本发明方法在温州电网公司提供的非公开大规模测试集经过测试后,压缩比根据基底图像与分离阈值选取的不同,无损压缩比的范围分布在闭区间[0.1764,0.1985],压缩效果显著,可有效节省存储空间,具有较大的经济意义与应用价值。After the method of the invention is tested on the non-public large-scale test set provided by Wenzhou Power Grid Corporation, the compression ratio is selected according to the base image and the separation threshold, and the range of the lossless compression ratio is distributed in the closed interval [0.1764, 0.1985], and the compression effect is remarkable. It can effectively save storage space and has great economic significance and application value.
上述实施例用来解释说明本发明,而不是对本发明进行限制,在本发明的精神和权利要求的保护范围内,对本发明作出的任何修改和改变,都落入本发明的保护范围。The above-mentioned embodiments are used to explain the present invention, rather than limit the present invention. Within the spirit of the present invention and the protection scope of the claims, any modifications and changes made to the present invention all fall into the protection scope of the present invention.
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910304947.4A CN110191345B (en) | 2019-04-16 | 2019-04-16 | Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910304947.4A CN110191345B (en) | 2019-04-16 | 2019-04-16 | Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110191345A CN110191345A (en) | 2019-08-30 |
CN110191345B true CN110191345B (en) | 2020-07-03 |
Family
ID=67714591
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910304947.4A Active CN110191345B (en) | 2019-04-16 | 2019-04-16 | Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110191345B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113784142A (en) * | 2021-09-10 | 2021-12-10 | 河南启迪睿视智能科技有限公司 | Method for lossless compression of tobacco leaf pictures |
CN116582889B (en) * | 2023-07-14 | 2023-11-21 | 武汉能钠智能装备技术股份有限公司四川省成都市分公司 | High-throughput data transmission and storage method, electronic equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105554502A (en) * | 2015-12-07 | 2016-05-04 | 天津大学 | Distributed compressed sensing video encoding and decoding method based on foreground-background separation |
CN108419086A (en) * | 2018-05-08 | 2018-08-17 | 北京理工大学 | A Method of Image Compression Based on Huffman Coding |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016033463A1 (en) * | 2014-08-29 | 2016-03-03 | The University Of North Carolina At Chapel Hill | Methods, systems, and computer readable media for compressing video images |
-
2019
- 2019-04-16 CN CN201910304947.4A patent/CN110191345B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105554502A (en) * | 2015-12-07 | 2016-05-04 | 天津大学 | Distributed compressed sensing video encoding and decoding method based on foreground-background separation |
CN108419086A (en) * | 2018-05-08 | 2018-08-17 | 北京理工大学 | A Method of Image Compression Based on Huffman Coding |
Non-Patent Citations (2)
Title |
---|
A foreground-background separation algorithm for image compression;Patrice Y. Simard 等;《Proceedings of the Data Compression Conference》;20041231;全文 * |
红外小目标图像实时压缩传输系统的研究;张锦龙;《中国优秀硕士学位论文全文数据库》;20170515;全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN110191345A (en) | 2019-08-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103209326B (en) | PNG (Portable Network Graphic) image compression method | |
CN106897295B (en) | Hadoop-based power transmission line monitoring video distributed retrieval method | |
CN107480203A (en) | It is a kind of to be directed to identical and similar pictures duplicate removal view data cleaning method | |
CN110191345B (en) | Incremental Lossless Compression Method for Separation of Foreground and Background Based on Huffman Coding | |
CN103152430B (en) | A kind of reduce the cloud storage method that data take up room | |
CN110162290B (en) | Compression method for DeMURA data of OLED screen | |
CN106530207A (en) | Logistic chaotic mapping-based digital image encryption method | |
WO2019047628A1 (en) | Massive picture processing method, device, electronic apparatus and storage medium | |
CN105554502A (en) | Distributed compressed sensing video encoding and decoding method based on foreground-background separation | |
CN109166160A (en) | A kind of three-dimensional point cloud compression method predicted using figure | |
EP2787647A1 (en) | Tile-based compression and decompression for graphic applications | |
CN115984330A (en) | Boundary-aware target tracking model and target tracking method | |
Li et al. | Coverless Video Steganography Based on Frame Sequence Perceptual Distance Mapping. | |
CN110222011B (en) | A kind of human motion data file compression method | |
CN111787321A (en) | Image compression and decompression method and system for edge end based on deep learning | |
CN110083743B (en) | Rapid similar data detection method based on unified sampling | |
CN104133883B (en) | Telephone number ownership place data compression method | |
CN109697693B (en) | A method to realize spatial operation based on big data | |
WO2021082926A1 (en) | Data compression method and apparatus | |
CN112052228A (en) | Binary coding method based on mutual mapping between standard Euclidean space and plane space projection | |
CN101848388B (en) | Method for normalizing arithmetic encoding value based on JPEG (Joint Photographic Experts Group) 2000 standard | |
CN105072444B (en) | A kind of HEVC video second-compressed detection methods under different quantization parameters | |
CN115797178B (en) | Video super-resolution method based on 3D convolution | |
Li et al. | Erasing-based lossless compression method for streaming floating-point time series | |
CN110021349A (en) | The coding method of gene data |
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 |