I have already calculated the cdf values of each image now i have to map the reference image values to target . I cannot use histogram equalization or interpolation I simply have to map them .
function S = histM(t, target)
if size(target,2)>1
%an image, replace the image with its cdf
target = getImageCDF(target);
end
%get the CDF for the input image
tcdf = getImageCDF(t);
% .... what shall be done here to map the values of reference to target
%subfunction: compute the CDF for an image that started as uint8
function cdf = getImageCDF(img)
bins = 0:255;
H = hist(img(:), bins);
Hmod = H + eps(sum(H));
cdf = [0, cumsum(Hmod)/sum(Hmod)];