i.gensig
Generates statistics for i.maxlik from raster map.
i.gensig trainingmap=name group=name subgroup=name signaturefile=name [--overwrite] [--verbose] [--quiet] [--qq] [--ui]
Example:
i.gensig trainingmap=name group=name subgroup=name signaturefile=name
grass.script.run_command("i.gensig", trainingmap, group, subgroup, signaturefile, overwrite=False, verbose=False, quiet=False, superquiet=False)
Example:
gs.run_command("i.gensig", trainingmap="name", group="name", subgroup="name", signaturefile="name")
Parameters
trainingmap=name [required]
Ground truth training map
group=name [required]
Name of input imagery group
subgroup=name [required]
Name of input imagery subgroup
signaturefile=name [required]
Name for output file containing result signatures
--overwrite
Allow output files to overwrite existing files
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
trainingmap : str, required
Ground truth training map
Used as: input, raster, name
group : str, required
Name of input imagery group
Used as: input, group, name
subgroup : str, required
Name of input imagery subgroup
Used as: input, subgroup, name
signaturefile : str, required
Name for output file containing result signatures
Used as: output, sigfile, name
overwrite: bool, optional
Allow output files to overwrite existing files
Default: False
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
i.gensig is a non-interactive method for generating input into i.maxlik. It can be used as the first pass in the GRASS two-pass classification process (instead of i.cluster or g.gui.iclass). It reads a raster map layer, called the training map, which has some of the pixels or regions already classified. i.gensig will then extract spectral signatures from an image based on the classification of the pixels in the training map and make these signatures available to i.maxlik.
The user would then execute the GRASS program i.maxlik to actually create the final classified map.
This module generates signature files of type "sig". Use module i.signatures to manage generated signature files.
All raster maps used to generate signature file can have semantic label set. Use r.support to set semantic labels of each member of the imagery group. Signatures generated for one scene are suitable for classification of other scenes as long as they consist of same raster bands (semantic labels match).
Input trainingmap map must be prepared by the user in advance using vector or raster digitizer. Of course other methods could be devised by the user for creating this training map - i.gensig makes no assumption about the origin of this map layer. It simply creates signatures for the classes defined in the training map for the image to be classified (the image is specified in other options - see below). The wxGUI vector digitizer can be used for interactively creating the training map.
Input group is the name of the group that contains the band files which comprise the image to be analyzed. The i.group command is used to construct groups of raster layers which comprise an image.
Input subgroup names the subgroup within the group that selects a subset of the bands to be analyzed. The i.group command is also used to prepare this subgroup. The subgroup mechanism allows the user to select a subset of all the band files that form an image.
Input signaturefile is the resultant signature file (containing the means and covariance matrices) for each class in the training map that is associated with the band files in the subgroup select. Resultant signature file can be used with any other imagery group as long as semantic labels match.
NOTES
The structure of the SIG files generated by i.gensig is as follows
(ASCII file, used internally by i.maxlik):
Note: the line numbers are not present in the file but have been added
here for explanation only:
SIG file "lsat7_2000_gensig":
1 1
2 #
3 Semantic_label1
4 #water
5 4186
6 67.9508 48.7346 37.8915 15.3129 13.8473 12.0855
7 1.74334
8 0.439504 2.07267
9 0.662523 1.63501 4.21189
10 0.530339 2.40757 5.52857 22.433
11 0.561184 2.30762 5.18846 20.5364 20.4926
12 0.393218 1.2184 2.63628 9.61528 9.36025 5.85314
- Line 1: version number (currently always 1)
- Line 2: text label
- Line 3: Space separated list of semantic labels
- Line 4: text label of class
- Line 5: number of points in class
- Line 6: mean values per band of the class
- Line 7-12: (semi)-matrix of band-band covariance
SEE ALSO
r.support, g.gui.iclass, i.group, i.cca, i.maxlik, i.smap, r.info, r.univar, wxGUI vector digitizer
AUTHORS
Michael Shapiro, U.S.Army Construction Engineering Research Laboratory
Semantic label support: Maris Nartiss, University of Latvia
SOURCE CODE
Available at: i.gensig source code
(history)
Latest change: Wednesday Mar 19 14:27:15 2025 in commit a56e76f