TWI552580B - Method of image compression - Google Patents

Method of image compression Download PDF

Info

Publication number
TWI552580B
TWI552580B TW104127677A TW104127677A TWI552580B TW I552580 B TWI552580 B TW I552580B TW 104127677 A TW104127677 A TW 104127677A TW 104127677 A TW104127677 A TW 104127677A TW I552580 B TWI552580 B TW I552580B
Authority
TW
Taiwan
Prior art keywords
component
original
grouping
image
clusters
Prior art date
Application number
TW104127677A
Other languages
Chinese (zh)
Other versions
TW201709733A (en
Inventor
蔡正發
江耀
Original Assignee
國立屏東科技大學
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 國立屏東科技大學 filed Critical 國立屏東科技大學
Priority to TW104127677A priority Critical patent/TWI552580B/en
Application granted granted Critical
Publication of TWI552580B publication Critical patent/TWI552580B/en
Publication of TW201709733A publication Critical patent/TW201709733A/en

Links

Description

Image compression method
The present invention relates to an image compression method, and more particularly to an image compression method for determining a codebook size based on a clustering result.
With the advancement of information technology and the development of the Internet, users can easily use electronic devices such as computers, mobile phones or tablet processors to store or transmit electronic data. However, in terms of electronic data, the original image data with high resolution not only occupies a large storage space, but also requires a long transmission time in the process of data transmission. Therefore, the original image data usually passes a moderate degree. Compression processing, so that the compressed image data can have a small storage space under the premise of minimum distortion.
The image compression technology can be divided into a spatial domain and a frequency domain according to the execution manner. In the space domain, the conventional image compression technology first performs color quantization processing on the original image data to analyze the image. The color types included in the pixels of the original image data are further grouped by a group algorithm to form an code book. By performing the grouping algorithm, the plurality of pixels having similar colors may be grouped into the same cluster, and the plurality of clusters and their corresponding representative colors are recorded in the code book, when the original image data is to be performed. During the compression process, the original image data can be re-encoded according to the code book to output a compressed image data, so that the compressed image data can have a small storage space because it contains less color information.
In general, the conventional clustering algorithm usually sets a codebook size in advance before grouping the pixels of the original image, and the grouping algorithm is based on a grouping algorithm. After grouping the plurality of pixels, the clusters generated by the grouping can be recorded in the code book according to the size of the codebook. However, it is difficult to estimate the number of clusters after grouping before performing the grouping algorithm. If the number of clusters after grouping is too large and the size of the codebook is too small, the record of the codebook will be insufficient and the distortion rate of image compression will be increased. If the number of clusters after grouping is too small and the size of the codebook is too large, the codebook will be caused. The redundant space is too large and wastes resources. In consideration of the above situation, it is difficult for the user to set an appropriate codebook size, thereby reducing the operational convenience of the image compression process.
In view of the above, it is necessary to provide an image compression method to solve the problem of poor operation convenience of the conventional image compression method.
The object of the present invention is to provide an image compression method, which can determine the size of the code book according to the grouping result, thereby improving the operation convenience of the image compression process.
In order to achieve the foregoing object, the technical method used by the present invention includes: an image compression method executed by a processor, the step comprising: an image analysis step of receiving an original image and analyzing a plurality of pixels of the original image The color value of the point; a parameter setting step, setting a reference point and a grouping range; a grouping step, setting the plurality of pixels that are not grouped into a plurality of operation points, and setting the operation point closest to the reference point to a group a heart point, the clustering range is centered on the group heart point, and the operation points included in the grouping group are grouped into a cluster, and then a representative color value is calculated according to the color value of the operation point included in the cluster; a judging step, Determining whether the plurality of pixels have been grouped and generating a plurality of clusters and a plurality of representative color values. If not, performing the grouping step, and if so, performing an codebook establishing step; the codebook establishing step, transmitting an encoding The size rule is determined according to the total number of the plurality of clusters, and the number of clusters and the plurality of clusters are determined according to the size of the codebook. Table color value record in a code book; and an image output step, to the codebook for encoding the original image, and generates a compressed image; wherein the plurality of the color value of a pixel value of the original color, the original The initial color value has a red original component, a green original component and a blue original component, and the representative color values of each cluster have a red representative component, a green representative component and a blue representative component, and each red represents a component. For the average of the red original components of the plurality of pixel points included in each cluster, each green representative value is an average value of the green original components of the plurality of pixel points included in each cluster, and each blue represents The component is the average of the blue original components of the plurality of pixels included in each of the clusters.
In the parameter setting step, the reference point has a red reference component, a green reference component, and a blue reference component, and the red reference component, the green reference component, and the blue reference component are all zero.
Wherein, in the grouping step, the plurality of operation points and the group point can respectively calculate a distance value by using a distance formula, and if the distance between the plurality of operation points and the group point is not greater than the grouping range, Then, the plurality of operation points are located within the group range of the group heart point.
Wherein, in the codebook establishing step, the code size rule sets a plurality of reference sizes, and uses the reference size closest to the total number of the clusters as the codebook size, if the total number of the plurality of clusters is not greater than The code book size, the plurality of clusters and the plurality of representative color values are all recorded in the code book. If the total number of the plurality of clusters is larger than the code book size, the code book size is selected to have more The plurality of clusters of the number of pixels and a plurality of representative color values thereof are recorded in the codebook.
Wherein, the plurality of reference sizes are expressed as: C=2 X ; wherein C represents the reference size; X is an arbitrary integer greater than 0.
In the image output step, the color values of the plurality of pixels of the original image are converted into the plurality of representative color values according to the code book to generate the compressed image.
Therefore, the image compression method of the present invention can improve the operation convenience of the image compression processing without determining the size of the code book in advance, but after completing the grouping, and determining the size of the code book according to the grouping result.
〔this invention〕
S1‧‧‧ Image Analysis Procedure
S2‧‧‧ parameter setting procedure
S3‧‧‧ grouping steps
S4‧‧‧ judgment steps
S5‧‧‧ Codebook creation steps
S6‧‧‧Image output step
Figure 1 is a flow chart showing the steps of the image compression method of the present invention.
The above and other objects, features and advantages of the present invention will become more <RTIgt; Point refers to the basic unit that constitutes an image. For example, when the width of the image has 256 pixels and the height has 256 pixels, the image has 256×256=65536 pixels.
The "color value" as used throughout the present invention refers to a numerical value representing a representative color of a pixel, for example, when the pixel is composed of three primary colors of red (R), green (G), and blue (B). If a red component of the pixel is 114, a green component is 201, and a blue component is 126, the color value (RGB) of the pixel can be expressed as (114, 201, 126).
Referring to FIG. 1 , the image compression method of the present invention includes an image analysis step S1, a parameter setting step S2, a grouping step S3, a determining step S4, an encoder creation step S5, and an image output step S6. The above steps of the present invention are all performed by a processor, which may be a computer or any arithmetic processor, and may execute a software or a program for performing operations and the like.
The image analysis step S1 receives an original image and analyzes color values of a plurality of pixels of the original image.
In more detail, after receiving the original image of color, the processor can analyze a software to analyze an original color value of each pixel of the original image. In this embodiment, the original color value has a red original component, a green original component, and a blue original component, for example, when the original color value (RGB) of the pixel is (114, 201, 126), That is, the red original component is 114, and the green original component is 201, the blue The original component is 126.
The parameter setting step S2 sets a reference point and a grouping range.
More specifically, since the plurality of pixels respectively have the original color value, and the original color value includes the red original component, the green original component, and the blue original component, when passing through three axes perpendicular to each other To represent the red original component, the green original component, and the blue original component, respectively, a three-dimensional space may be defined, and the plurality of pixel points may be located in the three-dimensional space according to the original color value of the same. In this embodiment, the reference point may also be located in the three-dimensional space, wherein the reference point has a red reference component, a green reference component, and a blue reference component, and the red reference component, the green reference component, and The blue reference component may both be 0 such that the reference point is located at one of the origins in the three-dimensional space. Accordingly, the processor can find the most suitable pixel point according to the reference point, and use the pixel point as a group of heart points for subsequent group processing, thereby shortening the time required for setting the group heart point for the first time. Or avoiding the grouping misalignment caused by randomly setting the group of points, and has the effect of improving the execution speed and group quality of the overall grouping process.
Moreover, the value of the clustering range is not limited herein. For the same original image, if the value of the clustering range is smaller, the total number of clusters generated after grouping is larger, if the grouping The larger the value of the range, the smaller the total number of clusters generated after grouping, which can be easily understood by those skilled in the art, and will not be described herein.
In the grouping step S3, the plurality of pixel points that are not grouped are set as a plurality of operation points, and the operation point closest to the reference point is set as a group of heart points, and the grouping range is centered on the group heart point, and the grouping point is within the grouping range The included operation points are grouped into a cluster, and then a representative color value is generated according to the color value of the operation point included in the cluster.
More specifically, the processor may set the plurality of pixel points that are not grouped into a plurality of operation points, and the plurality of operation points and the group of core points may respectively calculate a distance value by using a distance formula, if the number If the distance between the operation point and the group heart point is not greater than the grouping range, then the number of operations The point is located in the group of the group of points, wherein the distance formula can be any calculation formula for calculating the distance between the two points, and is not limited herein. For example, in the above three-dimensional space architecture, the center point of the group is a center, and the grouping range is a circle radius, and a sphere can be enclosed in the three-dimensional space, and the plurality of spheres in the sphere The operation points can be regarded as being within the group range of the group point and can be grouped into the same cluster.
Moreover, each of the clusters has the representative color value, and the representative color values respectively have a red representative component, a green representative component, and a blue representative component, and each red representative component is the plurality of pixels included in each cluster. The average of the red original components of the points, each green representative component is the average of the green original components of the plurality of pixel points included in each cluster, and each blue representative component is the plurality of components included in each cluster. The average of the blue original components of the pixel. By the representative color value generated by the above calculation, the representative color value of each cluster is closer to the main use color of the original image, so that the clustering result and the number of occurrences of the pixel points of the original image are higher. Correlation, which improves the accuracy of grouping and subsequent image compression quality.
The determining step S4 determines whether the plurality of pixels have been grouped and generates a plurality of clusters and a plurality of representative color values. If not, the grouping step S3 is performed, and if so, the codebook establishing step S5 is executed.
More specifically, when the processor performs the grouping step S3 for the first time, a cluster and the representative color value may be generated. At this time, the processor performs the determining step S4 and determines whether the plurality of pixels are All of the groups have been grouped. If not, the grouping step S3 is performed again to perform the second grouping of the plurality of pixels that have not been grouped, and the above process is repeated until the pixels of the original image have been Complete the grouping.
The codebook establishing step S5 determines a codebook size according to the total number of the plurality of clusters by using an encoding size rule, and records the plurality of clusters and the plurality of representative color values in an encoding according to the codebook size. book.
More specifically, the codebook can be used to record the color categories and the representative color values contained in each of the clusters, wherein the code size rule sets a plurality of reference sizes and the reference is closest to the total number of the clusters. The size is the size of the codebook. If the total number of the plurality of clusters is not greater than the size of the codebook, the plurality of clusters and the plurality of representative color values are all recorded in the codebook, if the total number of the clusters If the codebook size is larger than the codebook size, the plurality of clusters having a larger number of the pixels and a plurality of representative color values are recorded in the codebook. In this embodiment, the plurality of reference sizes can be expressed as C=2 X , where C represents the reference size and X is any integer greater than zero. For example, for example, when the total number of the clusters is 1003, since the total number of clusters is between 512 (when X is 9) and 1024 (when X is 10), and the cluster The total number (1003) is closer to the reference size of 1024, so the reference size 1024 can be used as the codebook size, and since the total number of the plurality of clusters (1003) is not larger than the codebook size (1024), The processor may record the plurality of clusters and the plurality of representative color values in the code book to establish a more complete code book; and, when the total number of the plurality of clusters is 1132, due to the cluster The total number is between 1024 (when X is 10) and 2048 (when X is 11), and the total number of clusters (1132) is closer to the reference size of 1024, so the reference size is 1024. As the codebook size, in addition, since the total number of the plurality of clusters (1132) is larger than the codebook size (1024), the processor can select 1024 clusters having a larger number of the pixels among the 1132 clusters. And the representative color value records the code book so that the code book can contain more pixels The number of clusters and the representative color value, thereby reducing the degree of distortion of the image output S6 is the original image in the step of performing subsequent.
It is worth mentioning that, because the codebook establishing step S5 can determine the size of the codebook according to the total number of clusters after grouping, the user does not need to preset the codebook size before performing the grouping step S3, which has the convenience of improving operation. Sexual effect. Moreover, since the codebook establishing step S5 can select the closest reference size as the number according to the total number of clusters after grouping The size of the code book can further maintain the integrity of the code book while maintaining the convenience of operation, and has the effect of improving the compression quality.
The image output step S6 encodes the original image with the code book and generates a compressed image.
In more detail, when the original original image is to be compressed by the image compression method of the present invention, the image analysis step S1 can obtain a plurality of original color values corresponding to a plurality of pixels of the original image, and then, the parameter The adjusting step S2 can set the necessary parameters required for grouping, and group the plurality of pixels in the grouping step S3, and then pass the determining step S4 to ensure that the plurality of pixels have been grouped, and the The code book establishing step S5 is to establish the code book according to the grouping result, and when the image output step S6 encodes the original image in the code book, the color values of the plurality of pixels of the original image are according to the code book. And converting the plurality of representative color values, thereby generating the compressed image with less color types, thereby reducing the color information of the compressed image, so that the compressed image can have a smaller storage space than the original image.
In order to verify that the image compression method of the present invention has the effect of improving image compression quality, a test image is compressed by the processor, and the experimental results are summarized as follows. Among them, the operating system of the processor is 64-bit Windows 7, the central processing unit is AMD Athlon (tm) II X2 2.90GHz, the memory is 4GB RAM, the simulation tool is NetBeans IDE, the programming language is Java, and the test image is Lena, the test image size is 512 × 512, the code book size of the method one to three is preset to 512, the reference point is (0, 0, 0), the grouping range is 11. The image quality is based on the Peak Signal-to-Noise Ratio (PSNR). Generally speaking, when the PSNR value is larger, the compression quality is better. The formula of the PSNR belongs to the field. The usual knowledge will not be repeated here.
In Table 2, the method 1 to the method 3 have similar execution steps to the present invention. However, the grouping step of the method 1 adopts an LBG grouping algorithm, and the grouping step of the method 2 adopts a HKC grouping algorithm. The third step of the method is to use a LazySOM grouping algorithm. The above grouping algorithms are all known algorithms, and will not be described here. It can be seen from Table 1 that since the present invention only needs to set the reference point and the grouping range, the grouping step S3 can be performed in the simplest manner, which not only improves the convenience of operation, but also improves the grouping speed; The execution of the book creation step S5 may select the closest reference size as the codebook size according to the total number of clusters after grouping, so that the record content of the codebook is closer to the main use color of the original image, and thus has a higher PSNR value. The above experimental data can prove that the image compression method of the present invention has the effects of improving the compression quality and improving the overall execution speed.
In summary, the image compression method of the present invention, by performing the codebook creation step S5, does not need to preset the codebook size, but after the group is completed, the size of the codebook is determined according to the grouping result. In turn, the operation convenience of the image compression processing is improved.
While the invention has been described in connection with the preferred embodiments described above, it is not intended to limit the scope of the invention. The technical scope of the invention is protected, and therefore the scope of the invention is defined by the scope of the appended claims.
S1‧‧‧ Image Analysis Procedure
S2‧‧‧ parameter setting procedure
S3‧‧‧ grouping steps
S4‧‧‧ judgment steps
S5‧‧‧ Codebook creation steps
S6‧‧‧Image output step

Claims (6)

  1. An image compression method is performed by a processor, and the steps include: an image analysis step of receiving an original image and analyzing color values of a plurality of pixels of the original image; and a parameter setting step of setting a reference point and a a grouping step; a grouping step, the plurality of pixels that are not grouped are set as a plurality of operation points, and the operation point closest to the reference point is set as a group of heart points, and the grouping range is centered on the group heart point, the grouping The operation points included in the range are grouped into a cluster, and then a representative color value is generated according to the color value of the operation point included in the cluster; a determining step determines whether the plurality of pixels are grouped and generates a plurality of clusters and a plurality of representative color values, if not, performing the grouping step, and if so, performing an codebook establishing step; the codebook establishing step is to determine an encoding book according to the total number of the plurality of clusters by a coding size rule a size, and then recording the plurality of clusters and the plurality of representative color values in an code book according to the code book size; and an image output step, the The book encodes the original image and generates a compressed image; wherein the color values of the plurality of pixels are an original color value, the original color value having a red original component, a green original component, and a blue original component The representative color values of each of the clusters respectively have a red representative component, a green representative component, and a blue representative component, and each red representative component is an average of red original components of the plurality of pixel points included in each cluster. a value, each green representative value is an average value of green original components of the plurality of pixel points included in each cluster, and each blue representative component is a blue original component of the plurality of pixel points included in each cluster. average value.
  2. The image compression method according to claim 1, wherein in the parameter setting step, the reference point has a red reference component, a green reference component, and a blue reference score. And the red reference component, the green reference component, and the blue reference component are all zero.
  3. The image compression method according to claim 1, wherein in the grouping step, the plurality of operation points and the group point can respectively calculate a distance value by using a distance formula, if the plurality of operation points and If the distance value of the group point is not greater than the grouping range, the plurality of operation points are located in the grouping range of the group heart point.
  4. The image compression method of claim 1, wherein in the codebook establishing step, the encoding size rule sets a plurality of reference sizes, and the reference size is closest to the total number of the clusters. The code book size, if the total number of the plurality of clusters is not greater than the codebook size, the plurality of clusters and the plurality of representative color values are all recorded in the code book, if the total number of the plurality of clusters is greater than the code The book size is selected according to the codebook size, and the plurality of clusters having a larger number of the pixels and a plurality of representative color values are recorded in the codebook.
  5. The image compression method of claim 4, wherein the plurality of reference sizes are expressed as: C=2 X ; wherein C represents the reference size; and X is an arbitrary integer greater than zero.
  6. The image compression method of claim 1, wherein, in the image output step, the color values of the plurality of pixels of the original image are converted into the plurality of representative color values according to the code book to generate The compressed image.
TW104127677A 2015-08-25 2015-08-25 Method of image compression TWI552580B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW104127677A TWI552580B (en) 2015-08-25 2015-08-25 Method of image compression

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW104127677A TWI552580B (en) 2015-08-25 2015-08-25 Method of image compression

Publications (2)

Publication Number Publication Date
TWI552580B true TWI552580B (en) 2016-10-01
TW201709733A TW201709733A (en) 2017-03-01

Family

ID=57848157

Family Applications (1)

Application Number Title Priority Date Filing Date
TW104127677A TWI552580B (en) 2015-08-25 2015-08-25 Method of image compression

Country Status (1)

Country Link
TW (1) TWI552580B (en)

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Comparison and optimization of methods of color image quantization. Authors: Braquelaire, J.-P. ; LaBRI, Bordeaux I Univ., Talence, France ; Brun, L. Published in: Image Processing, IEEE Transactions on (Volume:6 , Issue: 7). Page(s): 1048 - 1052. Date of Publication : Jul 1997. *

Also Published As

Publication number Publication date
TW201709733A (en) 2017-03-01

Similar Documents

Publication Publication Date Title
JP6928041B2 (en) Methods and equipment for processing video
US20070271207A1 (en) Determining Compliance Rates for Probabilistic Requests
JP2020518191A (en) Quantization parameter prediction maintaining visual quality using deep neural network
US8718378B2 (en) Image topological coding for visual search
JP2014527210A (en) Content adaptive system, method and apparatus for determining optical flow
CN110059728B (en) RGB-D image visual saliency detection method based on attention model
KR100912125B1 (en) System and method for evaluating and certifying image identifier
CN110689599A (en) 3D visual saliency prediction method for generating countermeasure network based on non-local enhancement
CN108900788B (en) Video generation method, video generation device, electronic device, and storage medium
TWI552580B (en) Method of image compression
CN104093022A (en) Rate distortion optimization method and device
CN110929865B (en) Network quantification method, service processing method and related product
CN109118470B (en) Image quality evaluation method and device, terminal and server
CN110619334A (en) Portrait segmentation method based on deep learning, architecture and related device
JP2009509405A (en) Variable shape motion estimation in video sequences
Chang et al. LSIM: Ultra lightweight similarity measurement for mobile graphics applications
TW201703520A (en) The method of image compression
US11082473B1 (en) Method for complexity reduction in video coding by coding parameters reuse
CN106791801A (en) The quality evaluating method and system of a kind of 3-D view
JP2020507150A (en) Method and apparatus for color similarity evaluation
Kung et al. Investigation of the image quality assessment using neural networks and structure similarty
US20210006835A1 (en) Blurring to improve visual quality in an area of interest in a frame
TW202111604A (en) Image steganography method and apparatus, and image extraction method and apparatus, and electronic device
US10904542B2 (en) Image transcoding method and apparatus
WO2021037174A1 (en) Neural network model training method and apparatus