Search code examples
pythonimageimage-processingcomputer-visionscikit-image

how to find the optimal values for parameter in_range and out_range for sklearn.exposure.rescale_intensity


If I use (0,100) my image becomes totally white and if I use (300,700) it becomes completely white. Do I need to brute-check every value every time I use in_range or is there some optimal values for both the parameters?


Solution

  • The documentation for rescale_intensity states

    in_range, out_rangestr or 2-tuple, optional
    
        [...]
    
        ‘image’
            Use image min/max as the intensity range.
        [...]
    

    So, if you set in_range='image', which is the default anyway, the min and max of the image will be used for the range and the output image will always have maximum contrast between black and white.