3

I have image/tiff files of a small aerial imagery. I published it under ImageMosaic plugin (GDAL plugin installed), but when I pan or zoom the map in OpenLayers preview I am getting different colour for same position. Screenshots are attached.

What might be the reason for this? Did I need to tune anything?

Screenshot

Screenshot

Screenshot

Screenshot

3

To have a better idea we would need you to send over the output of the gdalinfo on those images.

I suspect that these are 16 bits images hence geoserver is applying contrast stretch on the fly to them depending on the local histogram to equalize them on bring them on 8 bits. You need to play with the rastersymbolizer parameters to improve the situation or due the stretch upfront before ingesting: http://docs.geoserver.org/latest/en/user/styling/sld-reference/rastersymbolizer.html#contrastenhancement

Simone.

  • thank you for your response .I tried with those styling parameter but nothing helped , will you please suggest me a sample Raster Image Style that fit my purpose please – Anas A Sep 9 '14 at 4:58
  • the best option is to color-enhance or color-balance the images before showing them. – simogeo Oct 15 '14 at 14:44
  • simogeo's suggestion is working with todays nightly build. See my answer. – pLumo Jul 6 '17 at 14:05
3

As @simogeo said, with 16Bit data, contrast stretching to 8bit is done automatically using min and max values of the requested area. That is not very useful in many cases. To keep a constant brightness level, you need to specify contrast stretching with the same absolute value per Band.

But until few days ago, a bug in GeoTools was preventing this from working. That bug is fixed now and backported to 16.x and 17.x. It is available in todays Nightly Builds of GeoServer 2.11 and 2.12.

This and this are the related Jira Issues.

You can specify contrast stretching like this in your SLD style:

<RedChannel>
  <SourceChannelName>1</SourceChannelName>
  <ContrastEnhancement>
     <Normalize>
        <VendorOption name="algorithm">StretchToMinimumMaximum</VendorOption>
        <VendorOption name="minValue">0</VendorOption>
        <VendorOption name="maxValue">4096</VendorOption>
     </Normalize>
  </ContrastEnhancement>
</RedChannel>
<GreenChannel>
  <SourceChannelName>2</SourceChannelName>
  <ContrastEnhancement>
     <Normalize>
        <VendorOption name="algorithm">StretchToMinimumMaximum</VendorOption>
        <VendorOption name="minValue">0</VendorOption>
        <VendorOption name="maxValue">4096</VendorOption>
     </Normalize>
  </ContrastEnhancement>
</GreenChannel>
<BlueChannel>
  <SourceChannelName>3</SourceChannelName>
  <ContrastEnhancement>
     <Normalize>
        <VendorOption name="algorithm">StretchToMinimumMaximum</VendorOption>
        <VendorOption name="minValue">0</VendorOption>
        <VendorOption name="maxValue">4096</VendorOption>
     </Normalize>
  </ContrastEnhancement>
</BlueChannel>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.