1249290 九、發明說明: 【發明所屬之技術領域】 本發明是有關於一種數位影像壓縮編碼方法,且特別是 包含了無失真和近無失真壓縮編碼方法。 【先前技術】 隨著電子以及資訊技術的進步,在電腦或各式各樣之電 子裝置上處理以及顯示影像的技術發展也越來越普遍。早期 之電子寅訊技術只能儲存或處理較低畫素之數位影像。然 而’人們對尚品質影像的需求越來越多,如何處理以及儲存 高品質影像也成為非常熱門的重點。高品質影像通常需要儲 存較高的畫素,對於計算機之運算速度以及儲存媒體之容量 也形成一大挑戰。所以,現行的技術利用壓縮以及編碼的技 術來利用最小的運算量以及最小的空間以達到相對高品質 的影像。 影像之壓縮可以分為無失真以及失真壓縮兩大類。在無 失真壓縮演算法中,JPEG-LS是利用預測和前文模式 (context modeling)來達到較好的壓縮比,可是前文模式的使 用,使得整體的運算量和記憶體需求上升。 除此之外,壓縮比相同或相近的影像,利用人類視覺來 直接判斷,影像品質給人的感覺經常會差很多。過去技術可 月色具有賴南的壓縮比,但是其影像品質相對而言不一定那麼 傑出。因此’如何設計一種壓縮編碼演算法,能夠兼顧低運 算複雜度以及高視覺品質,是工業界相當需要的。 1249290 【發明内容】 、因此^發明的目的就是在提供一種無失真壓縮編碼方 法,其計算複雜度和空間複雜度皆比JPEG-LS低。 本1月的另一目的是在提供一種近無失真壓縮編碼方 法,在視覺效果上比:PEG_LS的近無失真效果佳。 本^明❺X -目#是在提供一種近無&真壓縮編碼方 法’使用多個量化步階來維持良好視覺效果。 本發明的又一目的是在提供一種無失真壓縮編碼方法 以及一種近無失真壓縮編碼方法,可以提供高品質之醫學影 像。 〜 根據本發明之上述目的,提出一種無失真壓縮編碼方法 供壓縮一數位影像。此數位影像包括複數個像素,每個像素 以一數值表示。依照本發明一較佳實施例,以數位影像其中 一像素X而言,在無失真壓縮方面是針對影像中邊(以狀)的 特性分成5種模式來做預測,其中包含規律模式(regular mode)、水平邊緣模式(horizontal edge mode)、垂直邊緣模式 (horizontal edge mode)、對角邊緣模式(diagonal edge mode) 和無邊緣模式(non-edge mode)。依照上述5種方法分類之後 再進一步決定X以及X之預測值之間的差值ε。 在編碼方面,首先進行mean=(a + b + c + d)/4之運算。 其中a為一像素數值X左方之像素之數值、b為像素數值X 上方之像素之數值、c為像素數值X左上方之像素之數值且 d為像素數值X右上方之像素之數值。 12492901249290 IX. Description of the Invention: [Technical Field] The present invention relates to a digital image compression coding method, and particularly to a distortionless and near distortionless compression coding method. [Prior Art] With advances in electronics and information technology, technological developments in processing and displaying images on computers or various electronic devices are becoming more and more common. Early electronic video technology only stored or processed digital pixels with lower pixels. However, 'people are increasingly demanding quality images, and how to handle and store high-quality images has become a hot topic. High-quality images often require higher pixel counts, which also poses a challenge to the speed of the computer and the capacity of the storage medium. Therefore, current techniques utilize compression and coding techniques to achieve relatively high quality images with minimal computational effort and minimal space. Image compression can be divided into two categories: no distortion and distortion compression. In the distortion-free compression algorithm, JPEG-LS uses prediction and context modeling to achieve a better compression ratio, but the use of the previous mode makes the overall computational load and memory requirements increase. In addition, images with the same or similar compression are directly judged by human vision, and the image quality often feels a lot worse. In the past, the moonlight has a compression ratio of Lai Nan, but its image quality is not necessarily so outstanding. Therefore, how to design a compression coding algorithm that combines low computational complexity and high visual quality is quite needed in the industry. 1249290 [Invention] Therefore, the object of the invention is to provide a distortionless compression coding method, which has lower computational complexity and space complexity than JPEG-LS. Another purpose of this January is to provide a near-distortion-free compression coding method that is less visually effective than PEG_LS. This ^明❺X-目# is to provide a near-no & true compression coding method using multiple quantization steps to maintain good visual effects. It is still another object of the present invention to provide a distortionless compression coding method and a near distortionless compression coding method which can provide a high quality medical image. According to the above object of the present invention, a distortionless compression coding method is proposed for compressing a digital image. This digital image includes a plurality of pixels, each of which is represented by a numerical value. According to a preferred embodiment of the present invention, in the case of a pixel X of a digital image, in terms of distortion-free compression, the image is divided into five modes for the edge (in the shape of the image), and the regular mode is included. ), horizontal edge mode, horizontal edge mode, diagonal edge mode, and non-edge mode. After the classification according to the above five methods, the difference ε between the predicted values of X and X is further determined. In terms of coding, first perform the operation of mean=(a + b + c + d)/4. Where a is the value of the pixel to the left of a pixel value X, b is the value of the pixel above the pixel value X, c is the value of the pixel above the pixel value X, and d is the value of the pixel above the pixel value X. 1249290
/ 4 " = (|mean'a,+,mean'b| + |mean'C| + dD 碼利用Golomb_Rice編碼方法對數位影像編 、中G〇l〇mb_Rice、編瑪方法選用的m值為 且k的選擇符合·· 太乃 (a>Th!) k=M+l if (a>Th2 ) k= =M if (a》ThM-1 ) k= =3 (GThM) k: :1 k= 1 if else else 其中Μ為正整數,Th!、Th, Th tu上 贸& a μ 化…丁11…1、ThM為預定的臨 界值且 Th】> Th2 > ···> Thw > ThM。 e.根據本發明之目的,提出-種近無失真i縮編碼方法, 供麼縮-數位影像。此數位影像包括複數個像素,每個像素 以一數值表示。依照本發明—較佳實施例,此方法至少包括 下列步驟。首先選定該數位影像之—像素值χ。接著決定該 X是否屬於-規律模式非屬於規律模式,則決 定X是否屬於-水平邊緣模式。接著4χ非屬於水平邊緣 模式,則決^ X是否屬於-垂直邊緣模式。接著,若χ非屬 於垂直邊緣模式,則蚊X是否屬於—對㈣賴式。㈣, 若X非屬於對角邊緣模式,則將χ歸類為—無邊緣模式。 當X屬於規律模式、該水平邊緣模式或㈣直邊緣模式 其中之—時,利用—第—量化階(q職tization step size)進行 量化處理。當X屬於對角邊緣模式時,利用一第二量化階進 1249290 行量化處理。當x屬於無邊緣模式時,利用一第三量化階進 行量化處理。其中第三量化階的量化階值(stepsize)小於第一 量化階的量化階值,且第三量化階的量化階值小於第二量化 階的量化階值。 當X屬於對角邊緣模式、且第二量化階的量化階值大於 一預定臨界值時,可以利用Huffman編碼法對X進行編碼。 本發明至少具有下列優點,其中每一實施例可以具有一 個或多個優點。本發明之無失真壓縮編碼方法,其計算複雜 度和空間複雜度皆比JPEG-LS低。本發明之近無失真壓縮編 碼方法在視覺效果上比JPEG-LS的近無失真效果佳。本發明 之近無失真壓縮編碼方法使用多個量化步階來降低計算複 雜度並維持良好視覺效果。本發明之無失真壓縮編碼方法以 及近無失真壓縮編碼方法可以提供高品質之醫學影像。 【實施方式】 本發明所提出的演算法包含無失真壓縮和近無失真壓 縮,無失真壓縮部分是以DPCM為基礎,用預測方式得到誤 差影像’再將誤差影像做編碼。近無失真壓縮部分,是使用 適應性量化的方式來得到視覺效果較佳的重建影像。而近無 失真壓縮指的是,所有解碼後的灰階值與原灰階值都小於一 個預設值。 首先描述無失真壓縮。第1圖為本發明之無失真壓縮方 法的一範例流程圖。請參照第丨圖,本實施例所提出的無失 真壓縮是針對影像中邊(edge)的特性分成5種模式來做預 1249290 測’其中包含規律模式(regular mode)、水平邊緣模式 (h〇n刪al edge m°de)、垂直邊緣模式(h〇rizontal edge mode)、對角邊緣模式(diag〇nal edge m。㈣和無邊緣模式 (non-edge mode)。 在介紹模式之前,要先介紹像素方向的判斷方式。第2 圖綠示像素方向判斷之示意圖。請參照第2圖,假 在要判斷方向的像素,a,b,,和為v $ 4 / 4 不α马丫的4個相鄰的像素, 、、坐過第3圖的判斷即可得到像素乂的方向,且用d⑺來表示 y :方向。為了方便表示,在以下的文章中,χ用來表示現 正要預測的像素,以來表示χ_ χ周圍相鄰的丨1個像素,如第4圖所示。第二:::: 之像素相關位置圖。 (1) 規律模式 首b糾算“^和㈣方向㈣叫若滿足 ,)=D⑻=D⑷=D⑷,則χ即屬於規律模式(步驟1 〇4), 且 D(X) =D(a) = D(b) = d(c) = D(d),則 γ 认 π , 圖所示。 ⑷則X的預測方式如第5 換^說’在利用G—編碼方法壓縮數位影像 〈刖’決疋a、b、c、d以及古止你 及X的方向(步驟102)。當該a、b、 以及該x的方向均相同時’將X歸類為一規律棋式(牛 :1,請參照第5圖,當X的方向D(x)為右二= =為a;當X的方向D(X)為右下,則X之預測值為c;當 為ΙΓΓΧΧ)1下,則x之預測值為b; tx的方向D(X) 為左下,則X之預測值為d。接著,可以衫X以及x之預 1249290 測值之間的差值ε。X、X之預測值以及差值ε可以供之後 的編碼方法使用。 (2) 水平邊緣模式 若X不符合規律模式,則繼續測試是否滿足水平邊緣模 式(步驟106)。若X滿足(丨e-a丨$ Tnear ) π (丨b_c | ‘ Tnear) Π (|a-c| g Tfar) Π (|e-f| ^ Tfar),則 X 即被 歸類為水平邊緣模式(步驟1〇6),且其預測方式為i μ。換句 話說,若X值屬於水平邊緣模式,將χ之預測值設為a(步驟 108)。其中Tnear以及Tfar為預定之數值。接著,決定X以 及X之預測值之間的差值ε (步驟11〇)。 (3) 垂直邊緣模式 右入不符合以上模式 ,/it 一,〜ΰ挪疋茔直遭緣指 =驟叫若X滿足㈣$ Tnea〇n(丨f_ehT丽 直邊Γΐΐ Ha0 ^ (Μ ^ Tfar),則X即被歸類為連 邊式(步驟112)’且其預測方式為〜驟叫招 MX以及X之預測值之間的差值e(步驟㈣卜 ()對角邊緣模式 *右X不符合規律模式、水平邊緣模式和 二繼續測試是否滿足對角邊緣模式(步驟 ’ 或 |b_a|>Th2,則 χ 二右 X 滿足 驟116)。 貝馮對角邊緣模式(步 3類,如第6圖 nH 3, 4。/ 4 " = (|mean'a,+,mean'b| + |mean'C| + dD code uses the Golomb_Rice encoding method to encode the digital image, the G value of the G〇l〇mb_Rice, and the encoding method And the choice of k is in accordance with ·· too (a>Th!) k=M+l if (a>Th2) k= =M if (a)ThM-1 ) k= =3 (GThM) k: :1 k = 1 if else else where Μ is a positive integer, Th!, Th, Th tu trade & a μ... D11...1, ThM is a predetermined threshold and Th]> Th2 >···> Thw > ThM. e. According to the purpose of the present invention, a near-distortion-free encoding method is provided for a digital-digital image. The digital image includes a plurality of pixels, each pixel being represented by a numerical value. - In a preferred embodiment, the method comprises at least the following steps: first selecting the pixel value 该 of the digital image. Then determining whether the X belongs to the - regular mode is not a regular mode, then determining whether X belongs to the - horizontal edge mode. If it is not in the horizontal edge mode, then whether X is in the - vertical edge mode. Then, if it is not in the vertical edge mode, then whether the mosquito X belongs to - (4) Lai. (4) If X is not in the diagonal edge mode, then χ is classified as - no edge mode. When X belongs to the regular mode, the horizontal edge mode or the (four) straight edge mode, the -first quantization step (q job) Tization step size) performs quantization processing. When X belongs to the diagonal edge mode, a quantization process is performed by using a second quantization step 1249290. When x belongs to the edgeless mode, quantization processing is performed by using a third quantization step. The quantization step of the quantization step is smaller than the quantization step of the first quantization step, and the quantization step of the third quantization step is smaller than the quantization step of the second quantization step. When X belongs to the diagonal edge mode and the second quantization When the quantization step of the order is greater than a predetermined threshold, X can be encoded by Huffman coding. The present invention has at least the following advantages, wherein each embodiment may have one or more advantages. The distortion-free compression coding method of the present invention The computational complexity and spatial complexity are lower than JPEG-LS. The near-distortionless compression coding method of the present invention has better visual effect than JPEG-LS. The near distortionless compression coding method uses multiple quantization steps to reduce computational complexity and maintain good visual effects. The distortionless compression coding method and the near distortionless compression coding method of the present invention can provide high quality medical images. The proposed algorithm includes distortionless compression and near distortionless compression. The distortionless compression part is based on DPCM, and the error image is obtained by prediction mode, and then the error image is encoded. The near-distortion-free compression section uses an adaptive quantization method to obtain a reconstructed image with better visual effects. Near-distortionless compression means that all decoded grayscale values and original grayscale values are less than a preset value. First, the distortion-free compression will be described. Figure 1 is a flow chart showing an example of a distortionless compression method of the present invention. Referring to the figure, the distortion-free compression proposed in this embodiment is divided into five modes for the characteristics of the edge in the image to perform the pre-1249290 measurement, which includes the regular mode and the horizontal edge mode (h〇). n delete al edge m°de), vertical edge mode (h〇rizontal edge mode), diagonal edge mode (diag〇nal edge m. (4) and non-edge mode. Before introducing the mode, first This section describes the judgment of the pixel direction. Figure 2 shows the green pixel direction judgment. Please refer to Figure 2, if you want to judge the direction of the pixel, a, b,, and v $ 4 / 4 The adjacent pixels, and the judgment of Figure 3 can be used to obtain the direction of the pixel ,, and d(7) is used to represent the y: direction. For convenience of representation, in the following article, χ is used to indicate that it is now forecasting The pixel has been represented by 丨 1 pixel adjacent to χ _ ,, as shown in Fig. 4. The pixel-related position map of the second:::: (1) The regular pattern first b corrects the "^ and (four) directions (four) If it is satisfied,) = D (8) = D (4) = D (4), then χ belongs to the regular pattern (step 1 〇 4) , and D(X) = D(a) = D(b) = d(c) = D(d), then γ is recognized as π, as shown in the figure. (4) Then the prediction method of X is as follows: The G-encoding method is used to compress the digital image <刖' to determine a, b, c, d and the direction of you and X (step 102). When the directions of a, b, and x are the same, 'X Classified as a regular chess (Niu: 1, please refer to Figure 5, when the direction of X D (x) is right two = = a; when the direction of X D (X) is the lower right, then the prediction of X The value is c; when ΙΓΓΧΧ)1, the predicted value of x is b; the direction D(X) of tx is the lower left, then the predicted value of X is d. Then, the value of X and x 1249290 can be measured. The difference ε between X and X and the difference ε can be used for the subsequent encoding method. (2) Horizontal edge mode If X does not conform to the regular mode, it continues to test whether the horizontal edge mode is satisfied (step 106). If X satisfies (丨ea丨$ Tnear ) π (丨b_c | ' Tnear) Π (|ac| g Tfar) Π (|ef| ^ Tfar), then X is classified as horizontal edge mode (steps 1〇6) ), and its prediction mode is i μ. In other words, if the X value belongs to the horizontal edge mode, The predicted value of χ is set to a (step 108), where Tnear and Tfar are predetermined values. Next, the difference ε between the predicted values of X and X is determined (step 11 〇). (3) Vertical edge mode right input Does not meet the above pattern, /it one, ~ ΰ 疋茔 遭 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = It is a flank (step 112)' and its prediction mode is the difference e between the predicted values of MX and X. (Step (4) Bu () diagonal edge mode * Right X does not conform to the regular pattern, horizontal edge Mode and 2 continue to test whether the diagonal edge mode is satisfied (step ' or |b_a|>Th2, then 右2 right X satisfies step 116). Bevon's diagonal edge mode (step 3, as shown in Figure 6 nH 3, 4.
在對角邊緣模式中,對角的方向被分為 不。X是屬於哪一種對角方向定義如下’’’’· Stepl:計算 〇1,〇2,03 和 〇4 · 1249290 弟7圖綠示〇 1,02,03和〇4之計算方式。 L ():水平方向誤差的和。 2· 02 (\) ·· -45°方向誤差的和。 3· 03 ():垂直方向誤差的和。 4· 〇4 (/) ·· β方向誤差的和。 steP2:藉由〇1,〇2,〇3和〇4來判斷χ是哪一種角方 向,其判斷方式如第8圖所示。第8圖繪示對角 邊緣模式之範例流程圖。 (5)無邊緣模式 若X都不符合以上模式’則用第9圖來得到乂的預測值。 第9圖繪示無邊緣模式之預測方式。 當X的方向非規律模式、非水平邊緣模式時、非垂直邊 緣模式時、也非對角邊緣模式時,則將χ歸類為無邊緣模式 (步驟118)。利用X之預測值二^:^決定該χ之預測值。 接著,利用G〇l〇mb-Rice編碼方法壓縮數位影像之前,決定 X以及該X之預測值之間的差值ε (步驟11〇)。 以下敘述無失真壓縮編碼。無失真壓縮編碼可以選擇利 用Golomb-Rice編碼方法壓縮該數位影像。其中 Golomb-Rice編碼方法選用的m值為2的k次方,且k的選 擇符合: ' if (a^Th!) 1 else if (a^Th2 ) k=M else if (a^ThM.i ) k=3 π 1249290 else (a^ThM ) k=2 else k=i 為預定的臨界值 其中M為正整數,1%、Th2 Th ^In the diagonal edge mode, the direction of the diagonal is divided into no. X is the diagonal direction defined as follows. 'Step': Step 〇1, 〇2,03 and 〇4 · 1249290 The calculation method of the green maps 1, 02, 03 and 〇4. L (): the sum of the horizontal direction errors. 2· 02 (\) ·· -45° direction error sum. 3· 03 (): The sum of the vertical direction errors. 4· 〇4 (/) ·· The sum of the β direction errors. steP2: 〇1, 〇2, 〇3, and 〇4 determine which angular direction the χ is, and the judgment is as shown in Fig. 8. Figure 8 is a flow chart showing an example of a diagonal edge mode. (5) No edge mode If X does not meet the above mode, then use Figure 9 to get the predicted value of 乂. Figure 9 shows the prediction of the edgeless mode. When the direction of the X is irregular, the non-horizontal edge mode, the non-vertical edge mode, and the non-diagonal edge mode, the χ is classified as the edgeless mode (step 118). The predicted value of X is determined by the predicted value of X^:^. Next, before compressing the digital image by the G〇l〇mb-Rice encoding method, the difference ε between X and the predicted value of the X is determined (step 11〇). The distortionless compression coding is described below. The distortion-free compression coding can optionally compress the digital image using the Golomb-Rice coding method. The Golomb-Rice encoding method uses the m value of 2 to the power of k, and the choice of k is consistent with: ' if (a^Th!) 1 else if (a^Th2 ) k=M else if (a^ThM.i k=3 π 1249290 else (a^ThM ) k=2 else k=i is a predetermined critical value where M is a positive integer, 1%, Th2 Th ^
2··· Um-i、ThM 且 Thi > TI12 > ···> ThM-i〉ThM。 以下舉一例子說明如何實際進行k值得選擇 if (a^Th3 ) k==4 else if (a>Th4 ) k=3 else if (a>Th5 ) k==2 else k=l (Th3 >2··· Um-i, ThM and Thi > TI12 >···> ThM-i>ThM. The following example shows how to actually make k worth choosing if (a^Th3 ) k==4 else if (a>Th4 ) k=3 else if (a>Th5 ) k==2 else k=l (Th3 >
Th4>Th5) 其中Th3、 Th4和Th5是自訂的臨界值。位元串的格式 例如第10圖所示。 以下敘述近無失真壓縮方法。第u圖為本發明之近無失 真壓縮方法的範例流程圖。言青參照帛i i目,在近無失真部 分’篁化的方式是對影像使用乡個量化階(Quantizat— step size),不同區域的1化階都不同,而量化階的使用請參照第 12圖。第12圖繪示本發明之近無失真壓縮方法中量化階分 類方式之示意圖。 如第12圖所示。首先決定X是否屬於一規律模式(步驟 1202)。右X非屬於規律模式,則決定χ是否屬於—水平邊 緣_式(:㈣1204)。若X非屬於水平邊緣模式,則決定χ是 12 1249290 否屬於一垂直邊緣模式(步驟1206)。若X非屬於垂直邊緣模 式’則決定X是否屬於一對角邊緣模式(步驟12〇8)。若X非 屬於對角邊緣模式,則將X歸類為一無邊緣模式(步驟1210)。 畜X屬於規律模式、水平邊緣模式或垂直邊緣模式其中 之日$ ’利用一第一量化階(quantization step size)Ql進行量 化處理(步驟1212)。當X屬於對角邊緣模式時,利用一第二 量化階進行量化處理Q2(步驟1214)。當又屬於無邊緣模式 時,利用一第三量化階進行量化處理q3(步驟1216)。 其中第二罝化階的量化階值(step size)小於第一量化階 的篁化階值,且第三量化階的量化階值小於第二量化階的量 化階值。 第12圖之所以要使用3個量化階,是因為人眼對平滑 區域的失真較複雜區域的失真敏感,而影像令平滑的區域會 被所提出的演算法歸類在無邊緣模式中,複雜區域會歸類1 其他的邊緣模式中,尤其在對角邊緣模式中,所產生的誤差 通常比其他模式還要大。因此,用來量化無邊緣模式的卩3 就可以使用較小的量化階值,而用來量化對角邊緣模式的 就可以使用較大的量化階值,這樣的量化階設定,會使最後 的重建影像在視覺品質上有較好的結果。 以下敘述近無真壓縮編碼方法。近無真壓縮編碼部分使 用Golomb-Rice編碼法和Huffman編碼法這2種方式 13 1249290 (1) G-R編碼法 在位元串編碼部分是用’’Golomb-Rice編碼方法”,, 且所選用的m值為2的冪次方’在無失真壓縮中,k值的選 擇方式為: P(x) : Prediction of X. \P(x) - + \Ρ(χ) - 6| + \Ρ(χ) - c| + \Ρ(χ) ^ d\ " 4 ' ^ 其中Golomb-Rice編碼方法選用 ^用的m值為2的k次方 且k的選擇符合: if (a^Th!) k= :N else if (a>Th2 ) k= =N-1 else if (a2ThN-i ) k= =2 else (PThN) k -1 else 其中N為正整數 k= ,Tin、 =0 Th2-.Th 值且Thl>Th2> 、ThN為預定的臨界 子。 k==2 1 以下舉一個實際的運算例 if (α> Τ6 ) else if (α^ T7 ) 1249290 k=0 (T6>T7) 。位元串的格式如第13 else 其中Th6和Th7是自訂的臨界值 圖所示。 (2) Huffman 編碼法 當X屬於對角彡緣模式、且第二量化階的量化階值大於 預疋臨界值時,可以利用Huffman編碼法對χ進行編碼。 右S化對角邊緣模式的量化階Q2大於一個臨界值,則使用 Huffman編碼會得到較好的結果,所以若Q2>Th8(臨界值), 則使用Huffman來編碼,如第14圖所示。第14圖繪示一位 元串格式之範例。 本發明至少具有下列優點,其中每—實施例可以具有一 個或多個優點。本發明之無失真壓縮編碼方法,其計算複雜 度和空間複雜度皆比JPEG_LS低。本發明之近無失真壓縮編 碼方法在視覺效果上比JPEG_LS的近無失真效果佳。本發明 之近無失真職編财法制乡個量化步階來降低計算複 雜度並維持請視覺效果。本㈣之無失__碼方法以 及近無失真壓縮編碼方法可以提供高品f之醫學影像。 雖然本發明已以-較佳實施例揭露如上,然其並非用以 限定本發明,任何熟習此技藝者,在不脫離本發明之精神和 範圍内’當可作各種之更動與潤飾,因此本發明之保護範圍 當視後附之申請專利範圍所界定者為準。 【圖式簡單說明】 15Th4>Th5) where Th3, Th4 and Th5 are custom thresholds. The format of the bit string is shown in Figure 10. The near-distortionless compression method is described below. Figure u is an exemplary flow chart of the near-no distortion compression method of the present invention. In the near-distortion-free part, the method of using the Quantification is to use the Quantizat-step size for the image, and the different levels of the different regions are different. For the use of the quantization step, please refer to the 12th. Figure. Figure 12 is a diagram showing the quantization step classification method in the near distortionless compression method of the present invention. As shown in Figure 12. First, it is determined whether X belongs to a regular pattern (step 1202). If the right X is not in the regular pattern, it is determined whether the 属于 belongs to the horizontal edge _ ((4) 1204). If X is not in the horizontal edge mode, then it is determined that 12 1249290 belongs to a vertical edge mode (step 1206). If X is not in the vertical edge mode, then it is determined whether X belongs to the pair of corner edge modes (step 12〇8). If X is not in the diagonal edge mode, X is classified as a non-edge mode (step 1210). The animal X belongs to the regular pattern, the horizontal edge mode or the vertical edge mode, wherein the day $' is quantized by a first quantization step size Q1 (step 1212). When X belongs to the diagonal edge mode, quantization processing Q2 is performed using a second quantization step (step 1214). When it is again in the edgeless mode, the quantization process q3 is performed using a third quantization step (step 1216). The quantization step of the second quantization step is smaller than the quantization step of the first quantization step, and the quantization step of the third quantization step is smaller than the quantization step of the second quantization step. The reason why the 12th order is to use three quantization steps is because the human eye is sensitive to the distortion of the smooth region and the distortion of the complex region, and the smooth region of the image is classified by the proposed algorithm in the edgeless mode, which is complicated. Regions are classified 1 In other edge modes, especially in diagonal edge mode, the resulting error is usually larger than in other modes. Therefore, the 卩3 used to quantize the edgeless mode can use a smaller quantization step, and the quantized order can be used to quantize the diagonal edge mode. Such a quantization step setting will make the final Reconstructed images have better results in terms of visual quality. The near-true compression coding method will be described below. The near-true compression coding part uses the Golomb-Rice coding method and the Huffman coding method. 13 1249290 (1) The GR coding method uses the ''Golomb-Rice coding method' in the bit string coding part, and is selected. The m value is a power of 2'. In distortion-free compression, the value of k is chosen as: P(x) : Prediction of X. \P(x) - + \Ρ(χ) - 6| + \Ρ( χ) - c| + \Ρ(χ) ^ d\ " 4 ' ^ where the Golomb-Rice encoding method uses ^ with a m value of 2 for the power of k and the choice of k matches: if (a^Th!) k= :N else if (a>Th2 ) k= =N-1 else if (a2ThN-i ) k= =2 else (PThN) k -1 else where N is a positive integer k= , Tin, =0 Th2- .Th value and Thl>Th2>, ThN is a predetermined critical value. k==2 1 The following is an actual operation example if (α> Τ6) else if (α^ T7 ) 1249290 k=0 (T6>T7) The format of the bit string is as in the 13th Else where Th6 and Th7 are the custom threshold values. (2) Huffman coding method when X belongs to the diagonal edge mode, and the quantization step of the second quantization step is larger than the pre- When the threshold is 疋, the Huffman coding method can be used to encode χ. If the quantization step Q2 of the edge mode is greater than a critical value, the Huffman coding will get better results, so if Q2>Th8 (threshold value), use Huffman to encode, as shown in Figure 14. Figure 14 shows An example of a one-bit string format. The present invention has at least the following advantages, wherein each of the embodiments may have one or more advantages. The distortion-free compression coding method of the present invention has lower computational complexity and spatial complexity than JPEG_LS. The near-distortion-free compression coding method of the invention has better visual effect than the JPEG_LS, and has no distortion effect. The near-distortion-free code-making method of the invention has a quantization step to reduce the computational complexity and maintain the visual effect. (4) The __code method and the near-distortionless compression coding method can provide a medical image of a high quality product. Although the invention has been disclosed above in the preferred embodiment, it is not intended to limit the invention, and anyone skilled in the art The scope of the invention is defined by the scope of the appended claims, without departing from the spirit and scope of the invention. Subject to the rules. [Simplified illustration] 15