I=imread('klaun.tif');
figure(1)
imagesc(I); 
colormap(gray);
axis image off

figure(2)
I2=-double(I)+255;
imagesc(I2);
colormap(gray); 
axis image off
imwrite(uint8(I2),'klaun2.tif')



%afinni transformace digitalniho obrazu
clear; clc;
a0=0; a1=1; a2=0;
b0=0; b1=1; b2=1;
Obr=imread('klaun.tif');
Obr=double(Obr);
[X,Y]=meshgrid(1:size(Obr),1:size(Obr,2));
X2=a0+a1*X+a2*Y;
Y2=b0+b1*X+b2*Y;
X2max=max(max(X2)); X2min=min(min(X2));
Y2max=max(max(Y2)); Y2min=min(min(Y2));
[X3,Y3]=meshgrid(X2min:X2max,Y2min:Y2max);
Obr2=griddata(X2,Y2,Obr',X3,Y3,'cubic');
 
figure(1)
colormap(gray)
pcolor(X3,Y3,Obr2)
shading interp
axis image off











