close all clear all % Lecture de l'image im=imread('example.tif','tif','index',5); % Filtre TopHat gray=imtophat(im,strel('disk',7)); [level] = graythresh(gray); % Image Binaire bin=im2bw(gray,level); % Inverse bin=1-bin; temp=bin; % Element Structurant el=strel('ball',7,10,8); el2 =strel('ball',7,10,16);%strel('disk',10); F= imclose(1-temp,el); % Ouverture O = imopen(1-temp,el); % Fermeture bin = imclose(O,el2); controurI=F-temp; controurE=O-temp; contour=O-F; controurE=imclose(1-controurE,strel('disk',15)); %bin=1-bin; % Squelette skel=bwmorph(bin,'thin',Inf); skelI=bwmorph(controurI,'thin',Inf); skelE=bwmorph(controurE,'thin',Inf); skelC=bwmorph(contour,'thin',Inf); % Affichage newmap = [0 0 0 0 1 1 1 0 1]; %copper; %newmap(:,3)=0 figure;imshow(im);title('original'); %{ figure;imshow(gray);title('gray'); figure;imshow(temp);title('temp'); figure;imshow(bin);title('bin'); figure;imshow(skel);title('skel'); %} figure;imshow(skelton(im));title('skelFcn'); figure;imshow(labelise(1-skelC));title('watarshadFcn'); %{ figure;imshow(controurI);title('controurI'); figure;imshow(labelise(controurI));title('controurE'); figure;imshow(contour);title('controur'); figure;imshow(skelI);title('skelI'); figure;imshow(skelE);title('skelE'); figure;imshow(skelC);title('skelC'); %}