CN100534206C - Image compression method - Google Patents

Image compression method Download PDF

Info

Publication number
CN100534206C
CN100534206C CNB200510111184XA CN200510111184A CN100534206C CN 100534206 C CN100534206 C CN 100534206C CN B200510111184X A CNB200510111184X A CN B200510111184XA CN 200510111184 A CN200510111184 A CN 200510111184A CN 100534206 C CN100534206 C CN 100534206C
Authority
CN
China
Prior art keywords
value
rgb
space
yuv
pixels
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.)
Expired - Fee Related
Application number
CNB200510111184XA
Other languages
Chinese (zh)
Other versions
CN1980404A (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.)
Pixelworks Semiconductor Technology Shanghai Co Ltd
Original Assignee
Pixelworks Semiconductor Technology Shanghai 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 Pixelworks Semiconductor Technology Shanghai Co Ltd filed Critical Pixelworks Semiconductor Technology Shanghai Co Ltd
Priority to CNB200510111184XA priority Critical patent/CN100534206C/en
Publication of CN1980404A publication Critical patent/CN1980404A/en
Application granted granted Critical
Publication of CN100534206C publication Critical patent/CN100534206C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The method includes following steps: (1) picking up RGB values of two adjacent pixels, and converting them to YUV values; (2) calculating U difference and V difference of two pixels; (3) if U difference exceeds first threshold value and/or V difference exceeds second threshold value, then executing step (4); if U difference is smaller than first threshold value and/or V difference is smaller than second threshold value, then executing step (5); (4) under RGB colority space, compressing the two pixels, then executing (6); (5) under YUV colority space, 2 times sampling chromatic component is carried out for the two pixels, and then executing (6); (6) output compressed code flow, then picking up RGB values of next two adjacent pixels, and executing (1). The invention can carry out image compression in YUV colority space and RGB colority space under selfadaption. Color of line in single pixel will not be lost in the process method.

Description

