CN111986280B - Image compression method based on maximum inter-class variance block compressed sensing - Google Patents

Image compression method based on maximum inter-class variance block compressed sensing Download PDF

Info

Publication number
CN111986280B
CN111986280B CN202010710462.8A CN202010710462A CN111986280B CN 111986280 B CN111986280 B CN 111986280B CN 202010710462 A CN202010710462 A CN 202010710462A CN 111986280 B CN111986280 B CN 111986280B
Authority
CN
China
Prior art keywords
image
area
gray
block
value
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
CN202010710462.8A
Other languages
Chinese (zh)
Other versions
CN111986280A (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.)
Guangxi Communications Design Group Co Ltd
Original Assignee
Guangxi Communications Design Group Co Ltd
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 Guangxi Communications Design Group Co Ltd filed Critical Guangxi Communications Design Group Co Ltd
Priority to CN202010710462.8A priority Critical patent/CN111986280B/en
Publication of CN111986280A publication Critical patent/CN111986280A/en
Application granted granted Critical
Publication of CN111986280B publication Critical patent/CN111986280B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/136Segmentation; Edge detection involving thresholding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/168Segmentation; Edge detection involving transform domain methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/194Segmentation; Edge detection involving foreground-background segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20048Transform domain processing
    • G06T2207/20052Discrete cosine transform [DCT]

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses an image compression method based on maximum inter-class variance block compression sensing, which comprises the steps of 1, image blocking; step 2, image sub-block partitioning: dividing each image sub-block into a foreground key area, a background area and a transition area equally by adopting a maximum between-class variance OSTU algorithm; step 3, determining an optimal sampling rate: determining the optimal sampling rate of each area by controlling a variable method and a least square method; and 4, reconstructing the image. In the image compression process, the compressed sensing method is used for sampling, so that the limit of the Nyquist sampling rate can be broken through, and the image signal is sampled at the sampling rate far less than the Nyquist sampling rate. When the image is sampled, an important area and a background area in the image can be distinguished, a relatively important area adopts a high sampling rate, and a relatively unimportant area adopts a low sampling rate, so that the image can be efficiently sampled and then compressed.

Description

