[gdal-dev] Contrast, Brightness and Gamma

Saâd HESSANE saad.hessane at gmail.com
Thu Mar 22 13:52:34 EDT 2012


Hy Chaitanya,

I applied a LUT to the VRT. It's work fine, and all pixel are between
dst_min and dst_max.
But why this is not work with the -scale parameter? The doc is clear :
http://www.gdal.org/gdal_translate.html.
"Rescale the input pixels values from the range *src_min* to *src_max* to
the range *dst_min* to *dst_max*."
Is it a bug?


2012/3/22 Chaitanya kumar CH <chaitanya.ch at gmail.com>

> Saâd,
>
> It is better to have a combined LUT. It will save processing time and data
> degradation.
> Be informed that GDAL VRT is not specialized for this work. To get a
> smooth curve as LUT, use some other graphics application that can handle
> 16bit rasters.
>
>
> On Wed, Mar 21, 2012 at 6:00 AM, Saâd HESSANE <saad.hessane at gmail.com>wrote:
>
>> Thank's all for your answers.
>> I will use the LUT method, cause is the most right for me.
>>
>> Chaitanya said : "Gamma correction is more related to displaying the data
>> than the data itself".
>> Not in my case. I have to do this correction. But how to do that? Do i
>> embed a VRT with a contrast correction LUT, in another VRT with a gamma
>> correction LUT ? Or there is a method to declare LUTs in order to execute
>> in the same vrt ?
>>
>> Thank's again !
>>
>>
>>
>> 2012/3/20 Brent Fraser <bfraser at geoanalytic.com>
>>
>>>  I like to use gdal_contrast_stretch from
>>> http://www.gina.alaska.edu/projects/gina-tools/
>>>
>>> Usage: gdal_contrast_stretch <src.tif> <dst.tif>
>>>   { { -linear-stretch <target_avg> <target_stddev> } |
>>>     { -percentile-range <from: 0.0-1.0> <to: 0.0-1.0> } |
>>>     { -histeq <target_stddev> } }
>>>   [ -ndv <no_data_val> ]
>>> Input must be either 8-bit or 16-bit.  Output is 8-bit.
>>>
>>> For example:
>>>
>>> gdal_contrast_stretch -percentile-range 0.02 0.98 input16bit.tif
>>> output8bit.tif
>>>
>>> Best Regards,
>>> Brent Fraser
>>>
>>>
>>> On 3/20/2012 9:55 AM, Saâd HESSANE wrote:
>>>
>>> Hi list,
>>>
>>> I use gdal_translate to convert 16bits images to 8bits images. The
>>> gdal_translate have the -scale argument to specify the convertion range
>>> (source->destination).
>>> If I change the destination range (dst_min and dst_max), I can do
>>> manually a brightness correction (also a contrast correction).
>>>
>>> But is there any way to do that with a Photoshop like method?
>>> For example set a brightness to -50, a contrast to +8 and let
>>> gdal_translate do the job ?
>>>
>>> Also can I apply a gamma correction?
>>>
>>> I saw the VRT format and there's a way to apply a LUT. But I don't think
>>> a LUT of 65536 values is the best way to apply the correction.
>>>
>>> Also the VRT have the scale ratio and scale offset elements. I think it
>>> can be useful but I don't understand how use it...
>>>
>>> So simply put, my question : can I do a contrast, brightness or gamma
>>> correction to a raster with gdal?
>>>
>>> Thank you !
>>>
>>> PS : I apologize for my broken English !
>>>
>>>
>>> _______________________________________________
>>> gdal-dev mailing listgdal-dev at lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>
>
> --
> Best regards,
> Chaitanya kumar CH.
>
> +91-9494447584
> 17.2416N 80.1426E
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120322/3b70f126/attachment-0001.html


More information about the gdal-dev mailing list