function [matchedFP] = match_FP_distance (FP1, FP2)
    % Metoda na baze porovnavania euklidovskych vzdialenosti bodov,
    % ked pri malych rozdieloch medzi dvoma po sebe nasledujucimi obrazmi
    % je mala pravdepodobnost, ze by dvojica FB bola od seba vzdialena
    % na tolko, aby bol za dvojicu oznaceny zly par bodov.

    %%
    
    
    if (size(FP1,1)) < (size(FP2,1))
                
        matchedFP = zeros(size(FP1,1) , 4);
        euklidTEMP = zeros(size(FP1,1) , size(FP2,1));
        
        for i = 1:(size (FP1,1))
            euklidMIN = 100000000;
            temp1 = FP1(i,:);
            for j = 1:(size (FP2,1))
                temp2 = FP2(j,:);
                euklid = sqrt( ((temp1(1)-temp2(1) )^2) + (( temp1(2) - temp2(2))^2) );
                euklidTEMP(i,j) = euklid;

                if euklid < euklidMIN
                    match = FP2(j,:);
                    euklidMIN = euklid;
                end
            end
        
            matchedFP(i,1:2) = temp1(:);
            matchedFP(i,3:4) = match;
        
        end
        
    else
        
        matchedFP = zeros(size(FP2,1) , 4);
        euklidTEMP = zeros(size(FP2,1) , size(FP1,1));
        
        for i = 1:(size (FP2,1))
            euklidMIN = 100000000;
            temp2 = FP2(i,:);
            for j = 1:(size (FP1,1))
                temp1 = FP1(j,:);
                euklid = sqrt( ((temp1(1)-temp2(1) )^2) + (( temp1(2) - temp2(2))^2) );
                euklidTEMP(j,i) = euklid;

                if euklid < euklidMIN
                    match = FP1(j,:);
                    euklidMIN = euklid;


                end
            end

            matchedFP(i,3:4) = temp2(:);
            matchedFP(i,1:2) = match;

        end
        
    end

end