Image compression method based on maximum inter-class variance block compressed sensing
Technical Field
The invention relates to the field of traffic image processing, in particular to an image compression method based on maximum inter-class variance and block compression sensing.
Background
The compressed sensing theory utilizes a non-adaptive linear projection mode to ensure the structure of an original signal, and samples and compresses the original signal at a sampling frequency far less than Nyquist.
The image compression is carried out by using a traditional compressed sensing algorithm, wherein the sampling rate is selected based on the global pixels, and the global sampling rate is obtained. This may cause the global sampling rate to be affected by the image characteristics of some special image areas, and the global sampling rate does not exhibit a good effect in other areas of the image and does not have a good robustness.
For traffic images at toll stations, there is a similar background, however, only the area of the front vehicle is a valuable area. If the entire traffic image is compressed using the global sampling rate, a cost increase is incurred. The larger the sampling rate, the larger the processing time, and some unimportant regions in the image do not need to use that large sampling rate, and some important regions should use a larger sampling rate. If the global images all use a uniform sampling rate, important areas and unimportant areas cannot be considered, and if one side is taken care of, the other side is lost, so that the method is not flexible. Cost savings and better compression value can be achieved if higher sampling rates can be used depending on the image content (complex and important areas, flat unimportant areas with lower sampling rates).
Disclosure of Invention
The technical problem to be solved by the present invention is to provide an image compression method based on maximum inter-class variance block compressed sensing, which uses a compressed sensing method to sample in the image compression process, and can break through the limit of nyquist sampling rate and sample the image signal at a sampling rate much less than the nyquist sampling rate. When the image is sampled, an important area and a background area in the image can be distinguished, a relatively important area adopts a high sampling rate, and a relatively unimportant area adopts a low sampling rate, so that the image can be efficiently sampled and then compressed.
In order to solve the technical problems, the invention adopts the technical scheme that:
an image compression method based on the block compressed sensing of the maximum between-class variance comprises the following steps.
Step 1, image blocking: and (3) carrying out image blocking on the original image of the traffic toll station by using the gray mean square difference value of the pixels between columns and the pixels between lines as a comparison standard to form a plurality of image sub-blocks.
Step 2, image sub-block partitioning: and calculating the optimal pixel gray segmentation threshold value K for each image sub-block by adopting a maximum between-class variance OSTU algorithm. And then dividing the threshold value K according to the optimal pixel gray scale, and equally dividing each image sub-block into a foreground key area, a background area and a transition area by combining a sobel algorithm.
Step 3, determining an optimal sampling rate: by controlling a variable method and a least square method, the relation between the optimal sampling rate and the basic sampling rate of a foreground key area, a background area and a transition area is calculated, and then the basic sampling rate is selected by utilizing an image processing algorithm, so that the optimal sampling rate of each area is obtained.
Step 4, image reconstruction: and sampling the three regions in each image sub-block by adopting the corresponding optimal sampling rate respectively, and reconstructing the image by using a compressed sensing theory so as to achieve the effect of image compression.
In step 1, the image blocking method specifically includes the following steps:
step 11, image pre-blocking: the original image of the traffic toll station is pre-divided into N non-overlapping area blocks with the size of B x B. The original image of the traffic charging station is called a father block, and the pre-divided non-overlapping area block is called a pre-sub block.
Step 12, secondary image blocking: the gray scale mean square deviation value sigma 2 of pixels between columns and pixels between rows in the parent block is calculated, then the gray scale mean square deviation value sigma 1 of the pixels between columns and the pixels between rows is calculated for each pre-divided sub block which is pre-divided, and the sigma 1 and the sigma 2 are compared.
If sigma 1 is larger than sigma 2 in any one of the pre-subblocks A, the pre-subblock A is subjected to secondary blocking to reduce B. At this time, the pre-subblock a before the second deblocking is formed as a parent subblock. The subblock A is divided into a plurality of subblocks B after being divided into blocks for the second time. And if the sigma 1 is less than or equal to the sigma 2, the image blocking is finished.
Step 13, image cyclic subdivision: the gray level mean square deviation value sigma 1 of the pixels between columns and the pixels between rows is calculated for each sub-block B.
And then calculating the gray mean square difference value sigma 2 of the pixels between columns and the pixels between rows of the father block. If sigma 1 is larger than sigma 2, B in the step 12 is further reduced, and the steps 12 to 13 are repeated until sigma 1 is less than or equal to sigma 2.
In step 2, the method for partitioning the image sub-blocks specifically comprises the following steps:
step 21, calculating an optimal pixel segmentation threshold K of the image subblock I, specifically including the following steps:
step 21A, calculating a total pixel value I _ size and a total average value S _ avg of the gray scale of the image sub-block I: the image subblocks formed in the step 1 are an image subblock I, an image subblock II, an image subblock III and an image subblock … … respectively. By obtaining the size of the length M and the width N of the image subblock I, the pixel gray value I _ size of the pixel point sum of the image subblock I is M × N and the gray total average value S _ avg is calculated.
Step 21B, presetting the first scanning parameters: and presetting the scanning parameters of the image subblock I for the first time. The first scanning parameters and the preset values are respectively as follows: maximum variance σ of image2Is preset to
Figure BDA0002596352380000021
The initial value of the total gray scale G of the image is preset to G0The initial value of the pixel gray threshold value T is preset to T0The initial value of the optimum pixel gradation division threshold value K is preset to K0
Step 21C, pixel gray value classification presetting: and pre-dividing the image sub-block I into an A area and a B area according to the size of the pixel gray value. The area A is used for storing the pixel points of which the gray values are greater than or equal to the pixel initial threshold value T, and the area B is used for storing the pixel points of which the gray values are less than the pixel initial threshold value T. Presetting: s1Is the sum of the number of the pixel points in the area A. G1Is the total gray value of the A area. S2The sum of the number of the pixel points in the B area. G2Is the total gray value of the B area. And mixing S1、G1、S2And G2The initial values of (a) are respectively given as: sA、GA、SBAnd GB
Step 21D, first scanning and gray value classification of pixel points: scanning the gray value of the first pixel point in the image sub-block I as I (0,0), and judging the initial value T of I (0,0) and the pixel gray threshold value T0The size of (2):
if I (0,0) > T0Then S is1=SA+1,G1=GA+I(0,0)。
If I (0,0) is less than or equal to T0Then S is2=SB+1,G2=GB+I(0,0)。
Step 21E, calculating the maximum interclass variance ICV: the maximum interclass variance ICV is calculated using the following formula:
ICV=R1×(R11-G_avg)2+R2×(R22-G_avg)2
R1=S1/I_size
R2=S2/I_size
R11=G1/S1
R22=G2/S2
Figure BDA0002596352380000031
in the formula, R1The ratio of the sum of the pixels in the A area to the sum of the pixels in the image sub-block I is shown. R11Is the ratio of the total gray value in the A area to the total sum of the pixel points in the A area. R2Is the ratio of the total pixels in the B area to the total pixels in the image sub-block I. R22The ratio of the total gray value of the B area to the total sum of the pixel points of the B area is obtained. And G _ avg is the total average value of the I gray scales of the image sub-blocks.
Step 21F, updating the optimal pixel gray segmentation threshold K: the maximum between-class variance ICV calculated in the step 21E and the maximum variance sigma of the image2Starting value of
Figure BDA0002596352380000032
And comparing to obtain an updated optimal pixel gray segmentation threshold K, wherein the specific updating method comprises the following steps:
(1) when in use
Figure BDA0002596352380000033
When, σ2=ICV,K=T。
(2) When in use
Figure BDA0002596352380000034
When K is equal to K0And not updated.
Step 21G, updating the pixel gray threshold T: and comparing the current pixel gray threshold value T with 255, and if T is less than or equal to 255, making T equal to T + 1. Otherwise, step 21H is performed.
Step 21H, iteratively updating the optimal pixel gray segmentation threshold K: traversing other pixel points I (I, j) in the image subblock I, wherein I is more than 0 and less than or equal to M-1, and j is more than 0 and less than or equal to N-1. And judging the I (I, j) and the updated pixel gray threshold value T:
if I (I, j) > T, then S1=S1+1,G1=G1+I(i,j)。
If I (I, j) is less than or equal to T, then S2=S2+1,G2=G2+I(i,j)。
Repeating steps 21E to 21H, and stopping the iterative updating when any one of the following conditions occurs:
(1) t is less than or equal to 255, and all pixel points in the image subblock I are traversed.
(2)T>255。
And step 22, according to the method in the step 21, completing the calculation and solution of the optimal pixel gray segmentation threshold K of all the image sub-blocks.
Step 23, partitioning: and (4) dividing each image subblock into a foreground key area, a background area and a transition area according to the optimal pixel gray segmentation threshold K obtained in the step (22) and by combining a sobel algorithm. The transition area is an area where the foreground key area is connected with the background area.
In step 23, the specific method of partitioning includes: after the optimal pixel gray scale division threshold value K of the image sub-blocks is selected, DCT coefficients of all parts of each image sub-block after the optimal pixel gray scale division threshold value K is divided are calculated. According to the calculated DCT coefficient, dividing a foreground key area and a background area: the part of the DCT coefficient higher than the DCT set value is a foreground area, and the part of the DCT coefficient lower than the DCT set value is a background area. Then, by using the sobel algorithm, the main edge area in each image sub-block is calculated and recorded as a transition area.
The method for calculating the transition region by the sobel algorithm comprises the following steps: according to a classical sobel edge detection algorithm and the working principle of a sobel filter, an original gray matrix of an image is changed into a gradient matrix of the image after the image passes through the sobel filter, the magnitude of a numerical value in the gradient matrix represents the contrast magnitude of a pixel point and surrounding pixel points, and when the numerical value in the gradient matrix is larger than a set threshold value of edge gray, the gradient matrix is identified as an edge.
Suppose that the pixel points corresponding to the 30 th% of the large values in the current gradient matrix are called edge pixel points. And setting a threshold value for the edge gray level, taking the edge pixel points, expanding u x u matrix blocks by taking the edge pixel points as the gravity centers, wherein u is an integer odd number and is not more than min (M, N)/20, and the areas of all u x u matrix blocks are determined as transition areas.
In step 23, the DCT setting is (4/3) Di, where Di is the average DCT coefficient of the corresponding image sub-block.
In step 3, the method for determining the optimal sampling rate includes the following steps:
step 31, setting basic observation sub-blocks: setting a basic observation sub-block with the size of b × b, wherein b is an integer and
Figure BDA0002596352380000041
and setting the basic sampling rate of the basic observation subblock as r, and obtaining the observed quantity of the basic observation subblock as r b according to a compressed sensing observation matrix correlation algorithm.
Step 32, setting sampling parameters of the image sub-blocks: the areas of the foreground region, the transition region, and the background region of each image sub-block are U, V, W, respectively, and U + V + W is I _ size. Suppose that the optimal sampling rates of the foreground region, the transition region and the background region are respectively set as r1,r2,r3And r is1>r2>r3Then r (U + V + W) ═ r1*U+r2*V+r3W. Suppose the number of sub-blocks in the foreground region is k11The number of sub-blocks in the transition region is k12The number of sub-blocks in the background region is k13If the number k of the sub-blocks of the sampled image is equal to k11+k12+k13
Step 33, determining the proportional relation between the optimal sampling rate and the basic sampling rate: calculating the proportional relation between the optimal sampling rate and the basic sampling rate of the foreground key area, the background area and the transition area by controlling a variable method and a least square method, wherein the specific relation is as follows:
r2=r
Figure BDA0002596352380000051
and satisfy (r)1+r3) And minimum.
Step 34, calculating a basic sampling rate: the basic sampling rate r is obtained by the basic nyquist sampling law.
Step 35, substituting the basic sampling rate r calculated in the step 34 into the proportional relation determined in the step 33, and further solving to obtain the optimal sampling rate r of the foreground area, the transition area and the background area1,r2,r3
Solving to obtain the optimal sampling rates of the foreground key area, the background area and the transition area as follows:
r2=r
r1=(W/U)r
r3=(U/W)r。
in step 11, when the image is pre-blocked, the size of the original image of the traffic toll station is assumed to be Im*InThen B is<In/4。
The invention has the following beneficial effects:
1. the invention adopts a compressed sensing algorithm to compress the image, can break through the limitation of the Nyquist sampling law, samples the image signal at a sampling rate far lower than the Nyquist sampling rate, and combines an image blocking algorithm based on image content difference with a self-adaptive sampling rate selection algorithm, so that the image can be sampled at different sampling rates according to the image content in different image areas, and the image reconstruction is completed at higher efficiency, thereby achieving the purpose of image compression.
2. A method for compressing traffic images by fusing the idea of image blocking with compressed sensing. In the compression process, the image signal is firstly divided into a plurality of small blocks, and each small block is compressed independently, so that the computational complexity is greatly reduced. In the process of blocking, the difference between image sub-blocks is supposed to be introduced as a blocking standard, and the maximum inter-class variance is supposed to be introduced as a blocking measurement standard of the blocking difference. The method is a self-adaptive blocking method, and can achieve the effect of dividing the image into sub-blocks with different sizes. Considering that the traffic images of the toll station have similar backgrounds, only the areas of the front vehicles are valuable areas and the like, in the compression process, the difference between the background and the important areas of the front vehicles is introduced, sampling is carried out by using a low sampling rate in the relatively unimportant background areas, namely the relatively flat areas with small variance, sampling is carried out by using a high sampling rate in the relatively important areas of the front vehicles, namely the areas with large variance with rich details, and the number of observed values of the important areas of the image signals is large, the number of background observed values is small, so that the retention of the significant information and the scale of the compressed data amount are effectively considered.
Drawings
FIG. 1 is a flow chart of an image compression method based on the maximum inter-class variance block compressed sensing of the present invention.
FIG. 2 is a flow chart of image sub-block partitioning according to the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and specific preferred embodiments.
In the description of the present invention, it is to be understood that the terms "left side", "right side", "upper part", "lower part", etc., indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of describing the present invention and simplifying the description, but do not indicate or imply that the referred device or element must have a specific orientation, be constructed in a specific orientation, and be operated, and that "first", "second", etc., do not represent an important degree of the component parts, and thus are not to be construed as limiting the present invention. The specific dimensions used in the present example are only for illustrating the technical solution and do not limit the scope of protection of the present invention.
As shown in fig. 1, an image compression method based on the block compressed sensing of the maximum between-class variance includes the following steps.
Step 1, image blocking: and (3) carrying out image blocking on the original image of the traffic toll station by using the gray mean square difference value of the pixels between columns and the pixels between lines as a comparison standard to form a plurality of image sub-blocks.
In step 1, the method for image blocking preferably specifically includes the following steps:
step 11, image pre-blocking: the original image of the traffic toll station is pre-divided into N non-overlapping area blocks with the size of B x B. The original image of the traffic charging station is called a father block, and the pre-divided non-overlapping area block is called a pre-sub block. Assume that the size of the original image of the traffic toll station is Im*InThen B is preferred<In/4。
Step 12, secondary image blocking: the gray scale mean square deviation value sigma 2 of pixels between columns and pixels between rows in the parent block is calculated, then the gray scale mean square deviation value sigma 1 of the pixels between columns and the pixels between rows is calculated for each pre-divided sub block which is pre-divided, and the sigma 1 and the sigma 2 are compared.
If sigma 1 is larger than sigma 2 in any one of the pre-subblocks A, the pre-subblock A is subjected to secondary blocking to reduce B. At this time, the pre-subblock a before the second deblocking is formed as a parent subblock. The subblock A is divided into a plurality of subblocks B after being divided into blocks for the second time. And if the sigma 1 is less than or equal to the sigma 2, the image blocking is finished.
Step 13, image cyclic subdivision: the gray level mean square deviation value sigma 1 of the pixels between columns and the pixels between rows is calculated for each sub-block B.
And then calculating the gray mean square difference value sigma 2 of the pixels between columns and the pixels between rows of the father block. If sigma 1 is larger than sigma 2, B in the step 12 is further reduced, and the steps 12 to 13 are repeated until sigma 1 is less than or equal to sigma 2.
The advantages of the adaptive blocking of the invention over conventional image blocking are: in most cases, the conventional image blocking is based on the blocking threshold value (for example, averaging) of all pixel points of the whole image, the method cannot realize self-adaptive blocking according to the complexity of different regions of the image, and the whole image is sampled by only adopting the same sampling rate. The blocking algorithm is adopted to carry out blocking by taking the variance of the pixel gray levels of adjacent areas into consideration, the method carries out blocking to ensure that the variance of the pixel gray levels in a final image block is small (the image characteristic is more or less, or flatter, less in detail, or more complex and more in detail), and the final blocking result integrates the image content characteristic and lays a cushion for sampling at different sampling rates according to different image characteristics.
Step 2, image sub-block partitioning: and calculating the optimal pixel gray segmentation threshold value K for each image sub-block by adopting a maximum between-class variance OSTU algorithm. And then dividing the threshold value K according to the optimal pixel gray scale, and equally dividing each image sub-block into a foreground key area, a background area and a transition area by combining a sobel algorithm.
In step 2, the method for partitioning the image sub-blocks preferably includes the following steps:
step 21, calculating an optimal pixel segmentation threshold K of the image subblock I, specifically including the following steps:
step 21A, calculating a total pixel value I _ size and a total average value S _ avg of the gray scale of the image sub-block I: the image subblocks formed in the step 1 are an image subblock I, an image subblock II, an image subblock III and an image subblock … … respectively. By obtaining the size of the length M and the width N of the image subblock I, the pixel gray value I _ size of the pixel point sum of the image subblock I is M × N and the gray total average value S _ avg is calculated.
Step 21B, presetting the first scanning parameters: and presetting the scanning parameters of the image subblock I for the first time. The first scanning parameters and the preset values are respectively as follows: maximum variance σ of image2Is preset to
Figure BDA0002596352380000072
The initial value of the total gray scale G of the image is preset to G0The initial value of the pixel gray threshold value T is preset to T0The initial value of the optimum pixel gradation division threshold value K is preset to K0
Step 21C, pixel gray value classification presetting: and pre-dividing the image sub-block I into an A area and a B area according to the size of the pixel gray value. The area A is used for storing the pixel points of which the gray values are greater than or equal to the pixel initial threshold value T, and the area B is used for storing the pixel points of which the gray values are less than the pixel initial threshold value T. Presetting: s1Is the sum of the number of the pixel points in the area A. G1Is the total gray value of the A area. S2The sum of the number of the pixel points in the B area. G2Is the total gray value of the B region. And mixing S1、G1、S2And G2The initial values of (a) are respectively given as: sA、GA、SBAnd GB
Step 21D, first scanning and gray value classification of pixel points: scanning the gray value of the first pixel point in the image sub-block I as I (0,0), and judging the initial value T of I (0,0) and the pixel gray threshold value T0The size of (2):
if I (0,0) > T0Then S is1=SA+1,G1=GA+I(0,0)。
If I (0,0) is less than or equal to T0Then S is2=SB+1,G2=GB+I(0,0)。
Step 21E, calculating the maximum interclass variance ICV: the maximum interclass variance ICV is calculated using the following formula:
ICV=R1×(R11-G_avg)2+R2×(R22-G_avg)2
R1=S1/I_size
R2=S2/I_size
R11=G1/S1
R22=G2/S2
Figure BDA0002596352380000071
in the formula, R1The ratio of the sum of the pixels in the A area to the sum of the pixels in the image sub-block I is shown. R11Is the ratio of the total gray value in the A area to the total sum of the pixel points in the A area. R2Is the ratio of the total pixels in the B area to the total pixels in the image sub-block I. R22The ratio of the total gray value of the B area to the total sum of the pixel points of the B area is obtained. And G _ avg is the total average value of the I gray scales of the image sub-blocks.
Step 21F, updating the optimal pixel gray segmentation threshold K: the maximum between-class variance ICV calculated in the step 21E and the maximum variance sigma of the image2Starting value of
Figure BDA0002596352380000081
And comparing to obtain an updated optimal pixel gray segmentation threshold K, wherein the specific updating method comprises the following steps:
(1) when in use
Figure BDA0002596352380000082
When, σ2=ICV,K=T。
(2) When in use
Figure BDA0002596352380000083
When K is equal to K0And not updated.
Step 21G, updating the pixel gray threshold T: and comparing the current pixel gray threshold value T with 255, and if T is less than or equal to 255, making T equal to T + 1. Otherwise, step 21H is performed.
Step 21H, iteratively updating the optimal pixel gray segmentation threshold K: traversing other pixel points I (I, j) in the image subblock I, wherein I is more than 0 and less than or equal to M-1, and j is more than 0 and less than or equal to N-1. And judging the I (I, j) and the updated pixel gray threshold value T:
if I (I, j) > T, then S1=S1+1,G1=G1+I(i,j)。
If I (I, j) is less than or equal to T, then S2=S2+1,G2=G2+I(i,j)。
Repeating steps 21E to 21H, and stopping the iterative updating when any one of the following conditions occurs:
(1) t is less than or equal to 255, and all pixel points in the image subblock I are traversed.
(2)T>255。
And step 22, according to the method in the step 21, completing the calculation and solution of the optimal pixel gray segmentation threshold K of all the image sub-blocks.
Step 23, partitioning: and (4) dividing each image subblock into a foreground key area, a background area and a transition area according to the optimal pixel gray segmentation threshold K obtained in the step (22) and by combining a sobel algorithm. The transition area is an area where the foreground key area is connected with the background area.
In step 23, the specific method of partitioning includes: after the optimal pixel gray scale division threshold value K of the image sub-blocks is selected, DCT coefficients of all parts of each image sub-block after the optimal pixel gray scale division threshold value K is divided are calculated. According to the calculated DCT coefficient, dividing a foreground key area and a background area: the part of the DCT coefficient higher than the DCT set value is a foreground area, and the part of the DCT coefficient lower than the DCT set value is a background area. Then, by using the sobel algorithm, the main edge area in each image sub-block is calculated and recorded as a transition area.
The DCT setting is preferably (4/3) Di, where Di is the average DCT coefficient of the corresponding image sub-block; the setting of (4/3) Di ensures a large background area.
The method for calculating the transition region by the sobel algorithm comprises the following steps: according to a classical sobel edge detection algorithm and the working principle of a sobel filter, an original gray matrix of an image is changed into a gradient matrix of the image after the image passes through the sobel filter, the magnitude of a numerical value in the gradient matrix represents the contrast magnitude of a pixel point and surrounding pixel points, and when the numerical value in the gradient matrix is larger than a set threshold value of edge gray, the gradient matrix is identified as an edge.
Suppose that the pixel points corresponding to the 30 th% of the large values in the current gradient matrix are called edge pixel points. And setting a threshold value for the edge gray level, taking the edge pixel points, expanding u x u matrix blocks by taking the edge pixel points as the gravity centers, wherein u is an integer odd number and is not more than min (M, N)/20, and the areas of all u x u matrix blocks are determined as transition areas.
Step 3, determining an optimal sampling rate: by controlling a variable method and a least square method, the relation between the optimal sampling rate and the basic sampling rate of a foreground key area, a background area and a transition area is calculated, and then the basic sampling rate is selected by utilizing an image processing algorithm, so that the optimal sampling rate of each area is obtained.
In step 3, the method for determining the optimal sampling rate includes the following steps:
step 31, setting basic observation sub-blocks: setting a basic observation sub-block with the size of b × b, wherein b is an integer and
Figure BDA0002596352380000091
and setting the basic sampling rate of the basic observation subblock as r, and obtaining the observed quantity of the basic observation subblock as r b according to a compressed sensing observation matrix correlation algorithm.
Step 32, setting sampling parameters of the image sub-blocks: the areas of the foreground region, the transition region, and the background region of each image sub-block are U, V, W, respectively, and U + V + W is I _ size. Suppose that the optimal sampling rates of the foreground region, the transition region and the background region are respectively set as r1,r2,r3And r is1>r2>r3Then r (U + V + W) ═ r1*U+r2*V+r3W. Suppose the number of sub-blocks in the foreground region is k11The number of sub-blocks in the transition region is k12The number of sub-blocks in the background region is k13If the number k of the sub-blocks of the sampled image is equal to k11+k12+k13
Step 33, determining the proportional relation between the optimal sampling rate and the basic sampling rate: calculating the proportional relation between the optimal sampling rate and the basic sampling rate of the foreground key area, the background area and the transition area by controlling a variable method and a least square method, wherein the specific relation is as follows:
r2=r
Figure BDA0002596352380000092
and satisfy (r)1+r3) At a minimum, find r1And r3The preferred solution of (a) is:
r1=(W/U)r
r3=(U/W)r。
step 34, calculating a basic sampling rate: the basic sampling rate r is obtained by the basic nyquist sampling law.
Step 35, substituting the basic sampling rate r calculated in the step 34 into the proportional relation determined in the step 33, and further solving to obtain the optimal sampling rate r of the foreground area, the transition area and the background area1,r2,r3
Step 4, image reconstruction: and sampling the three regions in each image sub-block by adopting the corresponding optimal sampling rate respectively, and reconstructing the image by using a compressed sensing theory so as to achieve the effect of image compression.
I.e. the transition region in each image sub-block adopts the optimum sampling rate r1Sampling is carried out, and the optimal sampling rate r is adopted in the foreground key area2Sampling is carried out, and the optimal sampling rate r is adopted in the background area3Sampling is performed.
Because the image is partitioned based on the difference of image pixels when the image is partitioned, the image compression method based on the partitioned compressed sensing of the maximum inter-class variance has better efficiency.
Through simulation experiments, the image compression method based on the block compression perception of the maximum inter-class variance has better image reconstruction capability compared with the traditional JPEG compression method and the compression method based on the uniform blocks and the image adjacent pixel difference blocks by taking an image quality evaluation index PSNR as a reference index, wherein the PSNR (dB) of the image compression method is about 1.26 times of the PSNR (dB) of 1.09 uniform blocks of the JPEG compression method and about 1.12 times of the PSNR (dB) of the adjacent pixel difference blocks, and the image compression efficiency of the algorithm is 1.22 times of that of the traditional JPEG compression method.
Although the preferred embodiments of the present invention have been described in detail, the present invention is not limited to the details of the embodiments, and various equivalent modifications can be made within the technical spirit of the present invention, and the scope of the present invention is also within the scope of the present invention.

