Adding the histogram matching part of the algorithm.