function [Tops, im2,rotIm,LD,PH,LH,PD] = ImageProcessing2(app,im)
   % im = undistortImage(im, app.IntristicsParams);
    [LH,LD,PD,PH] = nalezeniZbyvajicihoBodu2(app, im,app.SelectedPoitsToFix{1,1});
    app.SelectedPoitsToFix{1,:} = [];
    [rotIm, LH,PH,LD, PD] = rotateImage(im, LH,PH,LD, PD);
    app.OrangePoints = [LD;PH;LH;PD];
    Width = round(sqrt((PH(1)-LH(1))^2 + (PH(2)-LH(2))^2));    %šířka, vzdálenost bodů
    Heigh = round(sqrt((LD(1)-LH(1))^2 + (LD(2)-LH(2))^2));    %výška
    im2 = imcrop(rotIm,[LH(1)+20,LH(2)-50,Width-40,round((Heigh+50)/1.8)]);
    im2BW = Preprocessing(im2);
    [startingPoint,MaxNumOfStcks] = whereToStart(im2BW);
    Tops = findTops(im2BW,startingPoint,MaxNumOfStcks,im2);
    Tops = findWrongTopsAutoGUI(Tops,1);
end