[HOME][CONTENTS][DOWNLOAD][PREV][NEXT]


IMAGE PROCESSING

XBit integrates image processing functions to a Tk's gimg image widget based on RAMIM. The XBit's Tcl entry for image processing is rimage which has the syntax 

rimage command ?options?

A feature of XBit image processing is the visualization. It is achieved with the help of a gimg in display. If an output image has been used in gimg widgets in displays, the displays may be updated automatically or by a command rimage update imgID. The update is actually invoked via RAMIM client's callbacks embedded by gimg widgets. 

XBit image processing functions can be divided into five categories: 1) geometric transformation, 2) convolution and filtering, 3) calibration and analysis, 5) principal components and multispectral classification and 6) miscellaneous utilities. The following is a brief description of some commands in the above five categories. 

Geometric transformation is a process that deals with a 2D or 3D image spatial deformation or reformation. The process maps each pixel's coordinate of an input image with a 2D or 3D geometric projection function to an output image, and then resamples the image value at each pixel of the output image. Command rimagegeoref uses a 2D polynomial to perform a geometric correction of an input image. It can also rotate an input image with a specified angle. Command rimage gtop uses a model of central projection and a surface elevation (Z) image to perform a 3D geometric transformation for image orthorectificaiton, relative orientation, and perspective imaging simulation. Command rimage rotate simply rotates an input image array to its left or right side (+ or - 90 degrees), and/or flips the input image from the left side to the right side, or from the top side to the bottom side and vise versa. 

Convolution and filtering are processes that derive spatial information from an input image. The result is blurred or sharpened spatial features of the input image. Command rimage gconv handles an image in its spatial domain. It uses a spatial template to calculate image convolution at a specified neighborhood of each pixel. A user can specify the size and weight values of a template based on the nature of application. Command rimage gfftrans handles an image in its frequency domain. It provides image calculation for Fast Fourier Transformation (FFT), Inverted FFT (IFFT) or both FFT and IFFT with a filter in between. A user can choose either a 1D (x or y) or a 2D (x and y) FFT/IFFT in calculation. 

Calibration and analysis are a suite of image processing tools for image radiometric or brightness calibration and mathematical calculation. Command rimagesmetric calibrates various image vignette problems. It uses statistical and analytical methods to address problems of various imaging non-uniformity, and compensates image brightness based on an additional model or a multiplication model. Command rimage gdem generates images of a digital elevation model. It can calculate a slope image with a least-square method using the elevation values of four adjacent pixels. It can also simulates a relief image of a terrain under given illumination, reflection and imaging parameters. Command rimage calc calculates various ratios of two image bands, linear calibration of individual image bands and linear combination of multiple image bands. Command rimage gstat calculates image statistics including means and covariance matrix. Command rimage egv calculates eigen value and eigen vectors of image statistics. Command rimage crop collects a sub-matrix of a source image, performs a specified operation and puts the results into a sub-matrix of a destination image. The supported operations are rsp (image resampling), avg (image spatial averaging), bin(image spatial integration), pc (image principal components), rpc (reversed image principal components). Command rimage dist calculates a distant image in which each pixel's value is the minimum distance to a group of pixel categories defined for an input image. Command rimage section reads a section or a line of an input image and writes it into a line or a section of an output image. 

Multispectral classification calculates an image of spectral feature categorization, a mapping of pixels from an n-dimensional spectral space to a one-dimensional inventory. The result is an index image of up to 256 different colors (categories). Two commands, rimage classify and rimage giso, are provided for supervised and unsupervised classificaitons respectively. The command of rimage classify identifies each pixel with a category ID, based on calculation of a minimum distance to each class signature defined in a training process prior the classification. Class signatures can be mean vectors, covariance matrixes, or correlation matrixes. Distance functions to choose include Euclidean, Parallelepiped, Mahalanobis and Bayes. The command of rimage gisoc classifies pixels without a prior knowledge of any spectral signatures. A procedure of iterative self-organized clustering is used to automatically separate pixels into different groups. The means of the spectral groups are updated in each iteration according to a set of rules, i.e., distances of merging and spliting spectral groups, a maximum number of classes, a maximum number of iterations, as well as a convergence threshold. 

Image object and scope provides a simple image expression for calculation and analysis.  An image object is created by the Tcl command rimage bind with the following command syntax

rimage bind -file image -obj objName

