1

I'm trying to understand more about how the i.segment algorithm works. Most importantly, does it use all of the available bands in an image? The documentation notes you must specify a group. When I dig into the i.group documentation a bit, it says:

i.group allows the user to collect raster map layers in an imagery group by assigning them to user-named subgroups or other groups. This enables the user to run analyses on any combination of the raster map layers in a group. The user creates the groups and subgroups and selects the raster map layers that are to reside in them.

From here it appears that raster maps can include multiple bands, so that was seem to suggest that a single input file in a group would have all of its bands considered. I don't really understand how weighting this layers is done either, or if I can just add as many layers as I want, and the algorithms decide for itself how to weight them and I can't?

And the example i.group group=vis_bands subgroup=vis_bands input=lsat7_2000_10,lsat7_2000_20,lsat7_2000_30 appears to be coming single band images; however I can see from the documentation you can do multiple. Do we need to group if we already have a multiband raster? Does it just combine the data into a single file?

I was trying source code but ultimately didn't understand it. My goal is to automated a lot of this, not run through QGIS or a like tool. I have been able to run it there, though I don't know a great way to validate it is even using all of the bands in a raster.

1
  • 1
    As per the help center please do not include chit chat like thanks within your posts.
    – PolyGeo
    Apr 1, 2022 at 18:35

1 Answer 1

2

The sort answer is yes, i.segment uses all all the raster maps that you included in the image group, by running i.group.

When you download satellite images (Landsat, Sentinel, etc) then each band is in a separate file, so when you import into GRASS, each grass raster is a single band. If you import a multiband raster (RGB aerial image for example) then GRASS splits the input to separate (single band) raster maps, typically adding ".1, .2" etc to the map names.

In both cases you then create an image group with all the rasters that you want to use in segmentation.

I would add that the segmentation result is sensitive to choosing the correct parameters. THere is a very helpful addon i.segment.uspo man page here that helps to choose those parameters. It runs an optimization procedure by repeatedly doing segmentation over a range of parameters (that you specifiy). This addon takes a while to complete, but it's probably worthwhile. Usuallly you would choose to run the optimization on a small, but representative subset of your study area.

HTH

2
  • I am using the GUI versions of i.segment and i.group and noticed the following. When selected a multi-band raster in i.segment it only used the first band for segmentation. Then I tried to first create a group from the multi-band raster (I don't know if this make sense) but it said that I should select more than one raster. So now I will try to split my multi-band raster file in separate files and select them all in the 'Input rasters' dialog of i.segment. Anyway, what is the right way to segment a multi-band tiff file using the GUI in QGIS 3.4.7?
    – ABC
    Feb 23 at 8:01
  • 1
    AS explained in the answer above, when you import a multiband raster into GRASS, it is split in separate GRASS rasters. So you need to create a group that includes all the imported bands, and send that group to i.segment. To check, before you run i.segment do: i.group -l <group_name> to see that all the bands are included in the group.
    – Micha
    Feb 23 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.