Semester assignments for the course "Digital Image Processing" of THMMY in AUTH university.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.4 KiB

clear
clear all
% For reproducibility
rng(1);
load('dip_hw_2.mat');
%% Produces the affinity graphs for both images
graph1 = Image2Graph(d2a);
graph2 = Image2Graph(d2b);
%% Executes non recursive experiments for the first image
figure();
imshow(d2a);
clusters = myNCuts(graph1, 2);
clusters = clusters ./ 2;
clusters = reshape(clusters, size(d2a, 1), []);
figure();
imshow(clusters);
clusters = myNCuts(graph1, 3);
clusters = clusters ./ 3;
clusters = reshape(clusters, size(d2a, 1), []);
figure();
imshow(clusters);
clusters = myNCuts(graph1, 4);
clusters = clusters ./ 4;
clusters = reshape(clusters, size(d2a, 1), []);
figure();
imshow(clusters);
%% Executes non recursive experiments for the second image
figure();
imshow(d2b);
clusters = myNCuts(graph2, 2);
figure();
imshow(meanClustersColorRGB(d2b, reshape(clusters, size(d2b, 1), [])));
% clusters = clusters ./ 2;
% clusters = reshape(clusters, size(d2a, 1), []);
% figure();
% imshow(clusters);
clusters = myNCuts(graph2, 3);
figure();
imshow(meanClustersColorRGB(d2b, reshape(clusters, size(d2b, 1), [])));
% clusters = clusters ./ 3;
% clusters = reshape(clusters, size(d2a, 1), []);
% figure();
% imshow(clusters);
clusters = myNCuts(graph2, 4);
figure();
imshow(meanClustersColorRGB(d2b, reshape(clusters, size(d2b, 1), [])));
% clusters = clusters ./ 4;
% clusters = reshape(clusters, size(d2a, 1), []);
% figure();
% imshow(clusters);