TWI552580B - Method of image compression - Google Patents
Method of image compression Download PDFInfo
- 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
- clusters
- grouping
- image
- Prior art date
Links
Landscapes
- Image Analysis (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Description
本發明係關於一種影像壓縮方法,尤其是一種根據分群結果以決定編碼簿尺寸之影像壓縮方法。 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.
影像壓縮技術可依執行方式而區分為空間領域(Spatial Domain)與頻率領域(Frequency Domain),以空間領域而言,習知影像壓縮技術係先對該原始影像資料進行色彩量化處理,以分析該原始影像資料之數個像素點所包含的顏色種類,再透過一分群演算法對該數個像素點進行分群,進而建立一編碼簿。藉由該分群演算法的執行,可將具有類似顏色的該數個像素點分群至同一群集,並將該數個群集及其對應的代表色紀錄於該編碼簿,當該原始影像資料欲進行壓縮處理時,即可根據該編碼簿對該原始影像資料重新編碼以輸出一壓縮影像資料,使該壓縮影像資料可因包含較少顏色資訊而具有較小儲存空間。 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.
其中,在該參數設定步驟中,該基準點具有一紅色基準分量、一綠色基準分量及一藍色基準分量,且該紅色基準分量、該綠色基準分量及該藍色基準分量皆為0。 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.
其中,該數個參考尺寸係表示為:C=2X;其中,C代表該參考尺寸;X為大於0之任意整數。 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‧‧‧影像分析步驟 S1‧‧‧ Image Analysis Procedure
S2‧‧‧參數設定步驟 S2‧‧‧ parameter setting procedure
S3‧‧‧分群步驟 S3‧‧‧ grouping steps
S4‧‧‧判斷步驟 S4‧‧‧ judgment steps
S5‧‧‧編碼簿建立步驟 S5‧‧‧ Codebook creation steps
S6‧‧‧影像輸出步驟 S6‧‧‧Image output step
第1圖:本發明影像壓縮方法之步驟流程圖。 Figure 1 is a flow chart showing the steps of the image compression method of the present invention.
為讓本發明之上述及其他目的、特徵及優點能更明顯易懂,下文特舉本發明之較佳實施例,並配合所附圖式,作詳細說明如下:本發明全文所述之「像素點」,係指組成一影像之基本單位,例如當該影像之寬度(width)具有256個像素,高度(height)具有256個像素時,該影像共有256×256=65536個像素點。 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.
本發明全文所述之「顏色值」,係指用以代表一像素點之代表顏色的數值,例如當該像素點由紅(R)、綠(G)、藍(B)之三原色組成時,若該像素點的一紅色分量為114、一綠色分量為201,一藍色分量為126,該像素點的顏色值(RGB)可表示為(114,201,126)。 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).
請參照第1圖所示,本發明影像壓縮方法係包含一影像分析步驟S1、一參數設定步驟S2、一分群步驟S3、一判斷步驟S4、一編碼簿建立步驟S5及一影像輸出步驟S6。本發明上述步驟均由一處理器執行,該處理器可為一電腦或任何運算處理器,且可執行一軟體或程式,以進行運算統計等操作。 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.
該影像分析步驟S1係接收一原始影像,並分析該原始影像之數個像素點的顏色值。 The image analysis step S1 receives an original image and analyzes color values of a plurality of pixels of the original image.
更詳言之,該處理器接收彩色之該原始影像後,可透過一量化處理軟體以分析該原始影像之數個像素點所分別具有的一原始顏色值。在本實施例中,該原始顏色值具有一紅色原始分量、一綠色原始分量及一藍色原始分量,例如當該像素點之該原始顏色值(RGB)為(114,201,126)時,即代表該紅色原始分量為114,該綠色原始分量為201,該藍色 原始分量為126。 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.
該參數設定步驟S2係設定一基準點及一分群範圍。 The parameter setting step S2 sets a reference point and a grouping range.
更詳言之,由於該數個像素點分別具有該原始顏色值,且該原始顏色值包含該紅色原始分量、該綠色原始分量及該藍色原始分量,因此,當透過彼此垂直的三個軸以分別表示該紅色原始分量、該綠色原始分量及該藍色原始分量時,可界定出一個三維空間,該數個像素點可依自身之該原始顏色值而位於該三維空間中。在本實施例中,該基準點亦可位於該三維空間中,其中,該基準點具有一紅色基準分量、一綠色基準分量及一藍色基準分量,且該紅色基準分量、該綠色基準分量及該藍色基準分量可皆為0,使該基準點位於上述三維空間中之一原點。據此,該處理器可依該基準點而尋找最適合的該像素點,並以該像素點作為後續分群處理的一群心點,藉此縮短第一次設定該群心點所需的時間,或者避免因隨機設定該群心點所導致的分群失準,具有提升整體分群處理的執行速度與分群品質的效果。 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.
該分群步驟S3係將未經分群之該數個像素點設為數個運算點,設定最接近該基準點的運算點為一群心點,該分群範圍以該群心點為中心,該分群範圍內所包含的運算點分群為一個群集,再根據該群集包含之運算點的顏色值計算產生一個代表顏色值。 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.
該判斷步驟S4係判斷該數個像素點是否皆已分群並產生數個群集及數個代表顏色值,若否,則執行該分群步驟S3,若是,則執行該編碼簿建立步驟S5。 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.
更詳言之,當該處理器第一次執行該分群步驟S3時,可產生一個該群集及該代表顏色值,此時該處理器即執行該判斷步驟S4,並判斷該數個像素點是否皆已分群,若否,則再執行一次該分群步驟S3,以對未經分群之該數個像素點進行第二次的分群,並重複上述流程直到該原始影像之該數個像素點皆已完成分群為止。 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.
該編碼簿建立步驟S5係透過一編碼尺寸規則而根據該數個群集的總數量以決定一編碼簿尺寸,再依該編碼簿尺寸將該數個群集及該數個代表顏色值紀錄於一編碼簿。 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.
更詳言之,該編碼簿可用以紀錄各該群集所包含的顏色種類及該代表顏色值,其中,該編碼尺寸規則係設定數個參考尺寸,並以最接近該群集之總數量的該參考尺寸作為該編碼簿尺寸,若該數個群集的總數量不大於該編碼簿尺寸,則將該數個群集及該數個代表顏色值全部紀錄於該編碼簿,若該數個群集的總數量大於該編碼簿尺寸,則依該編碼簿尺寸選擇具有較多之該像素點數量的該數個群集及其數個代表顏色值紀錄於該編碼簿。在本實施例中,該數個參考尺寸可表示為C=2X,其中,C代表該參考尺寸,X為大於0之任意整數。舉例而言,例如當該數個群集的總數量為1003時,由於該群集的總數量係介於參考尺寸為512(當X為9)及1024(當X為10)之間,且該群集的總數量(1003)較接近1024之該參考尺寸,因此該參考尺寸1024即可作為該編碼簿尺寸,又,由於該數個群集的總數量(1003)不大於該編碼簿尺寸(1024),該處理器可將該數個群集及該數個代表顏色值全部紀錄於該編碼簿,以建立更完整之該編碼簿;又,當該數個群集的總數量為1132時,由於該群集的總數量係介於參考尺寸為1024(當X為10)及2048(當X為11)之間,且該群集的總數量(1132)較接近1024之該參考尺寸,因此該參考尺寸1024即可作為該編碼簿尺寸,又,由於該數個群集的總數量(1132)大於該編碼簿尺寸(1024),該處理器可在1132個群集中選擇具有較多之該像素點數量的1024個群集及其代表顏色值紀錄該編碼簿,使該編碼簿可包含具有較多像素點之該數個群集及其代表顏色值,進而降低該原始影像在執行後續之該影像輸出步驟S6時的失真程度。 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.
值得一提的是,由於該編碼簿建立步驟S5可根據分群後的群集總數量而決定該編碼簿尺寸,使用者不需在執行該分群步驟S3前預先設定該編碼簿尺寸,具有提升操作便利性的效果。又,由於該編碼簿建立步驟S5可根據分群後的群集總數量而選擇最接近之該參考尺寸作為該編 碼簿尺寸,可在維持操作便利性的前提下,進一步維持編碼簿的完整度,具有提升壓縮品質的效果。 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.
該影像輸出步驟S6係以該編碼簿對該原始影像進行編碼,並產生一壓縮影像。 The image output step S6 encodes the original image with the code book and generates a compressed image.
更詳言之,當該原始原始影像欲以本發明之影像壓縮方法進行壓縮時,該影像分析步驟S1可得到該原始影像之數個像素所對應的數個原始顏色值,接下來,該參數調整步驟S2可設定分群所需的必要參數,並在該分群步驟S3中對該數個像素點進行分群,再透過該判斷步驟S4以確保該數個像素點皆已完成分群,接者,該編碼簿建立步驟S5係可根據上述分群結果建立該編碼簿,當該影像輸出步驟S6以該編碼簿對該原始影像進行編碼時,該原始影像之數個像素點的顏色值係根據該編碼簿而轉換為該數個代表顏色值,藉此產生具有較少顏色種類之該壓縮影像,進而減少該壓縮影像之顏色資訊,使該壓縮影像相較於該原始影像能具有較小儲存空間。 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.
為了驗證本發明之影像壓縮方法具有提升影像壓縮品質的功效,以下特以該處理器對一測試影像進行壓縮處理,並將實驗結果整理如下。其中,該處理器之作業系統為64位元的Windows 7,中央處理單元為AMD Athlon(tm)II X2 2.90GHz,記憶體為4GB RAM,模擬工具為NetBeans IDE,程式語言為Java,測試影像為Lena,測試影像尺寸為512×512,該方法一至三之編碼簿尺寸皆預設為512,該基準點為(0,0,0),該分群範圍為11。影像品質係以尖峰訊號雜訊比(Peak Signal-to-Noise Ratio,PSNR)作為判斷標準,一般而言,當該PSNR值越大,表示壓縮品質越好,其中,該PSNR的公式屬於本領域之通常知識,於此不再贅述。 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.
在表二中,該方法一至方法三與本發明具有類似的執行步驟,惟,該方法一之分群步驟係採用一LBG分群演算法,該方法二之分群步驟係採用一HKC分群演算法,該方法三之分群步驟係採用一LazySOM分群演算法,以上分群演算法皆為習知演算法,於此不再贅述。由表一可知,由於本發明僅需設定該基準點及該分群範圍,即能以最簡單的方式執行該分群步驟S3,不僅可提升操作便利性,更能提升分群速度;此外,透過該編碼簿建立步驟S5的執行,可根據分群後的群集總數量而選擇最接近之該參考尺寸作為該編碼簿尺寸,使該編碼簿的紀錄內容更接近該原始影像的主要使用顏色,因而具有較高的PSNR值。上述實驗數據可證明本發明之影像壓縮法具有提升壓縮品質及提升整體執行速度的效果。 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.
綜上所述,本發明之影像壓縮方法,藉由該編碼簿建立步驟S5的執行,可不需預先設定該編碼簿尺寸,而是待完成分群後,再根據分群結果以決定該編碼簿尺寸,進而提升影像壓縮處理的操作便利性。 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‧‧‧影像分析步驟 S1‧‧‧ Image Analysis Procedure
S2‧‧‧參數設定步驟 S2‧‧‧ parameter setting procedure
S3‧‧‧分群步驟 S3‧‧‧ grouping steps
S4‧‧‧判斷步驟 S4‧‧‧ judgment steps
S5‧‧‧編碼簿建立步驟 S5‧‧‧ Codebook creation steps
S6‧‧‧影像輸出步驟 S6‧‧‧Image output step
Claims (6)
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) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
TWI788805B (en) | 2021-03-19 | 2023-01-01 | 瑞昱半導體股份有限公司 | Method for image compression and circuit system thereof |
-
2015
- 2015-08-25 TW TW104127677A patent/TWI552580B/en active
Non-Patent Citations (1)
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 | |
JP7373554B2 (en) | Cross-domain image transformation | |
CN110059728B (en) | RGB-D image visual saliency detection method based on attention model | |
WO2021047471A1 (en) | Image steganography method and apparatus, and image extraction method and apparatus, and electronic device | |
Zhang et al. | Fine-grained quality assessment for compressed images | |
Yang et al. | MPED: Quantifying point cloud distortion based on multiscale potential energy discrepancy | |
JP7405989B2 (en) | Method and apparatus for machine video encoding | |
US11961267B2 (en) | Color conversion between color spaces using reduced dimension embeddings | |
Xu et al. | EPES: Point cloud quality modeling using elastic potential energy similarity | |
JP2023059231A (en) | Key point detection and model training method, apparatus, device, and storage medium | |
TWI769603B (en) | Image processing method and computer readable medium thereof | |
KR100912125B1 (en) | System and method for evaluating and certifying image identifier | |
CN117173609A (en) | Multi-scale feature and channel attention-based reference-free screen video quality evaluation method and device | |
TWI552580B (en) | Method of image compression | |
CN114630139A (en) | Quality evaluation method of live video and related equipment thereof | |
WO2021037174A1 (en) | Neural network model training method and apparatus | |
JP6961527B2 (en) | Information processing equipment, learning methods, and programs | |
JP2020507150A (en) | Method and apparatus for color similarity evaluation | |
TWI522631B (en) | Semiconductor device test system and method for accelerating image processing thereof | |
Xia et al. | GAN-based image compression with improved RDO process | |
CN106791801A (en) | The quality evaluating method and system of a kind of 3-D view | |
CN112966230A (en) | Information steganography and extraction method, device and equipment | |
TW201703520A (en) | The method of image compression | |
US11082473B1 (en) | Method for complexity reduction in video coding by coding parameters reuse | |
Dornier et al. | Improving self-supervised 3D face reconstruction with few-shot transfer learning |