i.rectify(1grass)

๐Ÿ’– i.rectify ๐Ÿ’–

okay so bestie, welcome to i.rectify from the GRASS User's Manual โ€” this is the one that rectifies an image by computing a coordinate transformation for each pixel in the image based on the control points. she's giving geometry glow-up โœจ


๐Ÿท๏ธ KEYWORDS ๐Ÿท๏ธ

imagery, rectify, geometry โ€” that's the vibe check right there ๐Ÿฆ‹


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

i.rectify
i.rectify --help
i.rectify [-cat] group=name  [input=name[,name,...]]  extension=string
order=integer  [resolution=float]   [memory=memory in MB]
[method=string]   [--help]  [--verbose]  [--quiet]  [--ui]

๐ŸŽ€ Flags ๐ŸŽ€

  • -c โ€” use current region settings in target location (def.=calculate smallest area)
  • -a โ€” rectify all raster maps in group
  • -t โ€” use thin plate spline
  • --help โ€” print usage summary
  • --verbose โ€” verbose module output
  • --quiet โ€” quiet module output
  • --ui โ€” force launching GUI dialog

๐Ÿ“ Parameters ๐Ÿ“

  • group=name [required] โ€” name of input imagery group
  • input=name[,name,...] โ€” name of input raster map(s)
  • extension=string [required] โ€” output raster map(s) suffix
  • order=integer [required] โ€” rectification polynomial order (1-3)
    • Options: 1-3
    • Default: 1
  • resolution=float โ€” target resolution (ignored if -c flag used)
  • memory=memory in MB โ€” maximum memory to be used (in MB)
    • Cache size for raster rows
    • Default: 300
  • method=string โ€” interpolation method to use
    • Options: nearest, linear, cubic, lanczos, linear_f, cubic_f, lanczos_f
    • Default: nearest

โœจ DESCRIPTION โœจ

So here's the tea ๐Ÿ‘‘: i.rectify uses the control points included in the source data, or the ones you identified with the Ground Control Points Manager, to calculate a transformation matrix, and then it converts x,y cell coordinates into standard map coordinates for every single pixel in the image. The glow-up result? A planimetric image with a transformed coordinate system โ€” i.e., a different coordinate system than before it was rectified. The supported transformation methods are first, second, and third order polynomial, plus thin plate spline. Thin plate spline is the recommended one for ungeoreferenced satellite imagery where ground control points (GCPs) are included. Examples are NOAA/AVHRR and ENVISAT imagery, which include thousands of GCPs. no cap ๐Ÿ”ฅ

If you have zero ground control points available, you must run the Ground Control Points Manager before i.rectify. An image has to be georeferenced before it can reside in a standard coordinate project, and therefore be analyzed with the other map layers there. Once i.rectify finishes, the rectified image gets deposited in the target standard coordinate project. That project is selected using i.target. choose wisely bestie ๐Ÿ’…

More than one raster map may be rectified at a time โ€” multiply the slay. Each cell file should be given a unique output file name. The rectified image, or rectified raster maps, will be located in the target project when the program is completed. And good news: the original unrectified files are not modified or removed. we love a non-destructive queen ๐Ÿซถ

If the -c flag is used, i.rectify will only rectify that portion of the image or raster map that occurs within the chosen window region in the target project, and only that portion of the cell file will be relocated in the target database. So it's important, therefore, to check the current mapset window in the target project if the -c flag is used. go look, don't assume ๐Ÿ‘€

If you're rectifying a file with plans to patch it to another file using the GRASS program r.patch, choose option number one โ€” the current window in the target project. This window, however, must be the default window for the target project. When a file being rectified is smaller than the default window in which it is being rectified, NULLs are added to the rectified file. Patching files of the same size that contain NULL data eliminates the possibility of a no-data line in the patched result. Why? Because when the images are patched, the NULLs in the image are "covered" with non-NULL pixel values. So when rectifying files that are going to be patched: rectify all of the files using the same default window. consistency is the moment โญ

๐Ÿงฎ Coordinate transformation ๐Ÿงฎ

The desired order of transformation (1, 2, or 3) is selected with the order option. The program will calculate the RMSE and check the required number of points. math girlies rise ๐Ÿ™ˆ

๐Ÿ“ Linear affine transformation (1st order transformation) ๐Ÿ“

xโ€™ = ax + by + c
yโ€™ = Ax + By + C

The a, b, c, A, B, C are determined by least squares regression based on the control points entered. This transformation applies scaling, translation and rotation. It is NOT a general purpose rubber-sheeting like TPS, nor is it ortho-photo rectification using a DEM, not second order polynomial, etc. It can be used if (1) you have geometrically correct images, and (2) the terrain or camera distortion effect can be ignored. know the limits, bestie ๐Ÿ’€

