Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Two dimensional true wavelet compression
1.
2. • Starting from a given image, the goal of the
true compression is to minimize the length of
the sequence of bits needed to represent it,
while preserving information of acceptable
quality. Wavelets contribute to effective
solutions for this problem.
3. • In this section, you'll learn to
• Compress using global thresholding and
Huffman encoding
• Uncompress
• Compress using progressive methods
• Handle truecolor images
4. • Compression by Global Thresholding and
Huffman Encoding
• First load and display the grayscale image mask.
• load mask;
• image(X) axis square;
• colormap(pink(255))
• title('Original Image: mask')
5. wcompress
• %--------------------------------------------------------------
• % Compression and uncompression of a truecolor image
• % and computed MSE and PSNR error values.
• % Compression parameters are the same as those used for example 3,
• % but using the 'spiht_3d' method give better performance yet.
• %--------------------------------------------------------------
• X = imread('wpeppers.jpg');
• [cr,bpp] = wcompress('c',X,'wpeppers.wtc','spiht','maxloop',12)
• Xc = wcompress('u','wpeppers.wtc');
• delete('wpeppers.wtc')
• D = abs(double(X)-double(Xc)).^2;
• mse = sum(D(:))/numel(X)
• psnr = 10*log10(255*255/mse)
• % Display the original and the compressed image
• subplot(1,2,1); image(X); title('Original image'); axis square
• subplot(1,2,2); image(Xc); title('Compressed image'); axis square