[gdal-dev] Contrast, Brightness and Gamma
Chaitanya kumar CH
chaitanya.ch at gmail.com
Tue Mar 20 12:37:56 EDT 2012
Saâd,
Gamma correction is more related to displaying the data than the data
itself.
You can, however, modify the contrast and brightness of the dataset.
Using LUT is not hard to learn as long as you know what you want.
A simple method is the stretch the data linearly along the whole range.
For that, your LUT element looks like this:
<LUT>[src value 1]:[dest value 1],[src value 2]:[dest value 2]</LUT>
There are only four values.
src value 1: This should be the least value of the pixels in the source
raster band.
src value 2: This should be the greatest value of the pixels in the source
raster band.
dest value 1: This should be the least value the data type of the raster
band can hold. That would usually be zero.
dest value 2: This should be the greatest value the data type of the raster
band can hold. That would be 255, 65535 and 4294967295 for 8bit, 16bit and
32bit raster bands.
The VRT driver calculates the intermediate values. The result here would be
similar to using the scale ratio and offset parameters.
On Tue, Mar 20, 2012 at 9:25 PM, Saâd HESSANE <saad.hessane at gmail.com>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 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/20120320/8a3a7c43/attachment.html
More information about the gdal-dev
mailing list