I created an RGB Uint16 composite raster in QGIS . These are band designations:

  • Band 1 - blue
  • Band 2 - green
  • Band 3 - red

When i query value of a pixel that appears green - it shows (B3: 668, B2: 983, B1: 1007). Since the pixel is green, I expected DN in the green band to be the highest, although this is not the case.

Why is that?

The raster is stretched and clipped using 2 - 98% cumulative count, although the values queried are raw DNs.

enter image description here

  • 1
    Will you check the Layer property > Symbology, to see the setting of each band (min, max)? These min and max might be simply reflecting the range of your input data. – Kazuhito Feb 22 at 13:31

As you mention in your PS, the values returnedby your query are raw values. On the display, the RGB values are stretched between 0 and 255 (on a 3x8bit monitor) depending on the distribution of the raw values. So, for intance, if the range values are 0-10000 for red, 0-1000 for green and 0-10000 for blue, the min-max contrast stretch would be like R(display)26, G(display)253 and B(display) 17 , which is green on display.

  • Thank you! So it came down to min and max values on a stretched scale. The values were: Scale: R (400 - 1434), G (616 - 1404), B (873 - 1524), the pixel values were initial R (668), G (983), B (1007). Then I zeroed the min value for each channel and subtracted it from all values. Scale then became R (0 - 1034), G (0 - 788), B (0 - 651) and R (268), G (367), B (134) for pixel. Then I rescaled everything to 8 bit, which produced Scale R (0 - 255), G (0 - 255), B (0 - 255) and Pixel: R (66), G (119), B (52). That gave me exactly the same color as on the screen – Basile Feb 22 at 20:06

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.