简体   繁体   English

是否有一种算法可以压缩相差不大的多个图像?

[英]Is there an algorithm to compress multiple images that are not much different apart?

I have a set of 100+ images that only differ a few pixels. 我有一组100幅以上的图像,仅相差几个像素。 They also don't have many different colors. 它们也没有很多不同的颜色。 Is there a way to compress them together by taking advantage of that? 有没有办法利用它们将它们压缩在一起?

There's an algorithm: calculate the difference of each image to some reference image. 有一种算法:计算每个图像与某个参考图像的差异。 Is there a ready made application? 是否有现成的应用程序? Probably not. 可能不是。 One approach could be to combine the images to a very big image (by interleaving or placing them next to each other) and using png. 一种方法是将图像组合成非常大的图像(通过将它们交错或彼此相邻放置)并使用png。

If this is for archiving purpose and you don't need a random access to them, you can concatenate them to zip / tar (with zero compression) and compress the whole thing. 如果这是出于存档目的,并且您不需要随机访问它们,则可以将它们连接到zip / tar(零压缩)并压缩整个内容。 .bz2 algorithm (Burrows-Wheeler Transform) is able to search for similarities over much larger window than deflate of png. .bz2算法(Burrows-Wheeler变换)能够在比png缩小时大得多的窗口中搜索相似性。 It's an order of ten megabytes vs. 10 kilobytes. 这是10兆字节对10 kb的数量级。 If the images are large enough, the window size will limit the compression in both algorithms -- that would have to be combat by interleaving or delta compressing between each image. 如果图像足够大,则窗口大小将限制两种算法的压缩-这必须通过在每个图像之间进行交错或增量压缩来解决。

The delta compression is utilized regularly in some video compressing applications and eg screen capture and virtual desktop applications where lossless compression is required. 在某些视频压缩应用程序中,例如需要无损压缩的屏幕捕获和虚拟桌面应用程序中,经常使用增量压缩。

String them together as a movie and use video compression. 将它们像电影一样串在一起,然后使用视频压缩。 That is exactly what video compression does. 这正是视频压缩的作用。

Nothing ready-made. 没有现成的东西。 If you want lossless compression, you could store just a reference image and the delta images (difference of images at the pixel leve), each one encoded with PNG. 如果要进行无损压缩,则可以仅存储参考图像和增量图像(像素水平的图像差异),每个图像均使用PNG编码。 But you must write yourself the delta transformation. 但是您必须自己编写增量转换。

You could also take advantage of the delta compression mode of the MNG format, an extension to PNG for animation (each of your image would be an animation frame). 您还可以利用MNG格式的增量压缩模式,这是PNG动画的扩展(每个图像都是一个动画帧)。 But the format is not widely supported. 但是该格式并未得到广泛支持。

You could also take the same approach (one image = one video frame) and use any standard video format (MPEG) but this would be lossy. 您也可以采用相同的方法(一个图像=一个视频帧),并使用任何标准的视频格式(MPEG),但这会造成损失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM