%% --------------- 1. rész ---------------
% > loads the image 
% > check whether is it color 
% > calls your function 
% > displays the result with the original image

im = imread('market.jpg');
if (size(im,3) ~= 3)
    error('Given image is not an rgb picture!')
end

figure(1)
subplot(1,2,1)
imshow(im)
title('Original image')

subplot(1,2,2)
imshow(k_mean_clustering(im, 30))
title('Clustered image (k=30)')

%% --------------- 2. rész ---------------
% Extend your script with a new call of your original function, but with k=6. What happens?

figure(2)
subplot(1,2,1)
imshow(im)
title('Original image')

subplot(1,2,2)
imshow(k_mean_clustering(im, 6))
title('Clustered image (k=6)')

%% --------------- 3. rész ---------------
% Create a new function (a slightly-different version of your original function): 
% in this version please do the clustering on the basis of the RGB channels only.

figure(3)
subplot(1,2,1)
imshow(im)
title('Original image')

subplot(1,2,2)
imshow(k_mean_clustering_rgb(im, 6))
title('Clustered image (rgb only)')