๐Ÿ”ข Polynomial Transformation Matrix (2nd, 3d order transformation) ๐Ÿ”ข

i.rectify uses a first, second, or third order transformation matrix to calculate the registration coefficients. The number of control points required for a selected order of transformation (represented by n) is ((n + 1) * (n + 2) / 2) โ€” that's 3, 6, and 10 respectively. It is strongly recommended that one or more additional points be identified, to allow for an overly-determined transformation calculation which will generate the Root Mean Square (RMS) error values for each included point. The RMS error values for all the included control points are immediately recalculated when the user selects a different transformation order from the menu bar. The polynomial equations are performed using a modified Gaussian elimination method. extra points = extra peace of mind ๐Ÿ’–

๐Ÿฆ‹ Thin plate spline (TPS) transformation ๐Ÿฆ‹

TPS transformation is selected with the -t flag. This method of coordinate transformation is recommended for satellite imagery where hundreds or thousands of GCPs are included, and for historical printed or scanned maps with unknown georeferencing and/or known localized distortions. it's giving chaos โ†’ curated โœจ

TPS combines a linear affine transformation with individual transformation coefficients for each GCP, using the radial basis kernel function with the distance dist between any two points:

dist2 * log(dist)

As a consequence, localized distortions can be removed with TPS transformation. For example, scan line sensors will have, due to the changing viewing angle, larger distortions towards the end points of the scan line than at the center of the scan line. Even higher order polynomial transformations are not able to remove these locally different distortions, but TPS transformation can. For best results, TPS requires an even and, for localized distortions, dense spacing of GCPs. dense grid = main character energy ๐Ÿ‘‘

๐ŸŒธ Resampling method ๐ŸŒธ

The rectified data is resampled with one of seven different methods: nearest, bilinear, cubic, lanczos, bilinear_f, cubic_f, or lanczos_f.

The method=nearest method, which performs a nearest neighbor assignment, is the fastest of the resampling methods. It is primarily used for categorical data such as a land use classification, since it will not change the values of the data cells. The method=bilinear method determines the new value of the cell based on a weighted distance average of the 4 surrounding cells in the input map. The method=cubic method determines the new value of the cell based on a weighted distance average of the 16 surrounding cells in the input map. The method=lanczos method determines the new value of the cell based on a weighted distance average of the 25 surrounding cells in the input map. 4, 16, 25 โ€” the numbers are numbering ๐Ÿ”ฅ

The bilinear, cubic and lanczos interpolation methods are most appropriate for continuous data and cause some smoothing. These options should not be used with categorical data, since the cell values will be altered. (yes that's a warning, do not do it, your land use classes will not survive ๐Ÿ’€)

In the bilinear, cubic and lanczos methods, if any of the surrounding cells used to interpolate the new cell value are NULL, the resulting cell will be NULL, even if the nearest cell is not NULL. This will cause some thinning along NULL borders, such as the coasts of land areas in a DEM. The bilinear_f, cubic_f and lanczos_f interpolation methods can be used if thinning along NULL edges is not desired. These methods "fall back" to simpler interpolation methods along NULL borders. That is, from lanczos to cubic to bilinear to nearest. the _f stands for fallback-and-fabulous ๐Ÿ’…

If nearest neighbor assignment is used, the output map has the same raster format as the input map. If any of the other interpolations is used, the output map is written as floating point. heads up ๐ŸŽ€


๐Ÿ“ NOTES ๐Ÿ“

If i.rectify starts normally but after some time the following text is seen:

ERROR: Error writing segment file

the user may try the -c flag, or the module needs more free space on the hard drive. bestie, free up some disk space, she's suffocating ๐Ÿ˜ญ


๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • The GRASS 4 Image Processing manual
  • m.transform, r.proj, v.proj, i.group, i.target
  • Ground Control Points Manager

๐Ÿ’œ AUTHORS ๐Ÿ’œ

William R. Enslin, Michigan State University, Center for Remote Sensing

Modified for GRASS 5.0 by:

  • Luca Palmeri (palmeri@ux1.unipd.it)
  • Bill Hughes
  • Pierre de Mouveaux (pmx@audiovu.com)
  • CMD mode by Bob Covill

๐Ÿงš SOURCE CODE ๐Ÿงš

Available at: i.rectify source code (history)

Latest change: Tuesday Nov 11 15:17:03 2025 in commit: 59f1608a354cb5e6c1a7a5cc477633b8632d1774

Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index

ยฉ 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual


and that's the whole page, bestie ๐Ÿ’– this was i.rectify(1grass) from GRASS 8.5.0 โ€” go forth, rectify, and stay iconique ๐ŸŒˆ๐Ÿ‘‘โœจ

๐Ÿ“ฆ where this page comes from