A kind of method for compressing image
Technical field
The present invention relates to a kind of method for compressing image, especially a kind of adaptive method for compressing image that carries out image compression at YUV color space or rgb color space.
Background technology
Along with the development of digital technology and information technology, multimedia application more and more widely.Not through the multi-medium data of overcompression, view data for example, video data and voice data all need jumbo memory space and transmission bandwidth.In order to save cost, utilize redundancy between data initial data is compressed and then to be stored and transmit, become the important content in information processing research field and chip manufacturing field.
Because human eye is more responsive more than colourity information UV for monochrome information Y, existing method for compressing image is that the RGB chrominance space is transformed into the YUV chrominance space, on brightness and chrominance information, carry out the compression of different compression ratios, can under the situation of not losing subjective visual quality do, utilize the characteristic of human eye to obtain certain image compression rate.Be exactly to carry out 2 times down-sampling (Downsampling) at the YUV chrominance space typically at the compression method of YUV chrominance space.
Because human eye is to brightness chrominance sensitivity, therefore the Downsapling method at yuv space is exactly to suppose that the colourity of neighbor is very approaching.The carrier chrominance signal that only keeps a pixel so in adjacent two pixels is given up the chrominance information of one other pixel.Two pixels are all used the same chrominance information during decoding.Because the color and the adjacent pixels color of single pixel lines are different, when color be not very near the time can produce the unacceptable line color of human eye and lose phenomenon.
This compression method at yuv space has obtained extensive use in the TV field.Yet on PC and monitor, the lines or the artificial various images of drawing of single pixel occur, as the versicolor single pixel lines that utilize mapping software such as CAD to draw through regular meeting.If adopting the method for the down-sampling under the YUV chrominance space this moment compresses, when single pixel lines are not in sampled point, the UV value of lines can be dropped, be used as its UV value during decompression with the UV value of adjacent sampled point, like this because the color of the color of lines itself and neighbor is different, can make the color of single pixel lines lose, this can not be accepted by the user in the application of PC and monitor.So non-natural figure of this compression and the defective compression method of picture are applied on PC and the monitor and have significant limitation.
Summary of the invention
The objective of the invention is to overcome the defective of conventional images compression method, a kind of method for compressing image is provided, adaptively carry out image compression at YUV color space and rgb color space, the color that single pixel lines can not occur is lost.
For achieving the above object, the invention provides a kind of method for compressing image, comprise the steps:
The rgb value of step 1, two neighbors of extraction, and be converted to the YUV value;
Step 2, the difference of U value of calculating two pixels and V value poor;
If the difference of step 3 U value surpasses first threshold, and/or the difference of V value surpasses then execution in step 4 of second threshold value; If less than second threshold value, then execution in step 5 less than the difference of first threshold and V value for the difference of U value;
Step 4, two pixels are carried out compression under the RGB chrominance space, execution in step 6;
Step 5, two pixels are carried out 2 times of down-samplings of chromatic component under the YUV chrominance space, execution in step 6;
Step 6, output compressed bit stream extract the rgb value of following two neighbors, execution in step 1 then.
When in the above-mentioned steps 4 two pixels being carried out the compression under the RGB chrominance space, give up the low-order bit of RGB component, and insert the identifier of rgb space.When in above-mentioned steps 5, two pixels being carried out 2 times of down-samplings of chromatic component under the YUV chrominance space, insert the fuzzy diagnosis symbol of yuv space.
Therefore, method for compressing image of the present invention, can adaptively carry out image compression at YUV color space and rgb color space, the color that single pixel lines can occur is not lost, make the down-sampling compression method under the YUV chrominance space can apply in the high-resolution display, go for display and the various monitor of PC.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Description of drawings
Fig. 1 is the flow chart of method for compressing image of the present invention.
Embodiment
In image processing and Video processing, need carry out the storage of frame.For conserve storage and satisfy certain data bus bandwidth requirement, can take method for compressing image to carry out image compression.Compression method must possess the characteristics that operand is low, subjective visual quality do is lost in the resource consumption less and not.The down-sampling that carries out chromatic component at the YUV chrominance space is extensively applied in various images and the video compression.Yet because PC display and monitor often show the lines or the artificial various images of drawing of single pixel, the unacceptable single pixel of human eye can appear in the compression method of this yuv space and line color is lost, or the image border color phenomenon of losing.For under the prerequisite of not losing subjective visual quality do, the lines or the various figure of single pixel compressed, the present invention can the adaptive YUV of being chosen in or rgb color space carry out image compression, remedy the defective of YUV colourity down-sampling.
Referring to shown in Figure 1, be the flow chart of method for compressing image of the present invention, concrete steps are as follows:
The rgb value of step 101, two neighbors of extraction, and be converted to the YUV value;
Promptly the value of the RGB of two pixels is carried out the conversion of rgb space to yuv space, the fundamental formular of rgb space and yuv space conversion is:
Y = 0.299 R + 0.587 G + 0.114 B U = - 0.172 R - 0.339 G + 0.511 B + 128 V = 0.511 R - 0.428 G - 0.083 B + 128 ;
In order to cancel the operation of floating number, round after each coefficient in the above-mentioned formula can being multiply by 2 n power, last result carries out moving to right for n time again, in order to guarantee the counting accuracy of RGB when the YUV color space is changed, result of calculation is taked the method that rounds up, and the big more precision of the value of n is high more, the conversion formula when present embodiment is n=8:
Y = ( ( 77 R + 150 G + 29 B ) + 128 ) > > 8 U = ( ( ( - 44 R - 87 G + 131 B ) + 128 ) > > 8 ) + 128 V = ( ( ( 131 R - 110 G - 21 B ) + 128 ) > > 8 ) + 128 } ;
Step 102, the difference of U value of calculating two pixels and V value poor;
If the original YUV value of two pixels is respectively Y1, U1, V1 and Y2, U2, V2 is the inputs of 8 bits, asks for the difference of the U component and the V component of two pixels so by following formula:
ΔU=|U1-U2|
ΔV=|V1-V2|;
If the difference of step 103 U value surpasses first threshold, and/or the difference of V value surpasses then execution in step 104 of second threshold value; If less than second threshold value, then execution in step 105 less than the difference of first threshold and V value for the difference of U value;
This step compares the difference of the U value of current two pixels will compressing and the difference of V value, if the difference of two chromatic components thinks so that all less than separately threshold value two color of pixel are more approaching, can adopt the method for this colourity down-sampling; If the difference of arbitrary chromatic component is greater than separately threshold value, just think that these two color of pixel keep off, if at this moment still use the method for colourity down-sampling, can cause image impairment excessive, therefore automatically switch to the compression of rgb space, do not have very big information loss to guarantee two pixels;
The first threshold that makes U is Uth, and second threshold value of V is Vth,
When Δ U<Uth and Δ V<Vth execution in step 105 then;
As Δ U 〉=Uth or Δ V 〉=Vth execution in step 104 then;
Step 104, two pixels are carried out compression under the RGB chrominance space, execution in step 106;
Because if the difference that a chromatic component arranged is then compressed at rgb space greater than separately threshold value, directly intercept the low-order bit of RGB component, and insert the identifier of rgb space;
Compression under the RGB chrominance space, abandon the compression ratio that the low bit of RGB component obtains to require, be the input of 24 bits for each pixel just, obtain the output of average 16 bits of each pixel, because human eye is in three color components of RGB, susceptibility to the G component is the highest, adopt following intercept method: the original rgb value of establishing two pixels is R1, G1, B1 and R2, G2, B2 is the inputs of 8 bits, is output as high 5 bit R1 after the rgb space compression so, high 6 bit G1, high 5 bit B1, high 5 bit R2, high 5 bit G2, high 5 bit B2 and 1 bit space identifier " 0 ", the average number of bits of such two pixels is 16 bits; What judge that when compression adopt by space identifier " 0 " during decoding is the rgb space compression method;
Step 105, two pixels are carried out 2 times of down-samplings of chromatic component under the YUV chrominance space, execution in step 106;
Because the difference of U component and V component is then carried out 2 times of down-samplings of YUV chromatic component all less than separately threshold value, insert the pattern recognition symbol of yuv space;
2 times of down-samplings of YUV chrominance space can be selected the UV value of the UV value of any pixel in two pixels as one other pixel, also can select the UV value of the UV value of that smaller pixel of brightness value in two pixels, and the lowest bit position of using the V value is as the compression stroke identifier as one other pixel;
If the original YUV value of two pixels is respectively Y1, U1, V1 and Y2, U2, V2 is the inputs of 8 bits, total bit number of two pixels is 48 bits so, average each pixel is 24 bits, becomes behind 2 times of down-samplings of yuv space: 8 bit Y1,8 bit U1, high 7 bit V1,8 bit Y2 and 1 bit space identifier " 1 ", total bit number of two pixels is 32 bits, on average each pixel is 16 bits; What adopt when judging compression by space identifier " 1 " during decoding is 2 times of Downsapling methods of YUV colourity;
Step 106, output compressed bit stream extract the rgb value of following two neighbors then, execution in step 1, and the compressed bit stream of output be average each pixel 16 bit, the compression ratio of obtaining with the method for traditional 2 times of down-samplings of YUV carrier chrominance signal is the same.
Below the pixel data in the above-mentioned steps is judged and compression is given an example and specified:
Example 1: as shown in table 1, be the original RGB data of pixel 0 and pixel 1,
Figure C200510111184D00071
Table 1, the original RGB data of pixel 0 and pixel 1
Data after two pixel RGB change to the YUV color space are as shown in table 2,
Figure C200510111184D00081
Table 2, the data after two pixel RGB change to the YUV color space
Therefore: Δ U=|162-91|=71; Δ V=|171-81|=90;
If Uth=10, Vth=10.This moment Δ U Uth, Δ V〉Vth, therefore adopt the compression of rgb space, for pixel 0, give up R0 low 3, low 2 of G0, low 3 of B0; For pixel 1, that gives up R1 hangs down 3, and G1 hangs down 3, and B1 hangs down 3; The last compression stroke identifier " 0 " that adds a bit again.
Final output bit is: 01100 (R0), 000000 (G0), 01100 (B0), 00000 (R1), 01101 (G1), 00000 (B1) 0.
Example 2:
As shown in table 3, be the original RGB data of pixel 0 and pixel 1,
Figure C200510111184D00082
Table 3, the original RGB data of pixel 0 and pixel 1
Data after two pixel RGB change to the YUV color space are as shown in table 4,
Table 4, the data after two pixel RGB change to the YUV color space
ΔU=|112-116|=4;
ΔV=|162-157|=5;
If Uth=10, Vth=10, this moment Δ U<Uth, therefore Δ V<Vth adopts 2 times of Downsapling methods of YUV colourity, abandons the value of the U1 and the V1 of pixel 1, abandons the lowest bit of the V0 of pixel 0, adds the compression stroke identifier " 1 " of 1 bit at last again.
Final output bit is: 01001110 (Y0), 01110000 (U0), 1010001 (V0), 01010001 (Y1) 1.
For most natural picture, when the threshold value of UV is provided with suitablely, overwhelming majority pixel all is to adopt the YUV Downsapling method, and this is that this also is the reason place that YUV chrominance space Downsapling method is able to extensive use because of the very strong correlation of color between the neighbor of natural picture.And for some special pictures, such as the figure of single pixel lines or drafting, can automatically switch to rgb color space at lines and pattern edge compresses, and can not cause the subjective vision loss of picture like this.
It should be noted last that, above embodiment is only unrestricted in order to technical scheme of the present invention to be described, although the present invention is had been described in detail with reference to preferred embodiment, those of ordinary skill in the art is to be understood that, can make amendment or be equal to replacement technical scheme of the present invention, and not break away from the spirit and scope of technical solution of the present invention.

