How to convert 2D image into matrix 3D ? ?

Hi everyone, I have a duty from my lecturer before the 25th of August 2017 about image compression. I am assigned to make compression image analysis with three methods (Wavelet haar, Huffman coding, and Run Length Encoding) at once in a single runing compression program. I am given the pseudocode logic flow as a hint for the compression process, which I inserted in the notepad file. The image I have is a color image with dimensions of 1285 x 720. Please help me to complete my task. Thank you in advance.

Réponses (1)

Walter Roberson
Walter Roberson le 22 Août 2017
color images are already 3D arrays when they are read in.
The exception to this is "pseudocolor images" (.gif are sometimes pseudocolor), which which case you get a 2D array and a colormap:
[image_data, color_map] = imread('TheFileNameGoesHere');
if ~isempty(color_map)
image_data = ind2rgb(image_data, color_map);
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by