about
Image stacking works because features are present in each image in the series whereas the noise changes value and location. However if the images aren't perfectly aligned then the desired features aren't reinforced. This aligning of images is referred to as
image registration.
I started to build ITK but it destroyed my computer and seems silly to have my app jump from 2K to 30MB when I can probably write a
good'nuf registration tool.
algorithm
This advise I got is that its a fair assumption that there is no rotation component to the image offset. The rig we are using for the photographs handles this and rotating images by a small number of degrees
destroys some of the detailed pixel information in the original image so the end result suffers. This means one need only find the translational offset in the image and then apply that offset to said image. For this one image is chosen as the mask - the reference by which all other pictures will be judged. Then each image in the series is compared to the mask to determine if there is an offset required. My method will use blob detection for alignment. It should be safe to assume that the offset will be small compared to the size of the image so once features are found in the mask a small bounding box can be searched in the image to determine where that similar feature is located. The mask and image are the same size so a reasonable pixel offset can be determined by the features absolute position relative to one another.
Algorithm
- Find feature in opposite corners of mask
- Determine absolution position of feature in mask
- Create bounding of N pixels around feature
- Search bounding box in image for feature
- Determine absolution position of feature in image
- Apply offset to image of ( feature[mask] - feature[image] )
Initial Results
Using the PIL function ImageChops.difference(mask, image) to create an example image you can easily see how this method will work. This image is the
image overlayed on the
mask. You can see there is a 10 pixel offset between the two images - thus shifting the image 10 pixel will align the two and preparation for stacking.
Problems
The testing is being done with an image containing high contrast features. Many of the features in a typical image are very dim though - this may prove to be challenging when automatically searching for features.
--
ChristopherPepe - 17 Oct 2007