Claims (8)

1. An image compression method based on the block compressed sensing of the maximum between-class variance is characterized in that: the method comprises the following steps:
step 1, image blocking: taking the gray level mean square difference value of the pixels between columns and the pixels between lines as a comparison standard, and carrying out image blocking on the original image of the traffic toll station to form a plurality of image sub-blocks;
the image blocking method specifically comprises the following steps:
step 11, image pre-blocking: an original image of a traffic toll station is divided into N non-overlapping area blocks with the size of B x B in advance; the original image of the traffic charging station is called a father block, and the pre-divided non-overlapping area block is called a pre-sub block;
step 12, secondary image blocking: firstly, calculating a gray level mean square deviation value sigma 2 of pixels between columns and pixels between rows in a parent block, then calculating a gray level mean square deviation value sigma 1 of the pixels between columns and the pixels between rows for each pre-divided sub block which is pre-divided, and comparing sigma 1 with sigma 2; if sigma 1 is larger than sigma 2 in any one of the pre-subblocks A, performing secondary blocking on the pre-subblock A to reduce B; at this time, a pre-subblock A before secondary blocking is formed as a father subblock; after the subblock A is divided into blocks for the second time, a plurality of subblocks B are formed; if the sigma 1 is less than or equal to sigma 2, the image blocking is finished;
step 13, image cyclic subdivision: firstly, respectively calculating the gray mean square difference value sigma 1 of pixels between columns and pixels between rows for each sub-block B; then, calculating the gray level mean square deviation value sigma 2 of the pixels between columns and the pixels between rows of the father block; if sigma 1 is larger than sigma 2, further reducing B in the step 12, and repeating the steps 12 to 13 until sigma 1 is smaller than or equal to sigma 2;
step 2, image sub-block partitioning: calculating an optimal pixel gray segmentation threshold value K for each image sub-block by adopting a maximum between-class variance OSTU algorithm; dividing a threshold value K according to the optimal pixel gray level, and equally dividing each image sub-block into a foreground key area, a background area and a transition area by combining a sobel algorithm; the size of each image subblock is length M and width N, and the total pixel gray value of pixel points of each image subblock is I _ size ═ M × N;
step 3, determining an optimal sampling rate: by controlling a variable method and a least square method, firstly calculating the relation between the optimal sampling rate and the basic sampling rate of a foreground key area, a background area and a transition area, and then selecting the basic sampling rate by using an image processing algorithm, thereby obtaining the optimal sampling rate of each area;
in step 3, the method for determining the optimal sampling rate includes the following steps:
step 31, setting basic observation sub-blocks: setting a basic observation sub-block with the size of b × b, wherein b is an integer and
Figure FDA0002986781620000011
setting the basic sampling rate of the basic observation subblock as r, and obtaining the observed quantity of the basic observation subblock as r b according to a compressed sensing observation matrix correlation algorithm;
step 32, setting sampling parameters of the image sub-blocks: the areas of the foreground region, the transition region and the background region of each image sub-block are U, V, W respectively, and then U + V + W is I _ size; suppose that the optimal sampling rates of the foreground region, the transition region and the background region are respectively set as r1,r2,r3And r is1>r2>r3Then r (U + V + W) ═ r1*U+r2*V+r3W; suppose the number of sub-blocks in the foreground region is k11The number of sub-blocks in the transition region is k12The number of sub-blocks in the background region is k13If the number k of the sub-blocks of the sampled image is equal to k11+k12+k13
Step 33, determining the proportional relation between the optimal sampling rate and the basic sampling rate: calculating the proportional relation between the optimal sampling rate and the basic sampling rate of the foreground key area, the background area and the transition area by controlling a variable method and a least square method, wherein the specific relation is as follows:
r2=r
Figure FDA0002986781620000021
and satisfy (r)1+r3) Minimum;
step 34, calculating a basic sampling rate: obtaining a basic sampling rate r through a basic Nyquist sampling law;
step 35, substituting the basic sampling rate r calculated in the step 34 into the proportional relation determined in the step 33, and further solving to obtain the optimal sampling rate r of the foreground area, the transition area and the background area1,r2,r3
Step 4, image reconstruction: and sampling the three regions in each image sub-block by adopting the corresponding optimal sampling rate respectively, and reconstructing the image by using a compressed sensing theory so as to achieve the effect of image compression.
2. The method of image compression based on maximum inter-class variance block compressed sensing of claim 1, wherein: in step 2, the method for partitioning the image sub-blocks specifically comprises the following steps:
step 21, calculating an optimal pixel segmentation threshold K of the image subblock I, specifically including the following steps:
step 21A, calculating a total pixel value I _ size and a total average value S _ avg of the gray scale of the image sub-block I: the image subblocks formed in the step 1 are an image subblock I, an image subblock II, an image subblock III and an image subblock … … respectively; calculating the pixel gray value I _ size of the sum of pixel points of the image subblock I as M × N and the total average value S _ avg of the gray value by obtaining the size of the length M and the width N of the image subblock I;
step 21B, presetting the first scanning parameters: presetting scanning parameters for the first time for the image subblock I; the first scanning parameters and the preset values are respectively as follows: maximum variance σ of image2Is preset to
Figure FDA0002986781620000022
The initial value of the total gray scale G of the image is preset to G0The initial value of the pixel gray threshold value T is preset to T0The initial value of the optimum pixel gradation division threshold value K is preset to K0
Step 21C, pixel gray value classification presetting: pre-dividing the image sub-block I into an area A and an area B according to the size of a pixel gray value; the area A is used for storing pixel points of which the gray values are greater than or equal to the initial pixel threshold value T, and the area B is used for storing pixel points of which the gray values are less than the initial pixel threshold value T; presetting: s1The sum of the number of the pixels in the area A; g1Is the total gray value of the A area; s2The sum of the number of the pixel points in the B area; g2Is the total gray value of the B area; and mixing S1、G1、S2And G2The initial values of (a) are respectively given as: sA、GA、SBAnd GB
Step 21D, first scanning and gray value classification of pixel points: scanning the gray value of the first pixel point in the image sub-block I as I (0,0), and judging the initial value T of I (0,0) and the pixel gray threshold value T0The size of (2):
if I (0,0) > T0Then S is1=SA+1,G1=GA+I(0,0);
If I (0,0) is less than or equal to T0Then S is2=SB+1,G2=GB+I(0,0);
Step 21E, calculating the maximum interclass variance ICV: the maximum interclass variance ICV is calculated using the following formula:
ICV=R1×(R11-G_avg)2+R2×(R22-G_avg)2
R1=S1/I_size
R2=S2/I_size
R11=G1/S1
R22=G2/S2
Figure FDA0002986781620000031
in the formula, R1The ratio of the sum of the pixels in the area A to the sum of the pixels in the image subblock I is obtained; r11The ratio of the total gray value of the A area to the sum of the pixel points of the A area is obtained; r2The ratio of the total pixels in the B area to the total pixels in the image sub-block I is obtained; r22The ratio of the total gray value of the B area to the total sum of the pixel points of the B area is obtained; g _ avg is the total average value of the I gray scales of the image sub-blocks;
step 21F, updating the optimal pixel gray segmentation threshold K: the maximum between-class variance ICV calculated in the step 21E and the maximum variance sigma of the image2Starting value of
Figure FDA0002986781620000032
Comparing to obtain updated optimal pixel gray segmentation threshold K, and updating by the method such asThe following:
(1) when in use
Figure FDA0002986781620000033
When, σ2=ICV,K=T;
(2) When in use
Figure FDA0002986781620000034
When K is equal to K0No update;
step 21G, updating the pixel gray threshold T: comparing the current pixel gray threshold value T with 255, and if T is less than or equal to 255, making T equal to T + 1; otherwise, go to step 21H;
step 21H, iteratively updating the optimal pixel gray segmentation threshold K: traversing other pixel points I (I, j) in the image subblock I, wherein I is more than 0 and less than or equal to M-1, and j is more than 0 and less than or equal to N-1; and judging the I (I, j) and the updated pixel gray threshold value T:
if I (I, j) > T, then S1=S1+1,G1=G1+I(i,j);
If I (I, j) is less than or equal to T, then S2=S2+1,G2=G2+I(i,j);
Repeating steps 21E to 21H, and stopping the iterative updating when any one of the following conditions occurs:
(1) t is less than or equal to 255, and all pixel points in the image subblock I are traversed;
(2)T>255;
step 22, according to the method in step 21, completing calculation and solving of the optimal pixel gray segmentation threshold value K of all the image sub-blocks;
step 23, partitioning: dividing each image sub-block into a foreground key area, a background area and a transition area according to the optimal pixel gray segmentation threshold K obtained in the step 22 and combining a sobel algorithm; the transition area is an area where the foreground key area is connected with the background area.
3. The method of image compression based on maximum inter-class variance block compressed sensing of claim 2, wherein: in step 23, the specific method of partitioning includes: after the optimal pixel gray scale division threshold value K of the image subblocks is selected, calculating DCT coefficients of all parts of each image subblock after the optimal pixel gray scale division threshold value K is divided; according to the calculated DCT coefficient, dividing a foreground key area and a background area: the part of the DCT coefficient higher than the DCT set value is a foreground area, and the part of the DCT coefficient lower than the DCT set value is a background area; then, by using the sobel algorithm, the main edge area in each image sub-block is calculated and recorded as a transition area.
4. The method of image compression based on maximum inter-class variance block compressed sensing of claim 3, wherein: the method for calculating the transition region by the sobel algorithm comprises the following steps: according to a classical sobel edge detection algorithm and the working principle of a sobel filter, an original gray matrix of an image is changed into a gradient matrix of the image after the image passes through the sobel filter, the magnitude of a numerical value in the gradient matrix represents the contrast magnitude of a pixel point and surrounding pixel points, and when the numerical value in the gradient matrix is larger than a set threshold value of edge gray, the gradient matrix is identified as an edge.
5. The method of image compression based on maximum inter-class variance block compressed sensing of claim 4, wherein: assuming that pixel points corresponding to the 30 th% of large numerical values in the current gradient matrix are called edge pixel points; and setting a threshold value for the edge gray level, taking the edge pixel points, expanding u x u matrix blocks by taking the edge pixel points as the gravity centers, wherein u is an integer odd number and is not more than min (M, N)/20, and the areas of all u x u matrix blocks are determined as transition areas.
6. The method of image compression based on maximum inter-class variance block compressed sensing of claim 3, wherein: in step 23, the DCT setting is (4/3) Di, where Di is the average DCT coefficient of the corresponding image sub-block.
7. The method of image compression based on maximum inter-class variance block compressed sensing of claim 1, wherein: solving to obtain the optimal sampling rates of the foreground key area, the background area and the transition area as follows:
r2=r
r1=(W/U)r
r3=(U/W)r。
8. the method of image compression based on maximum inter-class variance block compressed sensing of claim 1, wherein: in step 11, when the image is pre-blocked, the size of the original image of the traffic toll station is assumed to be Im*InB is less than In/4。
CN202010710462.8A 2020-07-22 2020-07-22 Image compression method based on maximum inter-class variance block compressed sensing Active CN111986280B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010710462.8A CN111986280B (en) 2020-07-22 2020-07-22 Image compression method based on maximum inter-class variance block compressed sensing

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010710462.8A CN111986280B (en) 2020-07-22 2020-07-22 Image compression method based on maximum inter-class variance block compressed sensing

