I generate a Vegetation Index (VI) with a script and write the resulting 2d array into a .TIF file. When I load it into QGIS, I get the following result:
As you can see, the raster looks very 'granular'. I would like to simplify the raster by grouping large groups of pixels and removing very small 'islands' of pixels. Is there a tool in QGIS available to do this?
EDIT: I am using the suggested Majority Filter of SAGA. In the log, I get the following error however:
QGIS version: 3.16.4-Hannover
Qt version: 5.12.8
GDAL version: 3.2.1
GEOS version: 3.9.0-CAPI-1.16.2
PROJ version: Rel. 7.2.1, January 1st, 2021
SAGA version 7.3.0 is not officially supported - algorithms may encounter issues
Processing algorithm…
Algorithm 'Majority filter' starting…
Input parameters:
{ 'INPUT' : '/home/sytze/Code/DeepLabV3Plus_implementation-single-class/my_mask.tif', 'MODE' : 0, 'RADIUS' : 1, 'RESULT' : 'TEMPORARY_OUTPUT', 'THRESHOLD' : 0 }
grid_filter "Majority Filter" -INPUT "/tmp/processing_DbxJIV/824e2db5d3434b009d4140e50b49825a/mymask.sgrd" -MODE 0 -RADIUS 1 -THRESHOLD 0 -RESULT "/tmp/processing_DbxJIV/a99c9a0147ce45679fcee5414f3d266f/RESULT.sdat"
____________________________
## #####
### ##
# ## ## #### #
##### ## #
# ## ##### #
SAGA Version: 7.3.0
Library: Filter
Category: Grid
File: /usr/lib/x86_64-linux-gnu/saga/libgrid_filter.so
Description:
Tools for the manipulation of gridded data.
Tools:
[0] Simple Filter
[1] Gaussian Filter
[2] Laplacian Filter
[3] Multi Direction Lee Filter
[4] User Defined Filter
[5] Filter Clumps
[6] Majority/Minority Filter
[7] DTM Filter (slope-based)
[8] Morphological Filter
[9] Rank Filter
[10] Mesh Denoise
[11] Resampling Filter
[12] Geodesic Morphological Reconstruction
[13] Binary Erosion-Reconstruction
[14] Connectivity Analysis
[15] Sieve Classes
[16] Wombling (Edge Detection)
[17] Wombling for Multiple Features (Edge Detection)
[18] Simple Filter (Restricted to Polygons)
Tool Chains: Grid Filters
Description:
Filters for grids.
Tools:
[SieveAndClump] Sieve and Clump
[grid_notch_filter] Notch Filter for Grids
[grid_list_simple_filter] Simple Filter for Multiple Grids
Error: select a tool
type -h or --help for further information
Execution completed in 0.57 seconds
Results:
{'RESULT': '/tmp/processing_DbxJIV/a99c9a0147ce45679fcee5414f3d266f/RESULT.sdat'}
Loading resulting layers
The following layers were not correctly generated.
• /tmp/processing_DbxJIV/27317bdae6e44f098ae6f732f727637c/RESULT.sdat
• /tmp/processing_DbxJIV/a99c9a0147ce45679fcee5414f3d266f/RESULT.sdat
You can check the 'Log Messages Panel' in QGIS main window to find more information about the execution of the algorithm.







