An Image (And Possible Other) Compression Algorithm
Dear all,
I think I have discovered a new, EXTREMELY efficient compression algorithm. Does it work?
Here it is:
Since any combo of sine/cosine waves can be represented by 8 numbers (2 * [amplitude, frequency, horizontal shift, and vertical shift]), and assuming that we have n colors (like RGB or ARGB), then an entire picture can be represented by its size and the best fitting curve to the color levels of all the pixels. Does this work? If it does, it would DRAMATICALLY decrease the file size.
[509 byte] By [
wfunction] at [2007-11-20 9:53:22]

# 1 Re: An Image (And Possible Other) Compression Algorithm
In the rebuilding process, how would you make sure the exact colors are placed back into their correct pixel locations? And would this gaurantee that pictures that would have equal colors, size, but differing shapes would be considered different? Maybe I'm misunderstanding your idea.
# 3 Re: An Image (And Possible Other) Compression Algorithm
I have no idea how JPEG works.. :D
I just thought this idea might work.
Basically, you put all the pixels in the image into a stream of data (like a bitmap), then, for each byte value between 0 and 255, you "draw the graph" of pixel x with value y (0-255) for each color (RGB). If the image is w by h, then x would go from 0 to w*h.
I have not learned regression yet, but I think that there has to be a sum of sine/cosine waves that could be fit to the data. So does it work?
# 4 Re: An Image (And Possible Other) Compression Algorithm
JPEG ( http://en.wikipedia.org/wiki/JPEG) does something similar. It basically breaks the image up into blocks, then applies a DCT on each block. In other words, converting the data into the frequency domain (something like what you're suggesting).
Viggy
# 5 Re: An Image (And Possible Other) Compression Algorithm
Thanks a lot for the information.
(Funny, thinking I discovered something new! :))
What I don't get (I haven't read the article yet) is why a JPEG file should then be anywhere near 1 MB - by fitting the curve, with a fixed decimal precision per number, it should be around a few KB. Why is that? Of course, I guess I shouldn't expect to learn it all now, but I'm curious.
Thanks a lot!
# 7 Re: An Image (And Possible Other) Compression Algorithm
What I don't get (I haven't read the article yet) is why a JPEG file should then be anywhere near 1 MB - by fitting the curve, with a fixed decimal precision per number, it should be around a few KB. Why is that?As the number of pixels in your sample increases then so does the number of frequencies that you are required to keep coefficients for. What you are describing is a translation from the spacial domain to a frequency domain. That in itself does not reduce the data size require to store the image. All you've done is to represent N pixels as N frequency coefficients. Data reduction is achieved by selectively throwing away or quantatising the higher frequency components therefore allowing you to apply other data compression techniques to reduce the data size.