Publications (2)

Publication Number Publication Date
CN111986280A CN111986280A (en) 2020-11-24
CN111986280B true CN111986280B (en) 2021-06-01

Family

ID=73437994

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010710462.8A Active CN111986280B (en) 2020-07-22 2020-07-22 Image compression method based on maximum inter-class variance block compressed sensing

Country Status (1)

Country Link
CN (1) CN111986280B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115410090A (en) * 2022-07-21 2022-11-29 桂林电子科技大学 Image compression sensing reconstruction method of spatial heterodyne spectrometer based on image segmentation
CN118362483B (en) * 2024-06-20 2024-09-20 中国科学院生态环境研究中心 Pollen automatic sampling anti-stacking control method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103310211A (en) * 2013-04-26 2013-09-18 四川大学 Filling mark recognition method based on image processing
CN103338363A (en) * 2013-03-06 2013-10-02 西安电子科技大学 System and method for video compression sensing and encoding based on measurement domain block classification
CN106941609A (en) * 2017-02-15 2017-07-11 浙江工业大学 The video-frequency compression method perceived based on self adaptation splits' positions
CN108447101A (en) * 2018-01-23 2018-08-24 电子科技大学 A kind of compression of images cognitive method based on JND model
CN110401839A (en) * 2019-08-22 2019-11-01 上海无线电设备研究所 A kind of space remote sensing method for compressing image based on the perception of adaptive splits' positions

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8532437B2 (en) * 2009-05-18 2013-09-10 Citrix Systems, Inc. Systems and methods for block recomposition for compound image compression
CN109120931A (en) * 2018-09-05 2019-01-01 浙江树人学院 A kind of streaming media video compression method based on frame-to-frame correlation

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103338363A (en) * 2013-03-06 2013-10-02 西安电子科技大学 System and method for video compression sensing and encoding based on measurement domain block classification
CN103310211A (en) * 2013-04-26 2013-09-18 四川大学 Filling mark recognition method based on image processing
CN106941609A (en) * 2017-02-15 2017-07-11 浙江工业大学 The video-frequency compression method perceived based on self adaptation splits' positions
CN108447101A (en) * 2018-01-23 2018-08-24 电子科技大学 A kind of compression of images cognitive method based on JND model
CN110401839A (en) * 2019-08-22 2019-11-01 上海无线电设备研究所 A kind of space remote sensing method for compressing image based on the perception of adaptive splits' positions

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Microwave Imaging From Sparse Measurements for Near-Field Synthetic Aperture Radar;Xiahan Yang 等;《IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT》;20170704;第66卷(第10期);第2680-2692页 *
基于压缩感知的显著性检测算法研究及应用;苗修勋;《中国优秀硕士学位论文全文数据库 信息科技辑》;20170315(第3期);第I138-5195页 *
自适应阈值Canny边缘检测算法研究;徐亮 等;《软件导刊》;20130820;第12卷(第8期);第62-64页 *
货车典型故障图像识别算法研究;戴鹏;《中国博士学位论文全文数据库 信息科技辑》;20110515(第5期);第I138-33页 *

