Fix IndexOutOfBoundsException when retrieving min and max from image

The histogram class does excludes the max value, hence an exception occurs when we try to add the maximum value. This fix increases the max value by 1 when min/max are retrieved from the image.