| Processing Images |
Once you have obtained an image to process (see Working with Images), the object model provides a large number of operations that can be performed on the image. This section will give an overview of the processing operations that are available, as well as some examples.
The Background Correction operators are accessed through the Background operator, which includes the two basic forms of background correction, by division (Div) and by subtraction (Sub).
The Color Model operators are accessed through the ColorModel operator, which includes extraction and merging of color channels, as well as transformation between color models such as RGB and HSI using the Transform operator.
The FFT operators are accessed through the FFT operator, which includes operations such as Forward, Inverse, and filtering such as LowPass and Spike.
Filtering operations reduce or increase the rate of change that occurs in the intensity transitions in the image, which can enhance or de-emphasize features of the image. The objects which provide these filtering objects are available in two ways: from the application directly, or as operators of the image. Since in most cases the objective is to apply a filtering operation to a specific image, it is usually simplest to access the filter operator of the image itself. Refer to the Working with Images section for complete details.
The object model's filtering operations fall into several categories.
The Edge filters are used to emphasize edge elements in the image, and are accessed through the Edges operator, which includes operations such as HorizontalEdge , VerticalEdge, Sobel and Roberts.
The Enhancement filters are accessed through the Enhance operator, which includes operations such as LowPass, HighPass, Sharpen and Gaussian blur.
The Morphology filters are accessed through the Morph operator, which includes operations such as Erode, Dilate, Open and Close.
Various operators affecting basic image geometry are accessed through the Geometry operator, which includes operations such as Cut, Paste, Resize, Rotate and Orient.
The image Warp operator is an advanced feature that can be used to warp the image using the ApplyToImage operator. Other operators can also be used to warp an image feature, or a set of points.
The Operations operators are accessed through the Operations operator, which complete set of image mathematical operations such as Add, Subtract (Sub), Multiply (Mult) and Divide (Div). Most of the operators can be applied to two images (e.g. subtract Image2 from Image1, returning the result in Image1) or an image and a constant.
' Color model examples
' Note: This example assumes that the active image is a color image
Sub ApplyColorModels()
' We'll need a variable to store the
extracted channel
Dim imgIntensity As McImage
' AND we need one to store the original
image (see Note below)
Dim imgColor As McImage
' Extract the Hue channel, regardless
of the interpretation of the original image
Set imgIntensity =
ActiveImage.ColorModel.ExtractChannel(2, mciHSI)
' Note: Because we did not specify any
image creation flags, the result of the
' above operation is displayed by default, which changes the active image!
' Refer to the section on Working with Images for details.
ActiveImage.Enhance.Sharpen
' could also be imgIntensity.Enhance.Sharpen
' Activate the original image
Windows(imgColor.Name).Activate
' Merge the modified channel back into the original image
ActiveImage.ColorModel.MergeChannel
imgIntensity, 2, mciHSI
' And close it
Windows(imgIntensity.Name).Close
End Sub
' Filter examples
Sub FilterActiveImage()
' Sharpen the active image with the
current number of passes and filter strength
ActiveImage.Enhance.Sharpen
' Erode the image, overiding the
current settings
ActiveImage.Morpho.Erode 5
' Apply 5 passes of the erosion filters
End Sub