added additional input params to histogram (reference img, tolerance, window size). Hist now chops off 20% of the left and right margins of a image instead of a constant 10