function b=beta(same,diff)
% Get the ratio of the prior probabilities that a pair of
% contour elements belongs to different versus the same
% physical source, as a function of distance between the
% pair of elements.
%
% Parameters:
%
%   same    Edge pair probability of edges on same contour
%   diff    Edge pair probability of edges on different contour
%
% Return:
%
%   b       Beta parameter at each distance
%
% Copyright (C) 2001-2009 Center for Perceptual Systems

% Check invariants
assert(isequal(size(same),size(diff)),'Invalid histograms');

% Compute distance dependent priors
dbins=size(same,1);
b=zeros(1,dbins);
for i=1:dbins
    b(i)=sum(diff(i,:))/sum(same(i,:));
end
