
uu=importdata('validx_corr.dat');
ii=importdata('validy_corr.dat');


set(gca,'visible','off')
f1 = figure(1);
set(f1, 'Position', [0, 0, 1328, 2220]);
vid = VideoWriter('X6_transparenter_PLot_auf_Probe');
%open(vid);
set(gca,'nextplot','replacechildren');
% Kurve über dem Bild zeichen
for b=1:newpic
    % f1;
    p1=min(validx(:,b));p2=max(validx(:,b));
    q1=min(validy(:,b));q2=max(validy(:,b));
    xlin=linspace(p1,p2,80);
    ylin=linspace(q1,q2,80);
    [X,Y]=meshgrid(xlin,ylin);
    f=scatteredinterpolant(validx(:,b),validy(:,b),sumdisplace(:,b),'nearest');
    Z=f(X,Y);
    baseFileName = theFiles(b).name;
    fullFileName = fullfile(myFolder, baseFileName);
    fprintf(1, 'Now reading %s\n', fullFileName);
    % Now do whatever you want with this file name,
    % such as reading it in as an image array with imread()
    imageArray = im2bw(imread(fullFileName));
    B=imageArray;
    subplot(2,1,1)
    imshow(B,'InitialMagnification',100); hold on; %contour(X,Y,Z,5)
    pcolor(X,Y,Z);
    shading interp
    alpha(0.2)
    %set(imax,'position',[0 0 1 1]) % make it to fill the whole figure
    caxis([zmin,zmax]);
    colormap HSV
    tt=colorbar;
    ylabel(tt,'Pixelverschiebung','FontSize',12,'color','k');
    hold off
    hold off
    subplot(2,1,2)
    imshow(B,'InitialMagnification',100);
    hold on
    title([Title,sprintf(' (Bildnummer #: %1g)',b)])
    caxis([zmin,zmax]);
    colormap HSV
    tt1=colorbar;
    ylabel(tt1,'Pixelverschiebung','FontSize',12,'color','k');
    pcolor(X,Y,Z);
    shading interp
    hold off
    hold off
    drawnow
    frame = getframe(gcf);
    writeVideo(vid,frame);
end
close(vid);