Hi Rich,
I apologize in advance for the hasty response, don't have time to get into
details and/or read with attention,
so I might be missing the target here, but yes, the act of rendering
includes going down to 8 bits, it's working like this by design, the
output of a rendering chain is a RGB or paletted image.
There was a similar discussion here:
https://osgeo-org.atlassian.net/browse/GEOS-7446
And there is a discussion on geoserver-devel about computing and storing a
full histogram, if we have that handy
we could indeed avoid doing the local rescale and perform a global one.
Cheers
Andrea
On Fri, May 20, 2016 at 4:49 PM, Rich Fecher <[email protected]> wrote:
> I had tracked an issue with GeoWave's implementation of AbstractGridFormat
> in which it seems the AbstractGridCoverage2DReader was storing and
> retrieving source images that had a single 16-bit band from landsat8 (so
> the data type for this sample model is unsigned short). The GridCoverage2D
> tiles that were being returned from the reader looked correct, but as it
> passed through the rendering pipeline in geotools it converted the image to
> 8-bits per band and rescaled the samples. This rescaling was based on a
> calculation of local extrema performed by ImageWorker (at least local to
> the tile request). For a mosaic the result was this:
>
> https://s3-us-west-2.amazonaws.com/geowave-content/example_byte_rescale_issue.png
>
> In digging into the code a bit, the tile request is rescaled to byte here
> using that local extrema calculation:
>
> https://github.com/geotools/geotools/blob/master/modules/library/render/src/main/java/org/geotools/renderer/lite/gridcoverage2d/RasterSymbolizerHelper.java#L130
>
> I am using the raster SLD that comes with geoserver out of the box, and
> have looked at ways to apply rescaling using pre-defined global extrema. I
> *think* that one workaround could be to add a ContrastEnhancement tag to
> the SLD with a normalize tag for a predefined min and max. Having to
> hard-code it in an sld doesn't seem particularly desirable. In the global
> mosaic case, for example, the extrema may change as new data is ingested,
> and generally its always an extra step with an opportunity for user error.
> Considering we persist an overall histogram per (mosaic'ed) grid coverage
> layer it seems that within our raster format implementation we could
> automate this.
>
> So in the meantime, my takeaway from reading the code is that there is
> ultimately a need to convert the image to 8-bit at some point in the render
> pipeline and perhaps it may make sense to always do that conversion upfront
> within our raster format where we have a little more control? If that's
> the case, to do this, my current work-around trying to re-use as much of
> the existing classes is to get an instance of an ImageWorker that allows me
> to set global statistics:
> https://github.com/ngageoint/geowave/blob/GEOWAVE-346-landsat8/extensions/adapters/raster/src/main/java/mil/nga/giat/geowave/adapter/raster/ImageWorkerPredefineStats.java
>
> Then I can call rescaleToBytes() using the global extrema for any grid
> coverage prior to returning it from our raster format. Does that seem
> reasonable? Am I missing something obvious or misusing the library in some
> way?
>
> Thanks in advance for the feedback!
> Rich
>
>
>
> ------------------------------------------------------------------------------
> Mobile security can be enabling, not merely restricting. Employees who
> bring their own devices (BYOD) to work are irked by the imposition of MDM
> restrictions. Mobile Device Manager Plus allows you to control only the
> apps on BYO-devices by containerizing them, leaving personal data
> untouched!
> https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>
>
--
==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.
==
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
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.
-------------------------------------------------------
------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel