Home Page Toolkit Overview Using GML User Input Services Finger Tracker Calibrator Frame Grabber Service protocol Obtaining GML Installing GML Licence Developer Documentation Tcl/Tk API The GML Canvas Tcl Scripts Library List of Classes List of Files C/C++ API List of Classes List of Files 
Image processing primitivesThis page lists the interfaces of all image processing primitives present in the GML toolkit. Contents
Common scanner interfaceInstances of image processing primitives are called scanners. Scanners possess any number of state variables called parameters, each of which may be readable, writable, or both. All scanners share a set of methods, independently of the number of images they process, the number and type of their parameters, the fact that they are stateful or stateless, et caetera. A scanner has an accessor and a mutator method, à la Tk: myScanner cget paramName myScanner configure ?paramName value1?... The cget method is only avaible for scanners which have at least one readable parameter. The configure method is only avaible for scanners which have at least one writable parameter. Multiple parameters may be written using one method call. The constructor of scanners accepts the same arguments as the configure method: gmlScannerMyScanner myScanner ?paramName value?... The process method is used to run a scanner on a number of operands. Operands are defined by a number of bitmaps and regions of interest. For instance, for a scanner that accepts two operands: myScanner process bitmap0 bitmap1 rect0 {left0 top0 right0 bottom0} rect1 {left0 top0 right0 bottom0} gmlScannerAdaptativeThresholdThreshold (binarize) a grayscale bitmap (operand 0). Source values above the adapted threshold are given the value 0xFF (white), 0x00 (black) else. Number of operands: 2 (in, out). Parameters:
gmlScannerAddStore in the destination bitmap (operand 2) the pixelwise sum of the source bitmaps (operands 0 and 1). With <saturate>, addition saturates, i.e. is not done modulo 256. For instance if operand 1 has value 140 and operand 0 has value 120, the result is 255. Number of operands: 3 (in, in, out). Parameters:
gmlScannerApplyGaussianCreate a correspondence map between a bitmap and a colormodel gaussian. Number of operands: 2 (in, out). Parameters:
gmlScannerApplyHistogramCreate a correspondence map between a bitmap and a colormodel histogram; each output pixel is set to the corresponding histogram bin value, scaled so that the maximum bin value corresponds to the maximum pixel value if the output image. Number of operands: 2 (in, out). Parameters:
gmlScannerChannelIf first operand is a planar image, copy it to a given channel of the (multichannel) destination image. If the first operand is a multichannel image, copy one of its channels to the destination planar image. Only works for encodings where channels are 1 byte wide. For 1bit wide channel, use the <bitmask> series of scanners. Number of operands: 2 (in, out). Parameters:
gmlScannerCopyCopies a bitmap (operand 0) to another (operand 1), possibly changing the pixel format. Number of operands: 2 (in, out). gmlScannerCorrelateCompute the peak of the normalized crosscorelation coefficient between a bitmap (operand 0) and a model (passed as parameter). If requested, a nonnormalized correlation map will also be output to the destination bitmap (operand 1). Note that the scanned region in operand 0 must be smaller than the image: borders corresponding to the model's horizontal and vertical radii must be respected. Number of operands: 2 (in, out). Parameters:
gmlScannerDemultiplexBreak a 4channel image into 4 grayscale planes. Number of operands: 5 (in, out, out, out, out). gmlScannerDistancemapCompute the distance between two images and store it in a planar image. The metric used depends on the encoding. If both bitmaps are planar, the absolute difference is used; if both are in RGB colorspace, the city block distance is used; if one of the bitmaps is in LRG or HSV colorspace, the other is converted to the same colorspace and the Distance() method of the corresponding class is used. As this scanner is intended to be used to compare similar images, the distance can be linearly scaled up using the scalefactor option. Number of operands: 3 (in, in, out). Parameters:
gmlScannerDumpDump a textual representation of a bitmap to a file. Zeroes are replaced with periods (dots). Number of operands: 1 (in). Parameters:
gmlScannerExposureStore in the destination bitmap (operand 1) over and underexposure information about the source bitmap (operand 0). Destination values are 0x00 (underexposed pixel), 0xFF (overexposed pixel), and 0x7F (normal pixel). Exposure theshdold is configurable. Number of operands: 2 (in, out). Parameters:
gmlScannerFillFills a bitmap (operand 0) with a given color. If an alpha channel is present, it it used to blend the image with the fill color. Number of operands: 1 (inout). Parameters:
gmlScannerHistogramFill in the parameter histogram using the luminance or chrominance samples of the bitmap (operand 0). If an alpha channel is present, the samples are weighted by the alpha value. Number of operands: 1 (in). Parameters:
gmlScannerInvertLuminanceInverts the luminance component of a bitmap. For RGB encodings, this is acheived by converting each pixel to a colorspace that separates the luminance component (namely, HLS). Number of operands: 2 (in, out). gmlScannerLookupGenerates a greyscale bitmap (operand 1) by applying an histogram lookup to the input (operand 0) image. XXX detail cases perencoding Number of operands: 2 (in, out). Parameters:
gmlScannerLrgTransform a bitmap between RGB and LRG colorspaces. Number of operands: 2 (in, out). gmlScannerLuminanceCompute the mean and standard deviation of the image (operand 0) luminance, and the normalized image energy. When possible, each luminance value is weighted with the alpha value. Number of operands: 1 (in). Parameters:
gmlScannerMapThresholdThreshold (binarize) a grayscale bitmap (operand 0). The thresholding operation is: p2 = (p0 < factor * p1) ? 0x00 : 0xFF Number of operands: 3 (in, in, out). Parameters:
gmlScannerMapmergeMerge some of the second operand bitmap into the first, according to the merge map in the third operand. The lookup table provided as parameter is used to transform the map coefficients. It can be generated using the Scanner_ramps module. Naming the two source pixels p0 and p1, the corresponding map pixel w0 (scalar weight), and the lookup table t, p0 will be overwritten by: p0 * (1  t[w0]) + p1 * t[w0] Number of operands: 3 (inout, in, in). Parameters:
gmlScannerMergeComposite two images, a background (first operand) and a layer (second operand), according to the layer alpha (opacity) channel. The layer's overall opacity is the scanner's parameter. The composited image is stored in the third operand. Number of operands: 3 (in, in, out). Parameters:
gmlScannerMomentsCompute the moments of a greyscale (or planar) image. Each pixel weight is its value (shade of gray), white (0xFF) being the highest weight. BUG: For now only the first moment is computed. Finding the second moment will probably require a second pass on the image. Number of operands: 1 (in). Parameters:
gmlScannerMorphCsmoothConservative smoothing filer. Clamp the value of each pixel center coefficient within the minimum and maximum values of its neighborhood. Number of operands: 2 (inout, out). gmlScannerMorphDilateApplies a 3x3 morphological dilation using the MAX operator. Number of operands: 2 (inout, out). gmlScannerMorphDilateBinApplies a 3x3 morphological dilation using the OR operator. Number of operands: 2 (inout, out). gmlScannerMorphErodeApplies a 3x3 morphological erosion using the MIN operator. Number of operands: 2 (inout, out). gmlScannerMorphErodeBinApplies a 3x3 morphological erosion using the AND operator. Number of operands: 2 (inout, out). gmlScannerMorphGaussApplies a gaussian blur to the image, using a 3x3 kernel. Number of operands: 2 (inout, out). gmlScannerMorphMedianMedian smoothing filter. Number of operands: 2 (inout, out). gmlScannerMorphMedianBinMedian smoothing filter. Number of operands: 2 (inout, out). gmlScannerMorphSobelMaxApplies a Sobel filter to the image, using a 3x3 kernel. The resulting image show the gradient module (approximated the maximum of the horizontal and vertical derivatives). Number of operands: 2 (inout, out). gmlScannerMorphSobelxApplies a horizontal Sobel filter to the image, using a 3x3 kernel. Number of operands: 2 (inout, out). gmlScannerMorphSobelyApplies a vertical Sobel filter to the image, using a 3x3 kernel. Number of operands: 2 (inout, out). gmlScannerMultiplexMerge 4 grayscale planes into one multichannel image. Number of operands: 5 (out, in, in, in, in). gmlScannerNoiseAdd noise to a bitmap. One of several algorithms can be used:
Number of operands: 2 (in, out). Parameters:
gmlScannerOpacifyCopy the source image (operand 0) to the destination image (operand 1), preserving the R, G, and B channels but setting the X or A destination channel to 0xFF. Number of operands: 2 (in, out). gmlScannerProjectcaca Number of operands: 1 (out). Parameters:
gmlScannerScaleGrayInput image is a grayscale (or singlechannel) image in operand 0. Each output pixel p1 is obtained as: p1 = (scale * p0 + bias) ^ exp where scale and bias and exp are given as scanner parameters. Number of operands: 2 (in, out). Parameters:
gmlScannerShiftBitshift each pixel value right by the number of bits given as parameter. Number of operands: 2 (in, out). Parameters:
gmlScannerStripletsNumber of operands: 2 (in, out). Parameters:
gmlScannerSubstractPixelwise substract operand 1 from operand 0, storing the result in operand 2. With saturate, substraction saturates, i.e. is not done modulo 256. For instance if operand 1 has value 255 and operand 0 has value 120, the result is 0. Number of operands: 3 (in, in, out). Parameters:
gmlScannerSwapSwap channels in an image. The implemented variants are:
Number of operands: 2 (in, out). Parameters:
gmlScannerThresholdThreshold (binarize) a grayscale bitmap (operand 0). Source values above the parameter threshold are given the value 0xFF (white), 0x00 (black) else. Regardless of the source encoding, threholds should have values between 0 and 255 inclusive. Number of operands: 2 (in, out). Parameters:


Contact: julien (dot) letessier (at) gmail (dot) com.
Copyright (c) 20002007 CLIPSIMAG Laboratory, Grenoble, France. All rights reserved. W3CXHTML 1.0 W3CCSS 2.0 