Polyploidbreeding

Logo

PRIN 2022 (Settore LS2)



Start date: 28 September 2023

End date: 27 September 2025


Logo_EU

Latest from the project

Using QGIS: basic introduction - 2

QGIS TUTORIAL - 2: subsetting an image

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.

Subsetting images with QGIS

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:

Example orthomosaic image of an agricultural field

Figure: Orthomosaic RGB image file of an agricultural field and its superimposed shape file of individual plots

Now 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:

You will get the following clipped region (black shaded) that is your extracted region:

Clipped orthomosaic image of an agricultural field

Figure: Clipped orthomosaic image extracted from the newly defined shape file


You need to deselect the layer corresponding to the original image (the orthomosaic) and then save it:

You are done!

Extracted region from the orthomosaic

Figure: Extracted region (subset) of the orthomosaic image