1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| %% Image complete
Xfull = imread('test2.JPG','jpg');
%% Première moitié
X = Xfull(:,1:size(Xfull,2)/2,:);
R = 100;
[theta,r]=meshgrid(linspace(pi/8,0,size(X,2)),linspace(0,R,size(X,1)));
x = r.*cos(theta);
y = r.*sin(theta);
[xi,yi] = meshgrid(sin(pi/8)*R:-1:0,0:1:R);
Xi(:,:,1) = griddata(x,y,double(X(:,:,1)),yi,xi);
Xi(:,:,2) = griddata(x,y,double(X(:,:,2)),yi,xi);
Xi(:,:,3) = griddata(x,y,double(X(:,:,3)),yi,xi);
%% Seconde moitié
X = Xfull(:,size(Xfull,2)/2+1:end,:);
R = 100;
[theta,r]=meshgrid(linspace(0,pi/8,size(X,2)),linspace(0,R,size(X,1)));
x = r.*cos(theta);
y = r.*sin(theta);
[xi,yi] = meshgrid(0:1:sin(pi/8)*R,0:1:R);
Xii(:,:,1) = griddata(x,y,double(X(:,:,1)),yi,xi);
Xii(:,:,2) = griddata(x,y,double(X(:,:,2)),yi,xi);
Xii(:,:,3) = griddata(x,y,double(X(:,:,3)),yi,xi);
%% Concaténation des moitiés
XX(:,:,1) = [Xi(:,:,1) Xii(:,:,1)];
XX(:,:,2) = [Xi(:,:,2) Xii(:,:,2)];
XX(:,:,3) = [Xi(:,:,3) Xii(:,:,3)];
%% Normalisation des valeurs
XX(:,:,1) = XX(:,:,1) - min(min(XX(:,:,1)));
XX(:,:,1) = XX(:,:,1)/max(max(XX(:,:,1)));
XX(:,:,2) = XX(:,:,2) - min(min(XX(:,:,2)));
XX(:,:,2) = XX(:,:,2)/max(max(XX(:,:,2)));
XX(:,:,3) = XX(:,:,3) - min(min(XX(:,:,3)));
XX(:,:,3) = XX(:,:,3)/max(max(XX(:,:,3)));
%% Affichage
figure
subplot(2,1,1)
imagesc(Xfull);
axis image
drawnow
subplot(2,1,2)
imagesc(XX);
axis image |
Partager