SVD Image Compression
dmicz.github.io
dmicz.github.io
I think for a fair comparison for any actual compression you'd need to consider the effects of quantization of the SVD output itself (in say the rows/columns of U,V alone, since you can keep the singular values at high-precision w/o appreciable cost). [I'd guess they'd be ok for 2 bytes/element, but 1 byte might be a problem].
[0] Said code comment is "# Plotting the principal components".
[1] https://en.wikipedia.org/wiki/Principal_component_analysis
One small quibble, with JPEG you don’t “lose” the “high-frequency” data; that would blur the image. You approximate it, so you could argue you “lose” some of it. JPEG is not very good at compressing high-frequency data, which is basically the edges of things, so if your JPEG has sharp edges, you are not losing much high-frequency data, just compressing everything else.
Personally I think that innovation in explanation/illustration of abstract mathematical topics is one of the most valuable kinds of progress, but it’s rarely talked about as such. When someone comes up with the right framework, visualisation, or metaphor for explaining a complex and abstract subject in a way that induces “the right” mental model, and this new teaching “tool” proliferates, that is just a beautiful thing to see.
To go from JPEG to lossy WebP (really, VP8 intra frames), the main differences are
(a) using smaller (4x4) transform blocks instead of 8x8,
(b) noticing that if you take just the first coefficient in each block, it looks like a lower resolution of the original image, and applying another 4x4 transform to those coefficients,
(c) adding more sophisticated prediction between blocks (e.g., subtract the pixel on the right edge of the previous block from all the pixels in the same row of the current block before transforming them, or something similar to predict in other directions),
(d) filtering along block edges to reduce blocking artifacts (many JPEG decoders do this, but WebP/VP8 make it a mandatory part of the standard), and
(e) using arithmetic coding instead of Huffman coding.
There are of course other minor differences in the details.
But the main mechanism that underlies both is a transform that can be derived from the SVD if one assumes a simple statistical model of natural image data.
Those are some very interesting comments!
I'd be interested (and this is purely "academic" curiousity) IF there was:
Something mathematical -- which would underly all image compression algorithms; that is, if all image compression algorithms could be shown ("proven" I guess -- I am not a professional Mathematician, only armchair, so bear with me!) to belong to a specific class of generalized compression algorithms or (ideally!) a single "parent" (for lack of a better word) image compression algorithm -- that would give rise to all other image compression algorithms, no matter how diverse or not mathematically related they would all seem...
The use of Matrices (which model systems of linear equations, which in turn, enumerate/list/make clear/table -- relationships between factors in those equations) -- would seems to be a good starting point for this Mathematical inquiry, should it be made...
Maybe I should phrase this a little bit better...
Maybe it's something like (as a future goal for the Mathematicians of the world), "for every image compression algorithm X, show/prove that X is related to <parent Mathematical principle involving matrices>"...
Or something like that...
Sort of like a grand unifying theory of image compression...
Anyway, your comments are highly interesting.
It seems like you might be part of the way there for something like a rigorously mathematically unified (and proven!) future understanding of image compression!
1. Use a reversible linear transform to transform the image into some other space. (It'll still require the same amount of data to represent) 2. Throw away a bunch of the values (set them to zero, or round them to low precision, etc) 3. Now that there are some repetitive zeroes or whatever, a conventional data compression algorithm (like LZW, Huffman, or interval/arithmetic) can make it smaller
Even simple things like resizing an image smaller can be fit into this framework: step 1 is a simple blur, step 2 sets a bunch of pixels to zero, step 3 discards them.
(I don't think fractal compression can be fit into this framework, but I could be wrong. That's the only exception I can think of offhand.)
The special thing that image compression gets to rely on is that human vision is inherently lossy, so we can crush color spaces, or throw away tiny details, or even clone regions wholesale (JBIG2, anyone?). And unless you're looking very closely, you probably won't notice a thing.
[0] See: typical sets. https://en.wikipedia.org/wiki/Typical_set
See https://ieeexplore.ieee.org/abstract/document/660992 for the connection between fractal image coding and wavelets + vector quantization.
Thank you very much!
Let's just transcribe the name of this paper here on HN (should links be broken in the future), for posterity:
"A Wavelet-Based Analysis of Fractal Image Compression" by Geoffrey M. Davis, 1997, IEEE Transactions On Image Processing Vol. 7 Issue 2.
Incidentally, I found a non-paywalled version:
There is a difference, a huge difference, between implying and searching for.
I search for things, in the above case, a mathematical (or algorithmic) theory or theories which could link disparate compression algorithms to a common ancestor or universal pattern -- because if one exists, and if it could be found -- it would greatly enhance humanity's understanding of all of the subcases that emanate from that universal pattern.
That is, it would greatly enhance humanity's understanding of all compression algorithms, and why specifically, WHY specifically -- they work...
That would be useful knowledge to have.
Especially since Cable TV, Video Streaming, The Internet and many other technologies -- all usually use different forms of compression...
The modern world is based on such things as: Electricity, Radio, Signals, Computers, Algorithms, Digital Data -- and compression usually plays a large associated role in those technologies...
So I search for a unified understanding of compression, in the above case, specifially that related to Images, but more generally with respect to any form of compression, that is:
What are the mathematical roots of Compression; what is the mathematical origin of Compression?
That's what I search for...