fix: preparation orla + cercle a patch
This commit is contained in:
parent
8cb615031e
commit
280eec61a7
|
@ -58,11 +58,10 @@ seuil_E = 10;
|
|||
q_max = 5;
|
||||
ind_img = 1;
|
||||
|
||||
figure;
|
||||
% subplot(2, 2, 1);
|
||||
figure(1);
|
||||
imshow(im(:, :, :, ind_img)); title("Image " + num2str(ind_img));
|
||||
|
||||
figure;
|
||||
figure(2);
|
||||
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);
|
||||
|
@ -84,7 +83,7 @@ hold on;
|
|||
% Binarisation de l'image à partir des superpixels %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
figure(4);
|
||||
figure(3);
|
||||
R = germes(:, 3);
|
||||
B = germes(:, 5);
|
||||
scatter(R, B);
|
||||
|
@ -100,13 +99,40 @@ germes = [germes W];
|
|||
|
||||
%%
|
||||
|
||||
figure(4);
|
||||
tiledlayout(2,2, 'Padding', 'none', 'TileSpacing', 'compact');
|
||||
|
||||
bw_img = reshape(germes(image_labelise, 6), size(im, 1), []);
|
||||
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
|
||||
CC = bwconncomp(bw_img,4);
|
||||
bw_img = zeros(size(bw_img));
|
||||
bw_img(CC.PixelIdxList{1}) = 1;
|
||||
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
|
||||
bw_img = ~bw_img;
|
||||
|
||||
CC = bwconncomp(bw_img,4);
|
||||
bw_img = zeros(size(bw_img));
|
||||
bw_img(CC.PixelIdxList{1}) = 1;
|
||||
|
||||
bw_img = ~bw_img;
|
||||
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
|
||||
figure(3);
|
||||
bw_img = im_mask(:,:,ind_img);
|
||||
|
||||
subplot(2,2,1);
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
|
||||
figure(5);
|
||||
tiledlayout(2,2, 'Padding', 'none', 'TileSpacing', 'compact');
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
hold on
|
||||
|
||||
|
@ -130,7 +156,7 @@ plot(contour(:,2), contour(:,1), 'g', 'LineWidth', 3);
|
|||
% scatter(barycentres(:,2), barycentres(:,1));
|
||||
% % triplot(r, contour(:,2), contour(:,1));
|
||||
|
||||
T = 10;
|
||||
T = 1;
|
||||
[vx, vy] = voronoi(contour(1:T:end,1), contour(1:T:end,2));
|
||||
|
||||
plot(vy, vx, 'b');
|
||||
|
@ -144,7 +170,8 @@ ok = vx(1,:) > 1 & vx(1,:) < size(bw_img, 1) & ...
|
|||
vx = floor(vx(:,ok));
|
||||
vy = floor(vy(:,ok));
|
||||
|
||||
subplot(2,2,2);
|
||||
% subplot(2,2,2);
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
hold on
|
||||
plot(vy, vx, 'b');
|
||||
|
@ -161,7 +188,8 @@ ok = ok1 & ok2;
|
|||
vx = vx(:,ok);
|
||||
vy = vy(:,ok);
|
||||
|
||||
subplot(2,2,3);
|
||||
% subplot(2,2,3);
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
hold on
|
||||
plot(vy, vx, 'b');
|
||||
|
@ -184,6 +212,8 @@ R = abs(R);
|
|||
R = min(R, [], 2);
|
||||
R = R';
|
||||
|
||||
viscircles([V_(1:10:end,2) V_(1:10:end,1)], R(1:10:end));
|
||||
|
||||
% Filtrage naif
|
||||
% truc = find(R < 20);
|
||||
% truc = mod(truc - 1, length(vx)) + 1;
|
||||
|
@ -192,7 +222,8 @@ R = R';
|
|||
% vy(:,truc) = [];
|
||||
|
||||
% Filtrage scalaire
|
||||
R_scaled = 1.1 * R;
|
||||
R_scaled = 1.05 * R;
|
||||
|
||||
dist = abs(complex(V_(:,1), V_(:,2)) - transpose(complex(V_(:,1), V_(:,2))));
|
||||
|
||||
R_vertical = ones(length(R_scaled),1) * R_scaled;
|
||||
|
@ -203,10 +234,17 @@ R_horizontal = R_scaled' * ones(1,length(R_scaled));
|
|||
vx(:, mod(c - 1, length(vx)) + 1) = [];
|
||||
vy(:, mod(c - 1, length(vy)) + 1) = [];
|
||||
|
||||
subplot(2,2,4);
|
||||
R = [R(1:length(R)/2); R(length(R)/2+1:end)];
|
||||
R(:, mod(c - 1, length(R)) + 1) = [];
|
||||
R = R(:);
|
||||
|
||||
% subplot(2,2,4);
|
||||
nexttile;
|
||||
imshow(bw_img);
|
||||
hold on
|
||||
plot(vy, vx, 'b');
|
||||
vx_vy = [vy(1,:) vy(2,:); vx(1,:) vx(2,:)]';
|
||||
viscircles(vx_vy(1:10:end,:), R(1:10:end));
|
||||
|
||||
|
||||
%%
|
||||
|
@ -254,10 +292,9 @@ for i = 1:size(pts, 1)
|
|||
end;
|
||||
|
||||
fprintf('Calcul des points 3D termine : %d points trouves. \n', size(X, 2));
|
||||
view(80, -10);
|
||||
|
||||
%affichage du nuage de points 3D
|
||||
figure;
|
||||
figure(6);
|
||||
hold on;
|
||||
|
||||
for i = 1:size(X, 2)
|
||||
|
@ -265,6 +302,7 @@ for i = 1:size(X, 2)
|
|||
end;
|
||||
|
||||
axis equal;
|
||||
view(80, -10);
|
||||
|
||||
% A COMPLETER
|
||||
% Tetraedrisation de Delaunay
|
||||
|
@ -338,7 +376,7 @@ nb_barycentres = length(to_save);
|
|||
% A DECOMMENTER POUR AFFICHER LE MAILLAGE RESULTAT
|
||||
% Affichage des tetraedres restants
|
||||
fprintf('Retrait des tetraedres exterieurs a la forme 3D termine : %d tetraedres restants. \n',size(T,1));
|
||||
figure;
|
||||
figure(7);
|
||||
tetramesh(triBis, T.Points);
|
||||
view(80, -10);
|
||||
|
||||
|
|
BIN
donnees.mat
BIN
donnees.mat
Binary file not shown.
Loading…
Reference in a new issue