iminsert: Insert an image into another by either adding,
Package: imgtools
Usage
iminsert input1 input2 output option coordfile
Description
This task will copy the image passed to 'input1' into an output image. The image passed to 'input2' is then inserted into the output image at the position specified in 'coordfile'; only the overlapping area will be changed. Multiple copies of 'input2' will be inserted into the output image if 'coordfile' contains more than one pair of coordinates. All images are assumed to be 2-dimensional.
Parameters
- input1 [file name]
- Name of the larger input image. This is the image into which the smaller image will be inserted.
- input2 [file name]
- Name of the smaller image that is to be inserted into 'input1'.
- output [file name]
- The output image created by merging 'input2' into 'input1'.
- option = replace [string, allowed values: replace | add | multiply]
- Method used to insert the small image into the larger image. The option "replace" will cause pixel values in 'input1' to be replaced by the values in 'input2' at overlapping positions. The "add" option causes new pixel values to be added to existing values, and the "multiply" option causes the two values to be multiplied with the result going in the output image.
- coordfile [string]
- A file which gives X and Y coordinates at which the insertion is to take place. The file may be either a reseau table, a cursor table, or a text file. One copy of 'input2' will be inserted into the output image for each X,Y pair in 'coordfile'. The X,Y values are taken to be the pixel coordinates in the output image where the first pixel ([1,1]) of 'input2' is to be placed. Real values will be rounded to the nearest integer. See also 'offset1' and 'offset2'. For a text file or a cursor table, two columns are read, with column names given by the parameters 'xcol' and 'ycol'. For a text file "c1" and "c2" may be the appropriate column names. There may be many rows in the file, each one of which results in one copy of 'input2' in the output image. For a reseau table, 'xcol' and 'ycol' are ignored, and 'entry' is used to determine which row to read. The row will typically contain many reseau positions; 'input2' will be inserted into the output at each reseau position. For information about using reseau tables, see the help files in the 'focgeom' package. For information about using a cursor table, see the help file for the 'tvcursor' task in the 'vdisplay' package.
- (offset1 = 0) [integer]
- Offset to be added to X coordinates.
- (offset2 = 0) [integer]
- Offset to be added to Y coordinates.
- (xcol = c1) [string]
- This is not used if 'coordfile' is a reseau table. Name of the column from which X coordinates will be read. The default value "c1" is appropriate if 'coordfile' is a text file, and the X coordinates are in the first column.
- (ycol = c2) [string]
- This is not used if 'coordfile' is a reseau table. Name of the column from which Y coordinates will be read. The default value "c2" is appropriate if 'coordfile' is a text file, and the Y coordinates are in the second column.
- (entry = *) [string]
- Name of the reseau entry to use if 'coordfile' is a reseau table. This is ignored if 'coordfile' is a cursor table or text file.
Examples
1. Create the image "out", which is a copy of the image "big", except that at the coordinates specified in the text file "coords.dat" the values are replaced by the pixel values of the image "small".
im> iminsert big small out replace coords.dat
Bugs
See also
reseau_files, focgeom, tvcursor