Model

ROI-zeromean


image

Compute zero-mean values for polygon regions of interest (ROI) and count pixels below a threshold (default threshold: mean, can be adjusted by an offset). This model was developed for agricultural field trials (ROI were plots) but can be used in other contexts, too.

The algorithm computes the mean within each ROI, substracts it from the absolute values and additionally thresholds values above (was: below) at mean + thresho ld_offset. Useful to compare relative differences within ROIs, e.g. height differences of plant canopy within each field trial plot (derived from digital surface model DSM), independent of absolute height differences between plots (due to digial elevation DEM).

Inputs:

  • ROI polygon layer (regions of interest, e.g. field trial plots)
  • single band image (e.g. surface model, vegetation index)
  • threshold offset to adjust default mean

Outputs:

  • Layer and result file with file name of image extended by .meandiff.tif with substracted means (zero mean per plot)
  • Layer and result file with file name of image extended by .meandiff_thresh.tif with additionally thresholded layer
  • Layer result file with file name of ROI layer extended by .threshstat.gpkg with statistics

Attention: this model converts the inputs to a common metric CRS (UTM, EPSG:25832), this is parametrised as default and needs to be changed, if you want to use a different one. Pixel sizes are set to 0.02 units (2cm in a metric system).

Development via repository qgis-agriculture, contains example data.

30 May 2022
29 January 2025
29 January 2025
Weis
polygon raster image roi normalization

Thanks for sharing this!

Reviewed by timlinux 2 years, 9 months ago

Hi, thank you for your work. The model runs without errors if the ROI layer is on the same system as the project and the targetCRS parameter is left blank, or if the tragetCRS parameter is passed the same CRS as the project. Any other targetCRS causes the model to fail to run and is not what the description indicates (it is understood that the targetCRS is optional or can be changed arbitrarily). Also, for some reason unknown to me, the raster calculator does not take the CRS of the reference layers, which causes the roi-zeromean_meandiff output to come out without a CRS.

Reviewed by gabrieldeluca 6 months ago

Thank you very much. And thanks for including the repository and sample data.

Reviewed by gabrieldeluca 4 months, 1 week ago

gabrieldeluca approved these changes 4 months, 1 week ago

This Model is made available under the CC-0 license.

QGIS sustaining members

Flagship membership


Flagship membership


Large membership


Large membership


Large membership


Large membership


Large membership


Large membership


Large membership