Also Published As

Publication number Publication date
CN111986280A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
JP4732660B2 (en) Visual attention system
CN1099188C (en) Signal self-adaptive wave filter method and filter
CN101563926B (en) Image compression and decompression
JP5331486B2 (en) Method and apparatus for improving resolution of digital image
US6608865B1 (en) Coding method for video signal based on the correlation between the edge direction and the distribution of the DCT coefficients
DE69720560T2 (en) Image decoder and image decoding method
CN111986280B (en) Image compression method based on maximum inter-class variance block compressed sensing
CN104378636B (en) A kind of video encoding method and device
CN111008651B (en) Image reproduction detection method based on multi-feature fusion
EP1213928B1 (en) Image coding/decoding method, image coding apparatus and image decoding apparatus
CN103024393B (en) A kind of compression for single image and decompressing method
CN112738533A (en) Machine patrol image regional compression method
JP3105335B2 (en) Compression / expansion method by orthogonal transform coding of image
US7106908B2 (en) Method and apparatus for selecting a format in which to re-encode a quantized image
CN103596006A (en) Image compression method based on vision redundancy measurement
Yuan et al. Gradient-guided residual learning for inverse halftoning and image expanding
EP0974932A2 (en) Adaptive video compression
US7570821B2 (en) Apparatus and method for image coding
CN115311145B (en) Image processing method and device, electronic equipment and storage medium
JP4645948B2 (en) Decoding device and program
CN113628119B (en) Method for identifying block to be denoised in image denoising process
US6748118B1 (en) Method of quantizing signal samples of an image during same
CN112565756B (en) Cloud-containing remote sensing image compression method based on quantization strategy
WO2004066608A2 (en) Image compression using a color visual model
CN108010000B (en) Compressed image sharpening method based on adjacent feature subspace fitting

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