clear all
close all

% Matrice du requinj
A = imread('shark.png','png');
A = double(A);
A = A(:,:,1);
A = double(A>100);

figure
imagesc(A)
colorbar

% Grille unifomre
x = 1:size(A,1);
y = 1:size(A,2);
[X,Y] = meshgrid(x,y);

% Maillage uniforme
vtx = [X(:),Y(:)];
tri = delaunay(vtx);
mesh = msh(vtx,tri);
figure
plot(mesh)

% Indices des point a garder
M = A';
M = M(:);
figure
plot(mesh,M)

% Extraction des elements
ind = (sum(M(tri),2)==3);
final = mesh.sub(ind);

figure
plot(final)
axis equal








whos