Claims (3)

1, a kind of method for compressing image, comprising following steps:
The rgb value of step 1, two neighbors of extraction, and be converted to the YUV value;
Step 2, the difference of U value of calculating two pixels and V value poor;
If the difference of step 3 U value surpasses first threshold, and/or the difference of V value surpasses then execution in step 4 of second threshold value; If less than second threshold value, then execution in step 5 less than the difference of first threshold and V value for the difference of U value;
Step 4, two pixels are carried out compression under the RGB chrominance space, execution in step 6;
Step 5, two pixels are carried out 2 times of down-samplings of chromatic component under the YUV chrominance space, execution in step 6;
Step 6, output compressed bit stream extract the rgb value of following two neighbors, execution in step 1 then.
2, method for compressing image according to claim 1 when in the wherein said step 4 two pixels being carried out the compression under the RGB chrominance space, is given up the low-order bit of RGB component, and inserts the identifier of rgb space.
3, method for compressing image according to claim 1 and 2 when two pixels being carried out 2 times of down-samplings of chromatic component under the YUV chrominance space in the wherein said step 5, inserts the fuzzy diagnosis symbol of yuv space.
CNB200510111184XA 2005-12-06 2005-12-06 Image compression method Expired - Fee Related CN100534206C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB200510111184XA CN100534206C (en) 2005-12-06 2005-12-06 Image compression method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB200510111184XA CN100534206C (en) 2005-12-06 2005-12-06 Image compression method

