diff --git a/TP_maillage.m b/TP_maillage.m index 29a2172..1f44064 100644 --- a/TP_maillage.m +++ b/TP_maillage.m @@ -53,12 +53,14 @@ q_max = 5; ind_img = 1; figure(1); -imshow(im(:, :, :, ind_img)); title("Image " + num2str(ind_img)); +imshow(im(:, :, :, ind_img)); +title("Image " + num2str(ind_img)); %% Calculs des superpixels figure(2); -imshow(im(:, :, :, ind_img)); title("Image " + num2str(ind_img)); +imshow(im(:, :, :, ind_img)); +title("Image " + num2str(ind_img)); hold on; [germes, image_labelise, E] = super_pixel(im(:, :, :, ind_img), K, m, n, seuil_E, q_max); @@ -68,6 +70,8 @@ figure(3); R = germes(:, 3); B = germes(:, 5); scatter(R, B); +xlabel("rouge"); +ylabel("bleu"); hold on % définition des coefficients de la droite pour le seuillage @@ -90,6 +94,7 @@ bw_img = reshape(germes(image_labelise, 6), size(im, 1), []); % affichage de l'image binarisée nexttile; imshow(bw_img); +title("binarisation"); % calcul de la plus grande zone convexe blanche CC = bwconncomp(bw_img, 4); @@ -99,6 +104,7 @@ bw_img(CC.PixelIdxList{1}) = 1; % affichage de la plus grande zone convexe blanche nexttile; imshow(bw_img); +title("convexité blanche"); % calcul des zones convexes noires bw_img = ~bw_img; @@ -112,11 +118,13 @@ bw_img = ~bw_img; % suppressions des zones convexes noires nexttile; imshow(bw_img); +title("convexité noire"); % affichage du masque binaire fourni sur Moodle bw_img = im_mask(:, :, ind_img); nexttile; imshow(bw_img); +title("masque Moodle"); %% Squeletisation de l'image @@ -127,6 +135,7 @@ tiledlayout(2, 2, 'Padding', 'none', 'TileSpacing', 'compact'); nexttile; imshow(bw_img); hold on +title("contour + voronoi"); % affichage du contour de la binarisation pixel_b = find(bw_img == 1); @@ -152,6 +161,7 @@ nexttile; imshow(bw_img); hold on plot(vy, vx, 'b'); +title("voronoi visible dans l'image"); % selection des segments avec les extremités dans la forme ind1 = sub2ind(size(bw_img), vx(1, :), vy(1, :)); @@ -168,6 +178,7 @@ vy = vy(:, ok); nexttile; imshow(bw_img); hold on +title("voronoi dans le masque"); % mise en forme de vx et vy pour les prochains calculs vx_ = vx'; @@ -217,6 +228,7 @@ hold on vx_vy = [vy(1, :) vy(2, :); vx(1, :) vx(2, :)]'; viscircles(vx_vy(1:T:end, :), R(1:T:end), 'Color', [0 1 0 0.3]); plot(vy, vx, 'b'); +title("filtrage SAT"); %% Reconstruction des points 3D diff --git a/super_pixel.m b/super_pixel.m index a2adac0..51d326a 100644 --- a/super_pixel.m +++ b/super_pixel.m @@ -118,6 +118,7 @@ function [germes, img_labelise, E] = super_pixel(img, K, m, n, seuil_E, q_max) image(img_labelise * 255 / length(germes)); colormap hsv; drawnow nocallbacks + title("itération " + num2str(q) + "/" + num2str(q_max)); old_germes = germes;