Hi Filipe,
so your data is byte at the end.
note that when applying MEAN (+/-)n* STDDEV you should not exceed the input
range (0, 255 on bytes).
You can try using n=1 or just set 0 instead of negative value.
In reference to the histogram percentile computations, you may need to do
some math or compute them with QGIS.
You may want to look at this piece of code to better understand how
percentiles can be computed.
https://github.com/qgis/QGIS/blob/master/src/core/raster/qgsrasterinterface.cpp#L533-L560
Long story short, you have to run gdalinfo -hist and take note of number of
buckets as well as "from" and "to" range.
Then start summing bucket count until you get the desired percentage (as an
instance you will get a 2% once the cumulative sum is 2% with respect to
the total number of pixels composing your image, usually Width*Height).
The number of bucket used to reach the 2% allows you to compute the related
MIN value. (something like: "from" + numBuckets * (range/totalNumBuckets)).
The same for the 98% to compute the MAX.
You may want to check some histogram and percentiles topic around on
internet to better understand this concepts.
Hope this helps.
Cheers,
Daniele
On Tue, Aug 1, 2017 at 5:14 PM, Filipe <[email protected]> wrote:
> Hello
> Thank you for your reply.
>
> I did what you sugested, and we're getting somewhere!
>
>
> using the formulas you sugested:
>
> <RasterSymbolizer>
> <ChannelSelection>
> <RedChannel>
> <SourceChannelName>1</SourceChannelName>
> <ContrastEnhancement>
> <Normalize>
> <VendorOption
> name="algorithm">StretchToMinimumMaximum</VendorOption>
> <VendorOption name="minValue">-55.2689</VendorOption>
> <VendorOption name="maxValue">214.7722</VendorOption>
> </Normalize>
> </ContrastEnhancement>
> </RedChannel>
> <GreenChannel>
> <SourceChannelName>2</SourceChannelName>
> <ContrastEnhancement>
> <Normalize>
> <VendorOption
> name="algorithm">StretchToMinimumMaximum</VendorOption>
> <VendorOption name="minValue">-41.9121</VendorOption>
> <VendorOption name="maxValue">163.9293</VendorOption>
> </Normalize>
> </ContrastEnhancement>
> </GreenChannel>
> <BlueChannel>
> <SourceChannelName>3</SourceChannelName>
> <ContrastEnhancement>
> <Normalize>
> <VendorOption
> name="algorithm">StretchToMinimumMaximum</VendorOption>
> <VendorOption name="minValue">-22.1867</VendorOption>
> <VendorOption name="maxValue">77.2479</VendorOption>
> </Normalize>
> </ContrastEnhancement>
> </BlueChannel>
> </ChannelSelection>
> </RasterSymbolizer>
>
> my raster info is
>
> C:\DATA\raster>gdalinfo myRaster.tif
> Driver: GTiff/GeoTIFF
> Files: myRaster.tif
> myRaster.tif.ovr
> myRaster.tif.aux.xml
> Size is 23861, 16880
> Coordinate System is:
> PROJCS["WGS 84 / UTM zone 29N",
> GEOGCS["WGS 84",
> DATUM["WGS_1984",
> SPHEROID["WGS 84",6378137,298.257223563,
> AUTHORITY["EPSG","7030"]],
> AUTHORITY["EPSG","6326"]],
> PRIMEM["Greenwich",0,
> AUTHORITY["EPSG","8901"]],
> UNIT["degree",0.0174532925199433,
> AUTHORITY["EPSG","9122"]],
> AUTHORITY["EPSG","4326"]],
> PROJECTION["Transverse_Mercator"],
> PARAMETER["latitude_of_origin",0],
> PARAMETER["central_meridian",-9],
> PARAMETER["scale_factor",0.9996],
> PARAMETER["false_easting",500000],
> PARAMETER["false_northing",0],
> UNIT["metre",1,
> AUTHORITY["EPSG","9001"]],
> AXIS["Easting",EAST],
> AXIS["Northing",NORTH],
> AUTHORITY["EPSG","32629"]]
> Origin = (625033.424520000000484,4248219.836620000191033)
> Pixel Size = (0.103860000000000,-0.103860000000000)
> Metadata:
> AREA_OR_POINT=Area
> TIFFTAG_SOFTWARE=pix4dmapper
> Image Structure Metadata:
> COMPRESSION=LZW
> INTERLEAVE=PIXEL
> Corner Coordinates:
> Upper Left ( 625033.425, 4248219.837) ( 7d34' 7.07"W, 38d22'24.38"N)
> Lower Left ( 625033.425, 4246466.680) ( 7d34' 8.19"W, 38d21'27.52"N)
> Upper Right ( 627511.628, 4248219.837) ( 7d32'24.97"W, 38d22'23.12"N)
> Lower Right ( 627511.628, 4246466.680) ( 7d32'26.11"W, 38d21'26.26"N)
> Center ( 626272.526, 4247343.258) ( 7d33'16.59"W, 38d21'55.32"N)
> Band 1 Block=23861x1 Type=Byte, ColorInterp=Red
> Min=0.000 Max=255.000
> Minimum=0.000, Maximum=255.000, Mean=79.752, StdDev=67.510
> NoData Value=-10000
> Overviews: 11931x8440, 5966x4220, 2983x2110, 1492x1055, 746x528, 373x264,
> 187x132
> Metadata:
>
> STATISTICS_COVARIANCES=4557.639431244172,3461.157875865516,1616.247181916951,8018.146929498016
> STATISTICS_MAXIMUM=255
> STATISTICS_MEAN=79.751677803277
> STATISTICS_MINIMUM=0
> STATISTICS_SKIPFACTORX=1
> STATISTICS_SKIPFACTORY=1
> STATISTICS_STDDEV=67.510291214959
> Band 2 Block=23861x1 Type=Byte, ColorInterp=Green
> Min=0.000 Max=255.000
> Minimum=0.000, Maximum=255.000, Mean=61.009, StdDev=51.460
> NoData Value=-10000
> Overviews: 11931x8440, 5966x4220, 2983x2110, 1492x1055, 746x528, 373x264,
> 187x132
> Metadata:
>
> STATISTICS_COVARIANCES=3461.157875865516,2648.170496677781,1243.180669732085,6133.734519685802
> STATISTICS_MAXIMUM=255
> STATISTICS_MEAN=61.008562632494
> STATISTICS_MINIMUM=0
> STATISTICS_SKIPFACTORX=1
> STATISTICS_SKIPFACTORY=1
> STATISTICS_STDDEV=51.460377929799
> Band 3 Block=23861x1 Type=Byte, ColorInterp=Blue
> Min=0.000 Max=226.000
> Minimum=0.000, Maximum=226.000, Mean=27.531, StdDev=24.859
> NoData Value=-10000
> Overviews: 11931x8440, 5966x4220, 2983x2110, 1492x1055, 746x528, 373x264,
> 187x132
> Metadata:
>
> STATISTICS_COVARIANCES=1616.247181916951,1243.180669732085,617.954007884253,2767.896495658875
> STATISTICS_MAXIMUM=226
> STATISTICS_MEAN=27.530599208965
> STATISTICS_MINIMUM=0
> STATISTICS_SKIPFACTORX=1
> STATISTICS_SKIPFACTORY=1
> STATISTICS_STDDEV=24.858680734992
> Band 4 Block=23861x1 Type=Byte, ColorInterp=Alpha
> Min=0.000 Max=255.000
> Minimum=0.000, Maximum=255.000, Mean=154.461, StdDev=124.617
> NoData Value=-10000
> Overviews: 11931x8440, 5966x4220, 2983x2110, 1492x1055, 746x528, 373x264,
> 187x132
> Metadata:
>
> STATISTICS_COVARIANCES=8018.146929498016,6133.734519685802,2767.896495658875,15529.34978118977
> STATISTICS_MAXIMUM=255
> STATISTICS_MEAN=154.46108783722
> STATISTICS_MINIMUM=0
> STATISTICS_SKIPFACTORX=1
> STATISTICS_SKIPFACTORY=1
> STATISTICS_STDDEV=124.61681179195
>
> Now what can i do to come closer to the original one? (to get that
> "blueish" on the water)
> You mentioned "computing percentiles based on histograms". how can i do
> that?
> Regards
> ------------------------------
> View this message in context: Re: Raster Normalize
> <http://osgeo-org.1560.x6.nabble.com/Raster-Normalize-tp5330021p5330071.html>
>
> Sent from the GeoServer - User mailing list archive
> <http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html> at
> Nabble.com.
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines: http://geoserver.org/comm/
> userlist-guidelines.html
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
--
Regards,
Daniele Romagnoli
==
GeoServer Professional Services from the experts! Visit http://goo.gl/it488V
for more information.
==
Ing. Daniele Romagnoli
Senior Software Engineer
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.
The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-users mailing list
Please make sure you read the following two resources before posting to this
list:
- Earning your support instead of buying it, but Ian Turton:
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines:
http://geoserver.org/comm/userlist-guidelines.html
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users