课件3:地质灾害_第1页
课件3:地质灾害_第2页
课件3:地质灾害_第3页
课件3:地质灾害_第4页
课件3:地质灾害_第5页
已阅读5页,还剩50页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、2022-3-201Chapter 9Image Compression StandardsChapter 92022-3-2029.1 The JPEG Standard*9.2 The JPEG2000 Standard*9.3 The JPEG-LS Standard*9.4 Bi-level Image Compression StandardsChapter 92022-3-2039.1 The JPEG StandardJPEG is an image compression standard that was developed by the Joint Photographic

2、 Experts Group. JPEG was formally accepted as an international standard in 1992. JPEG is a lossy image compression method. It employs a transform coding method using the DCT (Discrete Cosine Transform).Chapter 92022-3-204Observations for JPEG Image CompressionThe effectiveness of the DCT transform c

3、oding method in JPEG relies on 3 major observations:Chapter 92022-3-205much of the information in an image is repeated, hence spatial redundancy.the spatial redundancy can be reduced by largely reducing the high spatial frequency contents.chroma subsampling (4:2:0) is used in JPEG.Chapter 92022-3-20

4、6 Chapter 92022-3-2079.1.1 Main Steps in JPEG Image CompressionTransform RGB to YIQ or YUV and subsample color. DCT on image blocks. Quantization. Zig-zag ordering and run-length encoding. Entropy coding.Chapter 92022-3-208Chapter 92022-3-209Chapter 92022-3-2010DCT on image blocksEach image is divid

5、ed into 8 8 blocks. The 2D DCT is applied to each block image f(i, j), with output being the DCT coefficients F(u, v) for each block.Using blocks, however, has the effect of isolating each block from its neighboring context. This is why JPEG images look choppy (blocky) when a high compression ratio

6、is specified by the user.Chapter 92022-3-2011Chapter 92022-3-2012QuantizationChapter 92022-3-2013Chapter 92022-3-2014Chapter 92022-3-2015Chapter 92022-3-2016Chapter 92022-3-2017Chapter 92022-3-2018Chapter 92022-3-2019DPCM on DC coefficientsThe DC coefficients are coded separately from the AC ones. D

7、ifferential Pulse Code Modulation (DPCM) is the coding method.Chapter 92022-3-2020Entropy CodingChapter 92022-3-2021Chapter 92022-3-2022附图 源图像亮度数据块 738273911641567483741641651651659491911661662921101911651021119395221023029948310117584928210382108282122110292740828282108373739182829182919091JPEG编码实例

8、编码实例Chapter 92022-3-2023附图附图 量化结果量化结果 4400 1 2 100103 232 1 112 3 51100 1 3 3 3 1 101001 101001 4 11100000 111000010000000Chapter 92022-3-2024附表表Zigzag排列及行程编码与哈夫曼编码(排列及行程编码与哈夫曼编码(VLC)结果)结果 Chapter 92022-3-2025附表表 Zigzag排列及行程编码与哈夫曼编码(排列及行程编码与哈夫曼编码(VLC)结果)结果 Chapter 92022-3-2026例题2亮度子快编码设亮度子快按Z字排序的系数如

9、下: K0123 456 7 8 93031 3263系数系数12 5-20 200 0 1 0-1 01)DC系数12,落入(-15-8,815)2)Chapter 92022-3-2027例子:512,57,45,0,0,0,0,23,0,-30,-16,0,0,1,0,0,0, 0 , 0 ,0 , 0,.,0经过经过 RLC 压缩后就是压缩后就是(0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-16) ; (2,1) ; EOB由于后面由于后面 huffman 编码的要求编码的要求, 每组数字前一个每组数字前一个表示表示 0 的数量的必须是的数量的必须是

10、 4 bit,就是说就是说, 只能是只能是 015, 所以我们实际这样编码所以我们实际这样编码:(0,57) ; (15,0) (2,3) ; (4,2) ; (15,0) (15,0) (1,895) , (0,0)注意:注意:(15,0) 表示了表示了 16 个连续的个连续的 0.Chapter 92022-3-2028(0,57) ; (0,45) ; (4,23) ; (1,-30) ; (0,-8) ; (2,1) ; (0,0)只处理每对数右边的那个:57 是第 6 组的, 实际保存值为 111001 , 所以被编码为 (6,111001)45 , 同样的操作, 编码为 (6,10

11、1101)23 - (5,10111)-30 - (5,00001)-8 - (4,0111)1 - (1,1)Chapter 92022-3-2029前面的那串数字就变成了前面的那串数字就变成了:(0,6), 111001 ; (0,6), 101101 ; (4,5), 10111; (1,5), 00001; (0,4) , 0111 ;(2,1), 1 ; (0,0)那么最后对于前面的例子表示的那么最后对于前面的例子表示的 63 个系数个系数 按位按位流写入流写入 JPG 文件中就是这样的文件中就是这样的:111000 111001 111000 101101 111111111001

12、1001 10111 11111110110 00001 1011 0111 11011 1 1010Chapter 92022-3-2030DC 值的差值的差 0511编码成编码成(9, 000000000)如果如果 9 的的 Huffman 编码是编码是 1111110 , 那么在那么在 JPG 文件中文件中, DC 的的 2 进制表示为进制表示为1111110 000000000 最终最终 BIT 流如下流如下:1111110 000000000 111000 111001 111000 101101 1111111110011001 1011111111110110 00001 101

13、1 0111 11011 1 1010Chapter 92022-3-2031针对一个数据单元的图片针对一个数据单元的图片 Y 的解码的解码 在整个图片解码的开始在整个图片解码的开始, 需要先初始化需要先初始化 DC 值为值为 0.1) 先解码先解码 DC:a) 取得一个取得一个 Huffman 码码 (使用使用 Huffman DC 表表)b) Huffman解码解码, 看看后面的数据位数看看后面的数据位数 Nc) 取得取得 N 位位, 计算计算 Diff 值值d) DC + = Diffe) 写入写入 DC 值值: vector0=DC Chapter 92022-3-20322) 解码解

