style: autoformat
This commit is contained in:
parent
74365d944c
commit
2cf841e339
|
@ -136,21 +136,17 @@ nexttile;
|
||||||
imshow(bw_img);
|
imshow(bw_img);
|
||||||
hold on
|
hold on
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
% A FAIRE SI VOUS UTILISEZ LES MASQUES BINAIRES FOURNIS %
|
% A FAIRE SI VOUS UTILISEZ LES MASQUES BINAIRES FOURNIS %
|
||||||
% Chargement des masques binaires %
|
% Chargement des masques binaires %
|
||||||
% de taille nb_lignes x nb_colonnes x nb_images %
|
% de taille nb_lignes x nb_colonnes x nb_images %
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|
||||||
pixel_b = find(bw_img == 1);
|
pixel_b = find(bw_img == 1);
|
||||||
[r, c] = ind2sub(size(bw_img), pixel_b(1));
|
[r, c] = ind2sub(size(bw_img), pixel_b(1));
|
||||||
contour = bwtraceboundary(bw_img, [r c], 'W', 8);
|
contour = bwtraceboundary(bw_img, [r c], 'W', 8);
|
||||||
plot(contour(:, 2), contour(:, 1), 'g', 'LineWidth', 3);
|
plot(contour(:, 2), contour(:, 1), 'g', 'LineWidth', 3);
|
||||||
|
|
||||||
|
|
||||||
% r = delaunay(contour);
|
% r = delaunay(contour);
|
||||||
% barycentres = (contour(r(:,1),:) + contour(r(:,2),:) + contour(r(:,3),:)) / 3;
|
% barycentres = (contour(r(:,1),:) + contour(r(:,2),:) + contour(r(:,3),:)) / 3;
|
||||||
% scatter(barycentres(:,2), barycentres(:,1));
|
% scatter(barycentres(:,2), barycentres(:,1));
|
||||||
|
@ -161,7 +157,6 @@ T = 1;
|
||||||
|
|
||||||
plot(vy, vx, 'b');
|
plot(vy, vx, 'b');
|
||||||
|
|
||||||
|
|
||||||
% Selection des segments qui ont leurs extrémités dans l'image
|
% Selection des segments qui ont leurs extrémités dans l'image
|
||||||
ok = vx(1, :) > 1 & vx(1, :) < size(bw_img, 1) & ...
|
ok = vx(1, :) > 1 & vx(1, :) < size(bw_img, 1) & ...
|
||||||
vx(2, :) > 1 & vx(2, :) < size(bw_img, 1) & ...
|
vx(2, :) > 1 & vx(2, :) < size(bw_img, 1) & ...
|
||||||
|
@ -194,7 +189,6 @@ imshow(bw_img);
|
||||||
hold on
|
hold on
|
||||||
plot(vy, vx, 'b');
|
plot(vy, vx, 'b');
|
||||||
|
|
||||||
|
|
||||||
% Remise en forme de vx et vy
|
% Remise en forme de vx et vy
|
||||||
vx_ = vx';
|
vx_ = vx';
|
||||||
vx_ = [vx_(:, 1); vx_(:, 2)];
|
vx_ = [vx_(:, 1); vx_(:, 2)];
|
||||||
|
@ -204,7 +198,6 @@ vy_ = [vy_(:,1) ; vy_(:,2)];
|
||||||
|
|
||||||
V_ = [vx_ vy_];
|
V_ = [vx_ vy_];
|
||||||
|
|
||||||
|
|
||||||
% Calcule des rayons
|
% Calcule des rayons
|
||||||
contour_ = contour';
|
contour_ = contour';
|
||||||
R = complex(V_(:, 1), V_(:, 2)) - complex(contour_(1, :), contour_(2, :));
|
R = complex(V_(:, 1), V_(:, 2)) - complex(contour_(1, :), contour_(2, :));
|
||||||
|
@ -247,7 +240,6 @@ plot(vy, vx, 'b');
|
||||||
vx_vy = [vy(1, :) vy(2, :); vx(1, :) vx(2, :)]';
|
vx_vy = [vy(1, :) vy(2, :); vx(1, :) vx(2, :)]';
|
||||||
viscircles(vx_vy(1:1:end, :), R(1:1:end));
|
viscircles(vx_vy(1:1:end, :), R(1:1:end));
|
||||||
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -315,12 +307,12 @@ T = delaunayTriangulation(X(1,:)', X(2,:)', X(3,:)');
|
||||||
% figure;
|
% figure;
|
||||||
% tetramesh(T);
|
% tetramesh(T);
|
||||||
|
|
||||||
|
|
||||||
% A DECOMMENTER ET A COMPLETER
|
% A DECOMMENTER ET A COMPLETER
|
||||||
|
|
||||||
% Calcul des barycentres de chacun des tetraedres
|
% Calcul des barycentres de chacun des tetraedres
|
||||||
poids = [1 1 1 1] / 4;
|
poids = [1 1 1 1] / 4;
|
||||||
nb_barycentres = size(T.ConnectivityList, 1);
|
nb_barycentres = size(T.ConnectivityList, 1);
|
||||||
|
|
||||||
for i = 1:size(T, 1)
|
for i = 1:size(T, 1)
|
||||||
% Calcul des barycentres differents en fonction des poids differents
|
% Calcul des barycentres differents en fonction des poids differents
|
||||||
% En commencant par le barycentre avec poids uniformes
|
% En commencant par le barycentre avec poids uniformes
|
||||||
|
@ -350,8 +342,10 @@ tri = T.ConnectivityList;
|
||||||
% ne se trouvent pas dans au moins un des masques des images de travail
|
% ne se trouvent pas dans au moins un des masques des images de travail
|
||||||
% Pour chaque barycentre
|
% Pour chaque barycentre
|
||||||
to_save = [];
|
to_save = [];
|
||||||
|
|
||||||
for k = 1:nb_barycentres
|
for k = 1:nb_barycentres
|
||||||
valide = 0;
|
valide = 0;
|
||||||
|
|
||||||
for i = 1:nb_images
|
for i = 1:nb_images
|
||||||
o = P{i} * C_g(:, k);
|
o = P{i} * C_g(:, k);
|
||||||
o = o / o(3);
|
o = o / o(3);
|
||||||
|
@ -362,6 +356,7 @@ for k = 1:nb_barycentres
|
||||||
valide = 1;
|
valide = 1;
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if valide
|
if valide
|
||||||
|
|
|
@ -11,9 +11,11 @@ fprintf('Calcul du maillage final termine : %d faces. \n',size(FACES,1));
|
||||||
% Affichage du maillage final
|
% Affichage du maillage final
|
||||||
figure;
|
figure;
|
||||||
hold on
|
hold on
|
||||||
|
|
||||||
for i = 1:size(FACES, 1)
|
for i = 1:size(FACES, 1)
|
||||||
plot3([X(1, FACES(i, 1)) X(1, FACES(i, 2))], [X(2, FACES(i, 1)) X(2, FACES(i, 2))], [X(3, FACES(i, 1)) X(3, FACES(i, 2))], 'r');
|
plot3([X(1, FACES(i, 1)) X(1, FACES(i, 2))], [X(2, FACES(i, 1)) X(2, FACES(i, 2))], [X(3, FACES(i, 1)) X(3, FACES(i, 2))], 'r');
|
||||||
plot3([X(1, FACES(i, 1)) X(1, FACES(i, 3))], [X(2, FACES(i, 1)) X(2, FACES(i, 3))], [X(3, FACES(i, 1)) X(3, FACES(i, 3))], 'r');
|
plot3([X(1, FACES(i, 1)) X(1, FACES(i, 3))], [X(2, FACES(i, 1)) X(2, FACES(i, 3))], [X(3, FACES(i, 1)) X(3, FACES(i, 3))], 'r');
|
||||||
plot3([X(1, FACES(i, 3)) X(1, FACES(i, 2))], [X(2, FACES(i, 3)) X(2, FACES(i, 2))], [X(3, FACES(i, 3)) X(3, FACES(i, 2))], 'r');
|
plot3([X(1, FACES(i, 3)) X(1, FACES(i, 2))], [X(2, FACES(i, 3)) X(2, FACES(i, 2))], [X(3, FACES(i, 3)) X(3, FACES(i, 2))], 'r');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
view(80, -10);
|
view(80, -10);
|
Loading…
Reference in a new issue