# Adaptive methods for image contrast stretching?

**URL:** <https://discourse.julialang.org/t/adaptive-methods-for-image-contrast-stretching/67774>\
**Category:** Biology, Health, and Medicine\
**Tags:** question\
**Created:** [September 6, 2021, 8:37pm UTC](https://discourse.julialang.org/t/adaptive-methods-for-image-contrast-stretching/67774 "2021-09-06T20:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![babaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/babaq/32/891_2.png) [@babaq](https://discourse.julialang.org/u/babaq)\
**Post date:** [September 6, 2021, 8:37pm UTC](https://discourse.julialang.org/t/adaptive-methods-for-image-contrast-stretching/67774/1 "2021-09-06T20:37:02Z")

</div>

Hi,

I have an image with small repeating structures, which need to be stretched in the same range(0-1).

 ![F2Phase](https://global.discourse-cdn.com/julialang/original/3X/1/d/1d78bb167893357fe75eca54dc976c1e8bdd5b54.jpeg)

My intuition is to partition the image to many small tiles, and apply contrast linear stretching for each tile, but would like to hear more options, particularly established or published methods.

I tried Adaptive Histogram Equalization, but it seems not suited for my problems. Since the intensity of these structures encodes phase continuously, they has to maintain their relative value, so i am thinking a contrast stretching method maybe more appropriate.

Thanks,

Alex

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 8, 2021, 7:51am UTC](https://discourse.julialang.org/t/adaptive-methods-for-image-contrast-stretching/67774/2 "2021-09-08T07:51:50Z")

</div>

This is not a Julia solution, but I find the local contrast module in [Darktable](https://www.darktable.org/) excellent for this kind of work (and many other modules, too, explore its docs and see video tutorials on the net).

Once you figure out the parameters you prefer, you can batch process images from the command line (there is also LUA scripting).