14、码 63 个个 AC:- 循环处理每个循环处理每个 AC 直到直到 EOB 或者处理到或者处理到 64 个个 ACa) 取得一个取得一个 Huffman 码码 (使用使用 Huffman AC 表表)b) Huffman 解码解码, 得到得到 (前面前面 0 数量数量, 组号组号) 记住记住: 如果是如果是(0,0) 就是就是 EOB 了了c) 取得取得 N 位位(组号组号) 计算计算 ACd) 写入相应数量的写入相应数量的 0e) 接下来写入接下来写入 ACChapter 92022-3-2033JPG 文件文件(Byte 级级)里怎样组织图片信息里怎样组织图片信息JPEG/JFIF 文件格

15、式使用文件格式使用 Motorola 格式格式(MSB), 而不是而不是 Intel 格式格式 JPG 文件是由一个个段文件是由一个个段 (segments) 构成的构成的. 每每个段长度个段长度 =65535. 每个段从一个标记字开始每个段从一个标记字开始. 标记字都是标记字都是 0 xff 打头的打头的, 以非以非 0 字节和字节和 0 xFF 结结束束. 例如例如 FFDA , FFC4, FFC0. 每个标记有它特定意义每个标记有它特定意义, 这是由第这是由第2字节指明的字节指明的. 例例如如, SOS (StartOf Scan = FFDA) 指明了你应该指明了你应该开始解码开始解

16、码. 另一个标记另一个标记 DQT (Define Quantization Table = 0 xFFDB) 就是说它后面就是说它后面有有 64 字节的字节的 quantization 表表Chapter 92022-3-2034几个重要的标记几个重要的标记SOI = Start Of Image = FFD8EOI = End Of Image = FFD9JPG 文件都以 FFD9 结束RSTi = FFDi ( i = 0.7) RST0 = FFD0, RST7=FFD7= 复位标记,通常穿插在数据流里(SOS - RST0 - RST1 - RST2 -.- RST6 - RST7

17、 - RST0 -.) Chapter 92022-3-2035必须处理的标记必须处理的标记 SOF0 = Start Of Frame 0 = FFC0SOS = Start Of Scan = FFDAAPP0 = its the marker used to identify a JPG file which uses the JFIFspecification = FFE0COM = Comment = FFFEDNL = Define Number of Lines = FFDCDRI = Define Restart Interval = FFDDDQT = Define Quan

18、tization Table = FFDBDHT = Define Huffman Table = FFC4Chapter 92022-3-2036Haffman 表的储存表的储存 Chapter 92022-3-2037Chapter 92022-3-2038Chapter 92022-3-2039Chapter 92022-3-2040Chapter 92022-3-2041Chapter 92022-3-2042Chapter 92022-3-2043Chapter 92022-3-2044Chapter 92022-3-20459.1.2 Four Commonly Used JPEG

19、 ModesSequential Mode | the default JPEG mode, implicitly assumed in the discussions so far. Each graylevel image or color image component is encoded in a single left-to-right, top-to-bottom scan. Progressive Mode. Hierarchical Mode. Lossless Mode-discussed in Chapter 7, to be replaced by JPEG-LS (S

20、ection 9.3).Chapter 92022-3-2046Progressive Modedelivers low quality versions of the image quickly, followed by higher quality passes.1. Spectral selection:Scan 1: Encode DC and first few AC components, e.g., AC1, AC2.Scan 2: Encode a few more AC components, e.g., AC3, AC4, AC5. . . .Scan k: Encode

21、the last few ACs, e.g., AC61, AC62, AC63.Chapter 92022-3-20472. Successive approximationnall DCT coefficients are encoded simultaneously but with their most significant bits (MSBs) first.Scan 1: Encode the first few MSBs, e.g., Bits 7, 6, 5, 4.Scan 2: Encode a few more less significant bits, e.g., B

22、it 3. . .Scan m: Encode the least significant bit (LSB), Bit 0.Progressive ModeChapter 92022-3-2048Hierarchical ModeThe encoded image at the lowest resolution is basically a compressed low-pass filtered image, whereas the images at successively higher resolutions provide additional details (differen

23、ces from the lower resolution images).Similar to Progressive JPEG, the Hierarchical JPEG images can be transmitted in multiple passes progressively improving quality.Chapter 92022-3-2049Chapter 92022-3-20509.1.3 A Glance at the JPEG BitstreamChapter 92022-3-20519.2 The JPEG2000 StandardDesign Goals:

24、nTo provide a better rate-distortion tradeoff and improved subjective image quality.nTo provide additional functionalities lacking in the current JPEG standard.The JPEG2000 standard addresses the following problems:nLossless and Lossy Compression: There is currently no standard that can provide supe

25、rior lossless compression and lossy compression in a single bitstream.Chapter 92022-3-2052problemsLow Bit-rate Compression: The current JPEG standard offers excellent rate-distortion performance in mid and high bit-rates. However, at bit-rates below 0.25 bpp, subjective distortion becomes unacceptab

26、le. This is important if we hope to receive images on our web-enabled ubiquitous devices, such as web-aware wristwatches and so on.large Images: The new standard will allow image resolutions greater than 64K by 64K without tiling. It can handle image size up toChapter 92022-3-2053problemsSingle Deco

27、mpression Architecture: The current JPEG standard has 44 modes, many of which are application specific and not used by the majority of JPEG decoders.Transmission in Noisy Environments: The new standard will provide improved error resilience for transmission in noisy environments such as wireless networks and th

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论