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 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.
Re-Alignment¶
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 EasyImage::Register .NET Python 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.
Mirroring¶
This destructive feature modifies the source image to create a mirror image:
EasyImage::HorizontalMirror.NET Python: the columns are swapped orEasyImage::VerticalMirror.NET Python: the rows are swapped.
Resizing¶
If you need to resize an image, you can use the method EasyImage::Resize .NET Python, which resizes your image to the size of the destination image.
Hint
It is always faster than using the method EasyImage::ScaleRotate .NET Python.
Translation, Scaling and Rotation¶
To apply a transformation involving a scaling, rotation and translation, you can use EasyImage::ScaleRotate .NET Python. In one call, it 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.
Shrink¶
EasyImage::Shrink .NET Python resizes an image to be smaller, applying pre-filtering to avoid aliasing.
LUT-Based Unwarping¶
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.NET Python prepares warp images for use with functionEasyImage::Warp.NET Python which moves each pixel to locations specified in the “warp” images which are used as lookup tables.To warp back the image to the circular ring:
Use
EasyImage::SetInvCircleWarp.NET Python with the same parameters as above.Use the method
EasyImage::Warp.NET Python.
Additionally, if the LUT-based unwarping is more peculiar:
Use the method
EasyImage::SetupInverseWarp.NET Python to inverse any inversible LUTUse it with the method
EasyImage::Warp.NET Python.
See Also¶
Easy to understand, ready to copy code snippets to use when resizing images.
Easy to understand, ready to copy code snippets to use when (un)warpping images.