Geometric Transforms
Geometric transformation moves selected pixels in an image, which is useful if a shape in an image is too large / small / distorted, to make point-to-point comparisons possible.
The selected area may be any shape, but the resulting image is always rectangular. Pixels in the destination image that have corresponding pixels that are outside of the selected area are considered not relevant and are left black.
When the source coordinates for a destination pixel are not integer, an interpolation technique is required.
The nearest neighborhood method is the quickest - it uses the closest source pixel.
The bi-linear interpolation method is more accurate but slower - it uses a weighted average of the four neighboring source pixels.
Possible geometric transformations are:
The simplest way to realign two misaligned images is to accurately locate features in both images (landmarks or pivots, using pattern matching, point measurement or other) and realign one of the images so that these features are superimposed.
You can register an image by realigning one, two or three pivot points to reference positions. For best accuracy, the pivot points should be as far apart as possible.
- A single pivot point transform is a simple translation. If interpolation bits are used, sub-pixel translation is achieved.
- Two pivot points use a combination of translation, rotation and optionally scaling. If scaling is not allowed, the second pivot point may not be matched exactly. Scaling should not normally be used unless it corresponds to a change of lens magnification or viewing distance.
- Three pivot points use a combination of translation, rotation, shear correction and optionally scaling. A shear effect can arise when acquiring images with a misaligned line-scan camera.
This destructive feature modifies the source image to create a mirror image:
- horizontally (the columns are swapped) or
- vertically (the rows are swapped).
If the position or size of an object of interest changes, you can measure the change in position or size and generate a corrected image using the ScaleRotate and Shrink functions.
EasyImage::.ScaleRotate performs:
- Image translation: you provide the position coordinates of a pivot-point in the source image and a corresponding pivot point in the destination image.
- Image scaling: you provide scaling factor values for X- and Y-axis.
- Image rotation: you provide a rotation angle value.
For resampling, the nearest neighbor rule or bilinear interpolation with 4 or 8 bits of accuracy is used. The size of the destination image is arbitrary.
Scale and rotate example
EasyImage::.Shrink: resizes an image to be smaller, applying pre-filtering to avoid aliasing.
If the feature of interest is distorted due to its shape (anamorphosized), you can unwarp a circular ring-wedge shape (such as text on CD labels)into a straight rectangle. A ring-wedge is delimited by two concentric circles and two straight lines passing through the center.
EasyImage::.SetCircleWarp prepares warp images for use with function EasyImage::.Warp which moves each pixel to locations specified in the "warp" images which are used as lookup tables.