function [ depth ] = twoPointsDepth( info, feature1, feature2 )
%twoPointsDepth caculates the depth a corresponding points 
%   info1, info2 - the image info of two images, basicly the intrinsic
%   matrix is important
%   feature1, feature2 - 2-vector, the coordinate of feature on image

    baseline = 30;
    focallength = 200;
    ccdwidth = 10.9*0.8; % Nikon P90
    
    empconst = 0.168;
    
    % get the real disparity on screen from disparity on image got from
    % camera
    
    dispc = sqrt(sum((feature1 - feature2).^2));
    width = info.Width;
    fl = info.DigitalCamera.FocalLength;
    %dispcr = dispc/width*ccdwidth;
    %disps = dispcr/fl*focallength;
    disps = dispc * empconst;
    
    % calculate depth from screen disparity
    depth = baseline/disps*focallength/(1-baseline/disps);
end

