0

I'm new to Matlab and image analysis and I'm working on image compression and decompression.

I'm trying to write a program that will be compressing and decompressing images in Matlab. Would you be able to show me a code example?

Jordan K
  • 37
  • 5
  • Take a look at [this](https://stackoverflow.com/questions/13614886/using-svd-to-compress-an-image-in-matlab) to see how singular value decomposition can be used to compress images. – Savithru Dec 08 '18 at 17:34
  • Thank you. I've mostly read about DCT while doing my research on this. Would you be able to guide me to a DCT sample? – Jordan K Dec 08 '18 at 17:41
  • [This page](https://www.mathworks.com/help/images/discrete-cosine-transform.html) shows how the discrete cosine transform can be used for image compression. – Savithru Dec 08 '18 at 17:42
  • I'm fairly sure the DCT does a [lossy compression](https://en.wikipedia.org/wiki/Lossy_compression), which means that information is lost during the compression, and therefore the original image cannot be recovered. [Lossless compression](https://en.wikipedia.org/wiki/Lossless_compression) algorithms do exist, but their details are beyond my knowledge. – Savithru Dec 08 '18 at 18:11
  • Thanks for that. The example code doesn't run for specific images. Could it be because the vertical resolution of the images I try isn't divisible by 8? – Jordan K Dec 08 '18 at 18:55
  • Yes, that's probably correct. The easiest solution would be to increase the size of the input image to the next biggest multiple of 8, by repeating the last row and/or column of pixels. You can then remove those additional pixels after the decompression is done. – Savithru Dec 08 '18 at 19:08

0 Answers0