#include <tcl.h>
#include <tk.h>
#include <stdio.h>
#include <string.h>
#include <sadie.h>
#include "tclsadie.h"
Go to the source code of this file.
Defines | |
#define | MAX_POLY_TERM 6 |
#define | N_MOSAIC_IMAGES 2 |
Number of images to combine. | |
Functions | |
int | Sadie_Geometry_AvgSubCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Resample an image using the averages within a sliding rectangular window. | |
int | Sadie_Geometry_WinSubCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Extract a sub-image from an image, with optional scaling (by decimation). | |
int | Sadie_Geometry_ScaleCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Re-scale an image using cubic, bilinear, or nearest-neighbor interpolation. | |
int | Sadie_Geometry_RotateCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Rotate an image using cubic, bilinear, or nearest-neighbor interpolation. | |
int | Sadie_Geometry_MirrorCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Rotate or reflect an image by pre-defined amounts. | |
int | Sadie_Geometry_ContPtsCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Derive a best-fit polynomial from pairs of image and control points. | |
int | Sadie_Geometry_GeomWarpCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Use a previously determined polynomial distortion model to warp an image. | |
int | Sadie_Geometry_HMosaicCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Tile two images edge-to-edge horizontally, with an optional vertical offset. | |
int | Sadie_Geometry_VMosaicCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Tile two images edge-to-edge vertically, with an optional horizontal offset. | |
int | Sadie_Geometry_GenMosaicCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Combine multiple images into a single mosaic. | |
int | Sadie_Geometry_InsertCmd (ClientData client_data, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) |
Insert paste one image on top of another. | |
int | Sadie_Geometry_Init (Tcl_Interp *interp) |
Make the commands defined in this file accessible to the Tcl interpreter. |
The SADIE library provides some geometric transformations (from simple re-scalings and rotations to fitting polynomial distortion models with variable numbers of terms), and the corresponding re-sampling operations to generate the transformed images. For more details see Chapter 7, Section 4 "Distortion Correction" in R. A. Schowengerdt Remote Sensing (2nd. ed.) Academic Press: 1997. Here we define some interfaces to Tcl code, without adding any additional operations.
Definition in file Sadie_Geometry.c.
|
Resample an image using the averages within a sliding rectangular window. The SADIE library function RESAMPL resamples an image at the specified horizontal and vertical intervals via averages within a sliding rectangular window, whose size can also be specified. We set these parameters from Tcl variables and invoke it. The Tcl data should conform to the patterns:
Definition at line 83 of file Sadie_Geometry.c. |
|
Derive a best-fit polynomial from pairs of image and control points. Given a set of pairs of points (one in image coordinates, the other in the desired reference frame, such as ground control points in map coordinates), the SADIE library function GEOMCOEF determines a polynomial that defines a good mapping between the two coordinate frames, with "good" implying some minimum of the squared errors (defferences between actual point positions and those from the transformation defined by the polynomial). The number of point pairs used by GEOMCOEF can vary, as can the number of terms in the polynomial it generates (provided they are no ambiguities by having this greater than the number of point pairs), but when providing the coordiates via Tcl array elements we always give the maximum possible number and ignore those that are unnecesary. At the moment the polynomial terms end up in global arrays, horribly usafe from the point of re-entrancy or thread safety. The Tcl data should conform to the patterns:
Definition at line 363 of file Sadie_Geometry.c. |
|
Combine multiple images into a single mosaic. The SADIE library function MOSAIC can potentially combine various numbers of individual images into a mosaic, but this Tcl interface restricts these to one small constant (at the moment, only two images). It places the individual images at offsets specified in pixel units relative to the top left corner of the mosaic image, filling any otherwise blank areas with pixels of the specified greyvalue. The Tcl data should conform to the patterns:
Definition at line 593 of file Sadie_Geometry.c. |
|
Use a previously determined polynomial distortion model to warp an image. Given a distorted image and a series of polynomial terms that define the distortion relative to some reference frame, the SADIE library function GEOMWARP generates a new image representing the distorted image in the reference frame with the distortion removed, using interpolation guided by the distortion model. The option variable determines the interpolation technique: negative values for cubic interpolation (with the value being interpreted as the free parameter alpha for this method), zero values imply bilinear interpolation, and positive values nearest-neighbor interpolation. Note that the polynomial terms come from an uprotected global array, so there are issues with re-entrancy and thread safety. The Tcl data should conform to the patterns:
Definition at line 434 of file Sadie_Geometry.c. |
|
Tile two images edge-to-edge horizontally, with an optional vertical offset. The SADIE library function HMOSAIC creates a new image from two input images arranged next to each other horizontally, optionally staggering them in the vertical direction by the specified number of lines, and filling any spaces between the copied component images and their enclosing frame with pixels of the specified greyvalue. The Tcl data should conform to the patterns:
Definition at line 486 of file Sadie_Geometry.c. |
|
Make the commands defined in this file accessible to the Tcl interpreter.
Definition at line 682 of file Sadie_Geometry.c. Referenced by Tcl_AppInit(). |
|
Insert paste one image on top of another. Given two images, the SADIE library function INSERT treats one as the background and the other as the (opaque) foreground, pasting the foreground on top of the background at the specified pixel unit offsets. The Tcl data should conform to the patterns:
Definition at line 646 of file Sadie_Geometry.c. |
|
Rotate or reflect an image by pre-defined amounts.
The SADIE library function TRNSFORM flips an image according to a small number of simple transformations, selected by one of a set of codes defined in
The Tcl data should conform to the patterns:
Definition at line 312 of file Sadie_Geometry.c. |
|
Rotate an image using cubic, bilinear, or nearest-neighbor interpolation. The SADIE library function GEOMWARP can apply a wide range of polynomial transformations to an image, and can use three different re-sampling methods in generating the transformed image. Here we use the ROTATE function, which uses the GEOMCOEF function to derive the polynomial coefficients equivalent to the specified rotation, before invoking GEOMWARP itself, or recognizes the special cases that TRNSFORM can handle via simple flips. The angle parameter is in degrees; the option variable determines the interpolation technique: negative values for cubic interpolation (with the value being interpreted as the free parameter alpha for this method), zero values imply bilinear interpolation, and positive values nearest-neighbor interpolation. The Tcl data should conform to the patterns:
Definition at line 260 of file Sadie_Geometry.c. |
|
Re-scale an image using cubic, bilinear, or nearest-neighbor interpolation.
The SADIE library function GEOMWARP can apply a wide range of polynomial transformations to an image, and can use three different re-sampling methods in generating the transformed image. Here we use the EXPAND function, which invokes GEOMWARP to handle the simple specific case of uniform but independent scalings in the horizontal and vertical directions, unless the scale factors are trivial integer multipliers, in which case it uses the DUPL SADIE function instead. Despite the Tcl names, the
Definition at line 207 of file Sadie_Geometry.c. |
|
Tile two images edge-to-edge vertically, with an optional horizontal offset. The SADIE library function VMOSAIC creates a new image from two input images arranged next to each other vertically, optionally staggering them in the horizontal direction by the specified number of pixel columns, and filling any spaces between the copied component images and their enclosing frame with pixels of the specified greyvalue. The Tcl data should conform to the patterns:
Definition at line 535 of file Sadie_Geometry.c. |
|
Extract a sub-image from an image, with optional scaling (by decimation). The SADIE library function SUBSAMPL extracts a sub-image from a SADIE image, optionally shrinking the extracted image (selecting pixels at the specified horizontal and vertical spacings, without any averaging or interpolation). The Tcl data should conform to the patterns:
Definition at line 136 of file Sadie_Geometry.c. |