Data type conversion

From AWF-Wiki
(Difference between revisions)
Jump to: navigation, search
 
(16 intermediate revisions by one user not shown)
Line 1: Line 1:
We may change the data type (or radiometric resolution) of a raster layer.  
+
We may change the data type (and radiometric resolution) of a raster layer.  
# Click the {{button|text=Add raster layer}} [[Image:QGIS_2.0_addrast.png|20px]] and select a single band file  ''C:/OSGeo4W64/geodata/raster/s2/Subset_S2A_MSIL2A_20170619T_B03.tif''. This is the spectral green band with the data type '''UInt16 - Sixteen bit unsigned integer Unsigned Integer''' with the value range 0 to 65535 (Check the [[Raster metadata]]). We would like to convert the raster to data type '''Byte - eight bit unsigned integer''',  value range 0 to 255.
+
# Click the {{button|text=Add raster layer}} [[Image:QGIS_2.0_addrast.png|20px]] and select a multiband raster with data type '''UInt16'''. Convert to data type '''uint8 (8bit unsigned integer)''',  value range 0 to 255.
# Click {{button|text=Open}}, and the raster layer appears on the QGIS canvas.
+
# In processing toolbar, type {{typed|text=dynamic}} into the search field to find the {{button|text=Orfeo Toolbox --> Image Manipulation --> DynamicConvert}} tool.  
# In the processing toolbar, type {{typed|text=Rescale}} into the search field to find the {{button|text=Orfeo Toolbox --> Image Manipulation --> Rescale Image)}} tool. Open it with a double click.  
+
# Open with a double click. Specify the input and a new output file name as shown in the screenshot.
Specify a new output file name as shown in the screenshot below.
+
# Set High cut quantile and Low cut quantile to {{typed|text=0}}
 +
# Output min value = '''0''', Output max value = '''255'''
 +
# Click '''Advanced parameters''' and define Output pixel type {{button|text=uint8}}.
 +
# Click {{button|text=Run}}.
 +
 
 
[[File:Qgis_rescale.png|400px]]
 
[[File:Qgis_rescale.png|400px]]
The output Image raster is now recoded to correct eight bit data range but the data type is now '''Float32 - Thirty two bit floating point''
 
# In the processing toolbar, type {{typed|text=Convert data}} into the search field to find the {{button|text=SAGA --> RAster tools --> Convert data storage)}} tool. Open it with a double click.
 
Specify
 
* Data storage type: {{button|text=[1] unsigned 1 byte integer}}
 
* Converted grid: a new output file name.
 
[[File:Qgis_convert_data_storage.png|400px]]
 
Click {{button|text=Run}}.
 
  
 +
The output Image raster is now recoded and saved to unsigned eight bit. Which file size has the input image and the output image?
 
[[Category:Working with Raster Data]]
 
[[Category:Working with Raster Data]]

Latest revision as of 11:22, 27 October 2021

We may change the data type (and radiometric resolution) of a raster layer.

  1. Click the Add raster layer QGIS 2.0 addrast.png and select a multiband raster with data type UInt16. Convert to data type uint8 (8bit unsigned integer), value range 0 to 255.
  2. In processing toolbar, type dynamic into the search field to find the Orfeo Toolbox --> Image Manipulation --> DynamicConvert tool.
  3. Open with a double click. Specify the input and a new output file name as shown in the screenshot.
  4. Set High cut quantile and Low cut quantile to 0
  5. Output min value = 0, Output max value = 255
  6. Click Advanced parameters and define Output pixel type uint8.
  7. Click Run.

Qgis rescale.png

The output Image raster is now recoded and saved to unsigned eight bit. Which file size has the input image and the output image?

Personal tools
Namespaces

Variants
Actions
Navigation
Development
Toolbox
Print/export