aleju / imgaug

Image augmentation for machine learning experiments.
http://imgaug.readthedocs.io
MIT License
14.37k stars 2.44k forks source link

Histogram normalization #216

Open szymonk92 opened 5 years ago

szymonk92 commented 5 years ago

Would be great to see histogram normalization and CLAHE. Simple methods but very useful with very bright/dark images. Probably applied only to B&W images.

aleju commented 5 years ago

It's planned for the near future to add CLAHE or a similar technique. Haven't done that in the past as the methods tend to be implemented so that they only improve the contrast of images, while in an image augmentation library you might rather want to have a method that worsens the contrast so that the model learns to compensate for bad contrast.

szymonk92 commented 5 years ago

@aleju Thanks for your effort. From my perspective, it would be great to have such methods. Since most of the time images come from different sources with different light and so on, methods such as Contrast-Enhanced Image could be used as a pre-processing step (in some cases might worst the image) or as a data augmentation (might worst or improve it). I prefer to fees the network with as little pre-processing as possible (when pro-processing is not obvious) and then use heavy data augmentation.

aleju commented 5 years ago

The normalization methods are now in master. As they are based on the corresponding OpenCV methods, they only increase the contrast though and don't decrease it.