Found [This cute algorithm](http://angeljohnsy.blogspot.com/2011/04/matlab-code-histogram-equalization.html) to solve this.

    %original histogram
    Hist=imhist(Im);
    %Create probabilty vector for each grayscale value
    mapVec=zeros(1,256);
    for i = 1:size(Im,1)
        for j = 1:size(Im,2)
            %add one to representing bin for each value of
            %grayscale found in the image
            mapVec(Im(i,j)+1)=mapVec(Im(i,j)+1)+1;
        end
    end
    %Generate the cumulative histogram
    sum=0;
    for i=1:size(mapVec,2)
        sum=sum+mapVec(i);
        mapVec(i)=sum;
    end
    %divide by number of Pixels to find CDF
    mapVec=mapVec/(size(Im,1)*size(Im,2));
    %round the result times number of bins
    mapVec=round(mapVec*256);