Align Image
The Align Image module provides a way to align two images. Similar to the Visual Anchor and
Stabilize
module the Align_Image module will look for characteristic properties between two images in
an effort to determine how they overlap.
Note that if too much of the target image is not included in the image to align then the system will
produce erratic results as any detected alignment between the two images will be random.
This module will determine the translation (X,Y) movement, the Z plane rotation or orientation
and the scale changes between the two images. Note that in order to associate the placement of one image
over the next you will need some texture within the image that is the same in both in order to determine
how to overlay the image.
The module was developed to allow for comparison between two images that may be somewhat misaligned such as in
a security setting to determine abandoned or removed objects. It is also very useful in
document comparison such as comparing differences between scanned or otherwise photographed documents. Both automated
and manual modes of alignment are supported.
Interface
Instructions
1. Target Image - Select the "Target Image" in the Image Source dropdown. The target image
is your model image that typically does not change. The source image will be stretched, rotated, etc. in order
to make it as close as possible to the Target Image.
2. Align Image - Select the image you want to align to another image. Typically
this will be the current video image from your webcam or come from a loaded image (see Load Module) for
image loading.
3. Options - Select which mode you would like to use for image Alignment.
The Automatic mode seeks to find the correlation between the two images
without needing any feedback from you. There are cases that may occur when
you will need to adjust the values manually. In those cases you can select
the Manual radio button which will enable all the value editing interfaces
in the Manual Values section.
In automatic mode the "Text & Line Images" selection will work better with
images that are mainly black and white and contain lines, drawings. The
"Color Images" works better on images that are of real scenes and contain
texture/gradients within the image.
Note that in order for the automatic mode to work correctly the majority
of the image content needs to be shared between the two images.
4. X, Y Translation - These are the values associated with the horizontal
and vertical movement of the Source image to align it with the Target image.
Modifying this value will move the Source image in relation to the Target
image in efforts to align them better. Note that these values are in pixels.
5. X,Y Scale - These are the values associated with the size change
from the Source to the Target image. For example, an X or Y scale of
2 means that the Source image is enlarged to twice its size in order
to align with the target image. Similarly, a value of 0.5 means the
Source is reduced to half its size in order to align with the target
image. One can interpret this as meaning how close or far are you
from the Target image in terms of depth.
Typically images scale in the same amount for X and Y. But sometimes due to a non-
perpendicular photographic plane this may not be true. If you select the Automatic
mode or press the Refine button both X and Y will be optimized separately just in
case. While manually editing you may find it easier for them to have the same
value which can be enforce by checking the "Scale X&Y together".
6. X, Y Rotation - These are known as 'out of plane' rotation in that
they will spin and flip the image (X and Y Rotation) such that the
image appears to exist into and out of the computer screen (ie. the Z Plane).
Note that the automatic mode does NOT currently change these values.
7.Z Rotation - This is also known as orientation and fixes situations
where the Source and Target image are upside down with respect to each other.
This parameter will twist the Source image until it better aligns with the
Target image. If you are more comfortable in working with Radians as apposed
to degrees you can select the Radian radio button to switch between Degrees
and Radians.
8. Refine - The refine button will execute an automated alignment just once
on the image. This is helpful when using the manual mode of image alignment
such that when you get things close you can try the Refine button in order
to tweak the final values. Note that the alignment should be close in order
for the Refine button to work. If the images are far apart in terms of
alignment then the Refine button may not find a match or make things even worse.
9. Pixel, Bilinear Resample - Select how precise the Source image should
be transformed into the Target image. Pixel Resample refers to a nearest
neighbor approach where a pixel from the Source image is transformed
and placed into the nearest pixel of the transformed image. This creates
a jagged effect but provides a quicker transform process. The
Bilinear will interpolate the pixels position and smooth out the final
image to avoid jaggies and create a more natural final transform but
at the expense of reduced performance.
10. Perspective - While Rotating in the X and Y plane (spin and flip) you
can specify the amount of perspective to incorporate into the transform.
The amount of perspective will change how much the image shrinks at points
far away in depth and how much the image enlarges when closer in depth.
A high perspective number causes things to seem very fat while a smaller
number will cause more and more warping of the image at higher X or Y
rotations. The amount of Perspective loosely correlates with the amount
of warping seen in the image which is interpreted as depth by us.
Example
| Source | Target |
 |  |
| Aligned Image |
 |
Download the zip file containing the above two images and the robofile used to generate the aligned image.
| Source | Target |
 |  |
| Aligned Image |
 |
Download the zip file containing the above two images and the robofile used to generate the aligned image.
Variables
ALIGN_X - the X translation that aligns the image to the target.
ALIGN_Y - the Y translation that aligns the image to the target.
ALIGN_X_ROTATION - the X or spin angle that aligns the image to the
target (degrees)
ALIGN_Y_ROTATION - the Y or flip angle that aligns the image to the
target (degrees)
ALIGN_Z_ROTATION - the Z or rotation angle that aligns the image to the
target (degrees)
ALIGN_X_SCALE - the X or width scale factor that relates the image to
the target
ALIGN_Y_SCALE - the Y or height scale factor that relates the image to
the target
ALIGN_CONFIDENCE - a percent confidence of how well the Source image
matches the Target image after transformation. 100% is very
confident, 0% is not.
See Also
Visual Anchor
Stabilize
|