which associates the image to a Tcl command objName called image object.  An image object handles messages in a form of a simple expression (e.g., mathematical and logical operators) to change its data values.  An image object takes one operator with or without operants.  In addition, scope can be used to define a region of interests in the image data set. A general syntax of a simple image expression is

objName @x0:x1,y0:y1,z0:z1 operator operants

where @x0:x1,y0:y1,z0:z1 is a scope of the image object.  Operants can be either an image or constants.  If an operant is an image, it can also have its scope.  An image scope not only defines a region of interest but also define a mapping between pixels from a source image to a destination image.  For an example, objName @0:15 = objName @15:0 will reverse the order of columns 0, 1, ..., 15.

Advanced image expression consists of images and constants as operants and mathematical operators with defined precedence levels.  Parenthese can be used to overwrite the precedence of an operator.  It privdes the highest level of script image processing.  An advanced image expression greatly simplifies image processing script and makes the script more readable.  Like the native Tcl commands set and expr, XBit provides commands rimage.set and rimage.expr to handle image expression.  The command rimage.set creates a new image from a source image.  The command rimage.expr parses a high level image expression into a list of image objects with their operators and operants, executes them sequencially and then returns the resulted image.  Scope can be used in an image expression and should immediately follow the image with no space in between.  Take an example of a 7-band Landsat TM image, tm, which has its NIR channel as band four and red channel as band three. To calculate a normalized differential vegatation index image (NDVI), the following image expression will do

rimage.set NDVI [rimage.fexpr (tm@,,3-tm@,,2)/(tm@,,3+tm@,,2)*255]

where rimage.fexpr is a variation of rimage.expr for float point image calculation. The operators used in advanced image expression are exactly the same ones used in simple image expressions, but the syntax is different. A comma ',' is used between multiple operants instead of a space ' '. In addition, no space is used between an image and its scope.  The following table is a summary of simple image expression and the operator's precedences in an advanced image expression.

Table of simple image expression and operator precedence
Simple image expression
Prec.
Meaning
imgObj = operant 0 assignment
imgObj + operant 2 addition
imgObj - operant 2 subtraction
imgObj * operant[ offset] 3 multipliation
imgObj / operant 3 division
imgObj ^ operant 4 power(|imgObj|, operant)
imgObj idiv operant 3 integer division
imgObj lini x0 x1 y0 y1 3 linear interpolation
imgObj rand operant 3 randomization
imgObj % operant 3 remainder
imgObj & operant 4 bitwise and
imgObj | operant 4 bitwise or
imgObj xor operant 4 bitwise exclusive or
imgObj == operant[ trueValue[ falseValue]] 1 logical equal
imgObj >= operant[ trueValue[ falseValue]] 1 logical greater equal
imgObj <= operant[ trueValue[ falseValue]] 1 logical less equal
imgObj > operant[ trueValue[ falseValue]] 1 logical greater than
imgObj < operant[ trueValue[ falseValue]] 1 logical less than
imgObj min operant 5 minimum of the two
imgObj max operant 5 maximum of the two
imgObj ! 5 complement
imgObj init operant 5 initialization
imgObj initx 5 init with column
imgObj inity 5 init with row
imgObj initxy 5 init with col+row
imgObj ring 5 ring pattern

Miscellaneous utilities include a group of tools for image data management. Command rimage open opens an image in memory. It can create a memory-resident RAMIM image for fast access. It can also cache a RAMIM data structure of a disk image file in memory to reduce the overhead during an internal image open process of a rimage command. Command rimage cache adjusts the size of the cache memory of a disk image file for optimal access. Command rimage configure does configuration of an existing RAMIM image or a RAMIM description for image creation. It is useful for importing external image and memory-resident image creation. Command rimage cget retrieves an image parameter from a supported image in a disk file or memory. Command rimage canvas saves a canvas image into a memory-resident RAMIM image or the system clipboard. Command rimage clipboard copies an image from the system clipboard into a memory-resident RAMIM image. Command rimage window copies a bitmap into a RAMIM image from a specified area of the display screen, or a Tk window, or the system's clipboard. 

[HOME][CONTENTS][DOWNLOAD]


Raw space shuttle image


After calibration


Raw space shuttle image


After calibration


After geocorrection


Overlay of the two image


Raw Landsat image


After convolution


FFT of raw image


FFT after convolution






3D display


RGB compression