PRIN 2022 (Settore LS2)
Start date: 28 September 2023
End date: 27 September 2025
We follow up on our previous post on the basic use of the QGIS software, and show now how you can subset a large image and extract a small region of it.
From drone phenotyping experiments, orthomosaic image files tend to be quite large, in the order of several gigabytes: large field plots, high resolution (e.g. 1 pixel = 1 cm), multiple channels … your image size quickly skyrockets!
Any operation with such files becomes cumbersome, and you need specialised software, like QGIS, to do the job.
This holds also when you want to extract a small region from a large image file, e.g. a single plot from a crop field.
Remeber, when you work with drone-captured images, you typically have at least two files:
Optionally, you can also have a .tfw file with geographical coordinates (e.g. latitude, longitude) to georeference GeoTIFF raster image files. The tfw file is typically a very small file.
You first need to open your .tif orthomosaic image file with QGIS, and then add the corresponding shape file (already created: see previous post):
From the software menu bar:
Layer
> Add Layer
> Add Raster Layer
, and select the input .tiff/.tif image fileLayer
> Add Layer
> Add Vector Layer
, and select as source the .shp shape fileNow it’s time to start subsetting the orthomosaic using the shape file: we will select a few plots and extract them.
To do so, you need to highlight the shape layer, and then click on the button Select Features by Area or Single Click
from the top menu bar of QGIS.
This will allow you to select one or multiple (by pressing the shift
key) plots (e.g. one row) by left-clicking with your mouse:
the selected shapes will appear in yellow (in this example we selected the first three plots, from the top left corner, of the first row).
You now need to save this new shape file: Layer
> Save as
> FORMAT
= shapefile, then choose a filename and a place in your file system to save it.
With the new shapefile, you can extract the corresponding region/subset of the orthomosaic:
Raster
> Extraction
> Clip Raster by Mask Layer
Input layer
(the orthomosaic) and Mask layer
(the new reduced shape file) and RUN!You will get the following clipped region (black shaded) that is your extracted region:
You need to deselect the layer corresponding to the original image (the orthomosaic) and then save it:
Layer
> Sqve As
> FORMAT
= GeoTIFFCreate Options
> +
> and write Name: tfw
; Value: yes
You are done!