I'm trying to replicate an augmentation technique used in this paper. This is how they explain the procedure:
[...] the augmentation technique was used to adjust the histogram because the intensity of the image was different depending on the patient and the MRI equipment. The intensity range is obtained from the whole image as a histogram. And the augmentation was performed by dividing it into five categories: dark distribution, median brightness distribution, bright distribution, average of all distributions and original image. In this process, three brightest, darkest, and intermediate brightness images were extracted, and the average of three histograms was calculated and expressed as a sum of the normal distributions. This intensity adjustment augmentation is applied randomly. In four adjustment cases except for the original is selected, match the histogram of the input image with the representative histogram distribution. By using the above two techniques [...] the number of images used for learning can be increased by [...] 5 times by brightness control
I know that one can get the histogram from an image (first step). But, how can I get those three categories (dark distribution, median brightness distribution and bright distribution) from the same image?
Images are in grayscale and I'm working this project on Pytorch. If someone has done this with PIL, Numpy or similar it would be great.