close all;
clear clc;

IMG = imread("AlfredoBorba_TuscanLandscape.jpg");
I = imresize(IMG, 0.1);
gray_I = rgb2gray(I);
double_I = im2double(I);


formatSpec1 = 'Size of the image: %d x %d x %d \n';
formatSpec2 = 'Type of the data in the image matrix: uint8: %2u, double: %2u \n';
formatSpec3 = 'Extrema: min= %2u, max= %2u \n';

fprintf(formatSpec1, size(I,1), size(I,2), size(I,3));
fprintf(formatSpec2, isa(I, 'uint8'), isa(I, 'double'));
fprintf(formatSpec3, min(I(:)), max(I(:)));

fprintf(formatSpec1, size(gray_I,1), size(gray_I,2), size(gray_I,3));
fprintf(formatSpec2, isa(gray_I, 'uint8'), isa(gray_I, 'double'));
fprintf(formatSpec3, min(gray_I(:)), max(gray_I(:)));

fprintf(formatSpec1, size(double_I,1), size(double_I,2), size(double_I,3));
fprintf(formatSpec2, isa(double_I, 'uint8'), isa(double_I, 'double'));
fprintf(formatSpec3, min(double_I(:)), max(double_I(:)));

figure();

subplot(2,3,1);
imshow(I);
title('original, color');
subplot(2,3,2);
imshow(gray_I);
title('gray with rgb2gray');
subplot(2,3,3);
imshow(double_I);
title('color with im2double');

subplot(2,3,4);
hold on;
plot(28:48, I(26, 28:48, 1), '-r');
plot(28:48, I(26, 28:48, 2), '-g');
plot(28:48, I(26, 28:48, 3), '-b');
title('pixel channel-intensity values in the 26th row');

subplot(2,3,5);
plot(28:48, gray_I(26, 28:48), '-k');
title('pixel intensity values in the 26th row');

subplot(2,3,6);
hold on;
plot(28:48, double_I(26, 28:48, 1), '-r');
plot(28:48, double_I(26, 28:48, 2), '-g');
plot(28:48, double_I(26, 28:48, 3), '-b');
title('pixel channel-intensity values in the 26th row');





