Raster histogram

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
(Using Layer Properties)
 
(10 intermediate revisions by one user not shown)
Line 1: Line 1:
 
== Using Layer Properties ==
 
== Using Layer Properties ==
# Click the {{button|text=Add raster layer}} [[Image:QGIS_2.0_addrast.png|20px]] and select the file  ''C:/OSGeo4W64/geodata/raster/s2/Subset_S2A_MSIL2A_20170619T.tif''.
+
# 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 single or a multiband band raster file.
 
# After clicking {{button|text=Open}} , the raster layer appears on the QGIS canvas.
 
# After clicking {{button|text=Open}} , the raster layer appears on the QGIS canvas.
 
# Right click the layer name in the Layers panel and select {{mitem|text=Properties --> Histogram}}
 
# Right click the layer name in the Layers panel and select {{mitem|text=Properties --> Histogram}}
This dialog displays a histogram for all bands band. Left click and drag a box on the diagram to zoom in.
+
# Click {{button|text=Compute Histogram}}. A histogram for all bands is displayed (Figure '''A'''). Left click and drag a box on the diagram to zoom in. [[File: Qgis_histogram_multiband.png|thumb|left|200px|'''Figure A:''' Line histograms of all bands]]
Click on {{button|text=Pref/Actions}} and activate ''Draw as lines'' (Figure '''A''').
+
[[File: Qgis_histogram_multiband.png|thumb|left|200px|'''Figure A:''' Line histograms of all bands]]
+
 
Click on {{button|text=Pref/Actions}} and deactivate ''Draw as lines''. Activate ''Show selected band'' and ''Always show min/max markers''.
 
Click on {{button|text=Pref/Actions}} and deactivate ''Draw as lines''. Activate ''Show selected band'' and ''Always show min/max markers''.
 
The value range of the selected band data is evenly divided into bins. The histogram shows how many pixels of the image fall into each of the bins (Figure '''B''')[[File: Qgis_histogram_singleband.png|thumb|right|200px|'''Figure B:''' Histogram of a single selected band]]. Click on [[File: Qgis_save_icon.png|20px]]. The graphics may be saved as png file.
 
The value range of the selected band data is evenly divided into bins. The histogram shows how many pixels of the image fall into each of the bins (Figure '''B''')[[File: Qgis_histogram_singleband.png|thumb|right|200px|'''Figure B:''' Histogram of a single selected band]]. Click on [[File: Qgis_save_icon.png|20px]]. The graphics may be saved as png file.
 
== Using R scripts ==
 
# If the processing toolbox is not visible, select {{mitem|text=Processing --> Toolbox}}.
 
# In the processing toolbar, type {{typed|text=Get R scripts}} into the search field and click to open it. In the ''Install scripts and model windows'' unfold the folder ''Not installed'' and activate ''Advanced histogram'' as shown below in the screenshot. Click {{button|text=OK}}.
 
[[File:Qgis_Get_Rscripts.png|200px]].
 
# In the processing toolbar, type {{typed|text=Get R scripts}} into the search field and click to open the diaolog window. Specify the Input raster Layer and click the button {{button|text=...}} on to select the path and filename for the output graphics file. Click {{button|text=Run}}.
 
[[File:Qgis_advanced_histogram.png|400px]].
 
Be patient and have a look on the messages in the log window as some additional R packages need to be downloaded. The resulting graphics shows all histograms side by side.
 
[[File:histogram_result.png|400px]]
 
 
[[Category: Working with Raster Data]]
 
[[Category: Working with Raster Data]]

Latest revision as of 12:44, 2 November 2020

[edit] Using Layer Properties

  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 single or a multiband band raster file.
  2. After clicking Open , the raster layer appears on the QGIS canvas.
  3. Right click the layer name in the Layers panel and select Properties --> Histogram
  4. Click Compute Histogram. A histogram for all bands is displayed (Figure A). Left click and drag a box on the diagram to zoom in.
    Figure A: Line histograms of all bands

Click on Pref/Actions and deactivate Draw as lines. Activate Show selected band and Always show min/max markers.

The value range of the selected band data is evenly divided into bins. The histogram shows how many pixels of the image fall into each of the bins (Figure B)
Figure B: Histogram of a single selected band
. Click on Qgis save icon.png. The graphics may be saved as png file.
Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export