Changing Raster Layer Style

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
(Render Type: Multiband color)
(Render type: multiband file)
 
(47 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
Display of raster data in the map canvas can be enhanced using linear histogram stretching.
 +
Useful ''Raster tools'' are not activated by default. Right click on the main QGIS menu and activate the checkbox as seen on the screenshot. A new Raster Toolbar is now available on the main menu.
  
The raster layer propertiers differ from the vector layer properties, due to the significant differences of the data.
+
[[File:Qgis_Activate_Raster_Toolbar.png|600px]].
You can open this dialog by double-clicking a raster layer in the [[Table of contents | TOC]] or right-clicking on the layer in the  [[Table of contents | TOC]] and choosing {{mitem|text=Properties}}.  
+
  
==Render Type: Multiband color==
+
==Render type: multiband file==
 +
# Click the {{button|text=Open Data Source Manager}} [[Image:QGIS_3.0_datasource.png|30px]] and then {{button|text=Add raster layer}} [[Image:QGIS_2.0_addrast.png|20px]] and select a virtual stack or a multiband raster file.
 +
# After clicking {{button|text=Open}}, the raster layer appears on the QGIS canvas.
 +
# Right click the layer name in the Layer Panel and select {{mitem|text=Properties --> Symbology}}.
 +
# Change the assignment of Red, Green, Blue to band numbers and create color composites.
 +
Attention: usually the assignment refers to the original spectral band numbers which might be a different rank in the multiband file. Pick the corresponding No. according to the rank in the multiband file.
 +
[[File:Qgis_band_assign.png|thumb|left|400px]]
  
#* True color
+
* True Color composite.
#* Standard false color
+
** Red band: Original B4, BandNo. 3
#* False color
+
** Green band: Original B3, BandNo.2
 +
** Blue Band: Original B2, BandNo. 1
 +
In case of the Sentinel-2 example file this is a typical True Color composite.
 +
 +
Try other band combinations and produce false color composites.
  
#* For color composites the image may be enhanced by selecting {{button|text=Stretch to MinMax}} from the {{button|text=Contrast enhancement}} menu.
 
  
and selecting the {{button|text=Mean +/- standard deviation x}} radio button. After adjusting the standard deviation factor (a value between 1 and 2), click {{button|text=Load}} and confirm with {{button|text=Apply}} or {{button|text=OK}}.
+
* Natural Colors: (B4, B3, B2) = (3,2,1)
 +
* False-Color Infrared: (B8, B4, B3) = (7,3,2)
 +
* False-Color Urban: (B12, B11, B4) = (10,9,3)
 +
* Agriculture: (B11, B8, B2) = (9,7,1)
 +
* Atmospheric Penetration: (B12, B11, B8A) = (10,9,8)
 +
* Healthy Vegetation: (B8, B11, B2) = (7,9,1)
 +
* Land/Water: (B8, B11, B4) = (7,9,3)
 +
* Natural with Atmospherical Removal: (B12, B8, B3) = (10,7,2)
  
==Render Type: Singleband gray==
+
Color composites and single band raster files may be enhanced in {{mitem|text=Layer --> Layer Properties --> Symbology}}. Unfold the '''Min / Max Value Settings'''. As default a tail clip of the lower 2% and upper 2% counts of the cumulative band histograms is activated. Choose the '''Statistics extent''' {{button|text=Current canvas}}. Only the values inside the cuurent image extent shown in the map canvas are now considered. For '''Accuracy'''  choose {{button|text=Actual (slower)}}. The image display is enhanced by a linear stretch with tail clipping adopted to the histogram of current map canvas.
:A '' '''grayscale''' image is an image with a pixel depth of 8 bit, which means that eight [[Wikipedia:Bit|bits]] are used to represent a single pixel. In QGIS we have the possibility to display raster maps in grayscale via the [[raster layer properties]].'' See also [[Wikipedia:Grayscale|“Grayscale” on Wikipedia]]
+
  
It makes sense to display a map in greyscale if only one band is available. By default, the scale is calculated by QGIS based on the map itself. Common satellite bands have a data range from '''0''' to '''255'''.
+
[[File:Qgis_linear_contrast_stretch.png|600px]]
:When displayed in grayscale, '''0''' is interpreted as '''black''' and '''255''' as '''white'''.
+
 
+
In QGIS we can also use the [[standard deviation]] of the raster pixels to calculate the scale. In connection with contrast enhancement (the option “Stretch to MinMax” does a good job) this can give a better result, as the scale is not affected by extreme pixel values.
+
 
+
<gallery widths=450px heights=360px>
+
File:Etm40_grey.jpg|Band 4 of a LANDSAT image in grayscale. Most pixels have a very low value, resulting in a dark display.
+
File:Etm40_grey_stdev.jpg|The same image in grayscale based on standard deviation (2.50) and contrast enhancement.
+
</gallery>
+
  
 +
# Select the radio button {{button|text=Mean +/- standard deviation x}} radio button. Adjust the standard deviation factor (a value between 1 and 2), confirm with {{button|text=Apply}}. Evaluate the image display in the map canvas.
 +
Note, same effects but much faster can be reached by using the Raster Toolbar of the main Menu:
 +
#*[[File:Qgis_cum_stretch.png]] Linear stretch using 2% cumulative count
 +
#*[[File:Qgis_stdev_stretch.png]] Linear stretch clipping the mean +/- 2 * standard deviation
  
 +
==Render Type: Singleband gray==
  
  
Line 32: Line 45:
 
:'' '''Pseudocolor''' is not to be mistaken for  [[Color  composites|'''false color''']], the latter one being a composite of  three bands.'' See also: [[Wikipedia:Pseudocolor#Pseudo-color|Pseudocolor in Wikipedia]]
 
:'' '''Pseudocolor''' is not to be mistaken for  [[Color  composites|'''false color''']], the latter one being a composite of  three bands.'' See also: [[Wikipedia:Pseudocolor#Pseudo-color|Pseudocolor in Wikipedia]]
  
Pseudocolor is a way to display a raster map in which the color scale is derived from a single [[grayscale]] band.  
+
Pseudocolor is a way to display a raster map in which the color scale is derived from a single [[grayscale]] band. It can be a good alternative to grayscale if it comes to display metric data like spectral indices, elevation or temperature.
It can be a good alternative to grayscale if it comes to display metric data like elevation or temperature.
+
 
+
To change map color and symbology, again select the layer in the [[TOC]] with a right click and select {{mitem|text=Properties --> Style}}. From the pulldown menu {{button|text=Render type}}, select {{button|text=Singleband pseudocolor}}.
+
A different menu will come up, where you may select the style of the color map in the section {{button|text=Generate new color map}}. Click {{button|text=classify}} and confirm with {{button|text=Apply}} or {{button|text=OK}}. The map should now appear in the selected style ('''figure C''').
+
 
+
[[Image:RemSens_Exercise01_3.png|450px|thumb|center|'''Figure C''': Landsat map displayed in pseudocolor]]
+
  
 +
To change map color and symbology, select the layer (e.g. a single band Sentinel-2 image) in the [[TOC]] with a right click and select {{mitem|text=Properties --> Symbology}}. From the pulldown menu '''Render type''', select {{button|text=Singleband pseudocolor}}.
 +
A different menu will come up, where you may select different '''Color ramps'''. Click {{button|text=Classify}} and {{button|text=OK}}. The single band raster should now appear with the selected color table ('''figure C''').
  
 +
[[Image:RemSens_Exercise01_3.png|600px|thumb|center|'''Figure C''': Sentinel-2 single band B03 displayed in pseudocolor]]
  
 
==Set Transperancy==
 
==Set Transperancy==
  
 
[[Category:Working with Raster Data]]
 
[[Category:Working with Raster Data]]

Latest revision as of 11:36, 27 October 2021

Display of raster data in the map canvas can be enhanced using linear histogram stretching. Useful Raster tools are not activated by default. Right click on the main QGIS menu and activate the checkbox as seen on the screenshot. A new Raster Toolbar is now available on the main menu.

Qgis Activate Raster Toolbar.png.

Contents

[edit] Render type: multiband file

  1. Click the Open Data Source Manager QGIS 3.0 datasource.png and then Add raster layer QGIS 2.0 addrast.png and select a virtual stack or a multiband raster file.
  2. After clicking Open, the raster layer appears on the QGIS canvas.
  3. Right click the layer name in the Layer Panel and select Properties --> Symbology.
  4. Change the assignment of Red, Green, Blue to band numbers and create color composites.

Attention: usually the assignment refers to the original spectral band numbers which might be a different rank in the multiband file. Pick the corresponding No. according to the rank in the multiband file.

Qgis band assign.png
  • True Color composite.
    • Red band: Original B4, BandNo. 3
    • Green band: Original B3, BandNo.2
    • Blue Band: Original B2, BandNo. 1

In case of the Sentinel-2 example file this is a typical True Color composite.

Try other band combinations and produce false color composites.


  • Natural Colors: (B4, B3, B2) = (3,2,1)
  • False-Color Infrared: (B8, B4, B3) = (7,3,2)
  • False-Color Urban: (B12, B11, B4) = (10,9,3)
  • Agriculture: (B11, B8, B2) = (9,7,1)
  • Atmospheric Penetration: (B12, B11, B8A) = (10,9,8)
  • Healthy Vegetation: (B8, B11, B2) = (7,9,1)
  • Land/Water: (B8, B11, B4) = (7,9,3)
  • Natural with Atmospherical Removal: (B12, B8, B3) = (10,7,2)

Color composites and single band raster files may be enhanced in Layer --> Layer Properties --> Symbology. Unfold the Min / Max Value Settings. As default a tail clip of the lower 2% and upper 2% counts of the cumulative band histograms is activated. Choose the Statistics extent Current canvas. Only the values inside the cuurent image extent shown in the map canvas are now considered. For Accuracy choose Actual (slower). The image display is enhanced by a linear stretch with tail clipping adopted to the histogram of current map canvas.

Qgis linear contrast stretch.png

  1. Select the radio button Mean +/- standard deviation x radio button. Adjust the standard deviation factor (a value between 1 and 2), confirm with Apply. Evaluate the image display in the map canvas.

Note, same effects but much faster can be reached by using the Raster Toolbar of the main Menu:

    • Qgis cum stretch.png Linear stretch using 2% cumulative count
    • Qgis stdev stretch.png Linear stretch clipping the mean +/- 2 * standard deviation

[edit] Render Type: Singleband gray

[edit] Render Type: Singleband pseudocolor

Pseudocolor is not to be mistaken for false color, the latter one being a composite of three bands. See also: Pseudocolor in Wikipedia

Pseudocolor is a way to display a raster map in which the color scale is derived from a single grayscale band. It can be a good alternative to grayscale if it comes to display metric data like spectral indices, elevation or temperature.

To change map color and symbology, select the layer (e.g. a single band Sentinel-2 image) in the TOC with a right click and select Properties --> Symbology. From the pulldown menu Render type, select Singleband pseudocolor. A different menu will come up, where you may select different Color ramps. Click Classify and OK. The single band raster should now appear with the selected color table (figure C).

Figure C: Sentinel-2 single band B03 displayed in pseudocolor

[edit] Set Transperancy

Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export