Publications (2)

Publication Number Publication Date
CN1980404A CN1980404A (en) 2007-06-13
CN100534206C true CN100534206C (en) 2009-08-26

Family

ID=38131368

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB200510111184XA Expired - Fee Related CN100534206C (en) 2005-12-06 2005-12-06 Image compression method

Country Status (1)

Country Link
CN (1) CN100534206C (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI502550B (en) * 2012-03-30 2015-10-01 Nation United University Differential layered image compression method
CN108352076A (en) * 2015-08-24 2018-07-31 汤姆逊许可公司 Coding and decoding methods and corresponding equipment

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9307237B2 (en) * 2012-01-19 2016-04-05 Futurewei Technologies, Inc. Reference pixel reduction for intra LM prediction
US8805069B2 (en) * 2012-06-12 2014-08-12 Kyocera Document Solutions Inc. Cell-based compression of digital images
CN106604037B (en) * 2017-01-09 2019-08-13 电子科技大学 A kind of novel Color Coding of Images

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI502550B (en) * 2012-03-30 2015-10-01 Nation United University Differential layered image compression method
CN108352076A (en) * 2015-08-24 2018-07-31 汤姆逊许可公司 Coding and decoding methods and corresponding equipment
US11070830B2 (en) 2015-08-24 2021-07-20 Interdigital Madison Patent Holdings, Sas Coding and decoding method with color conversion and corresponding devices
CN108352076B (en) * 2015-08-24 2021-09-17 交互数字麦迪逊专利控股公司 Encoding and decoding method and corresponding devices

Also Published As

Publication number Publication date
CN1980404A (en) 2007-06-13

Similar Documents

Publication Publication Date Title
US20220207680A1 (en) Image Processing Method and Apparatus
KR101343240B1 (en) Automatic removal of purple fringing from images
CN102812705B (en) image encoder and image decoder
TWI593275B (en) Adaptive linear luma domain video pipeline architecture, system and machine readable medium
CN103636204A (en) Selective lossless-lossy compression of image data based on bit budget
CN100534206C (en) Image compression method
US20170324959A1 (en) Method and apparatus for encoding/decoding a high dynamic range picture into a coded bitstream
US11257195B2 (en) Method and device for decoding a high-dynamic range image
US20100201883A1 (en) Integrated circuit having a circuit for and method of providing intensity correction for a video
CN113284064B (en) Cross-scale context low-illumination image enhancement method based on attention mechanism
CN102572502B (en) Selecting method of keyframe for video quality evaluation
CN110855958B (en) Image adjusting method and device, electronic equipment and storage medium
CN101686321B (en) Method and system for reducing noise in image data
CN101321298B (en) Color gamut component analysis apparatus, method of analyzing color gamut component
US20020048398A1 (en) Method of and system for low-bandwidth transmission of color video
CN111355936A (en) Method and system for acquiring and processing image data for artificial intelligence
CN111738951B (en) Image processing method and device
CN112686810A (en) Image processing method and device
CN112489056A (en) Real-time human body matting method suitable for mobile terminal
CN101923455B (en) Method for displaying and analyzing digital image in YUV format
CN103747162B (en) A kind of image sampling method for external splicer or hybrid matrix
CN113112428A (en) Image processing method and device, electronic equipment and readable storage medium
CN115329112B (en) Efficient storage method for remote sensing images of unmanned aerial vehicle
CN107197235A (en) A kind of HDR video pre-filterings method
CN107734386B (en) MIPI (Mobile industry processor interface) protocol-based video image reduction method and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090826

Termination date: 20171206

CF01 Termination of patent right due to non-payment of annual fee