The Sept 14, 2007 LPOD describes how Niels Noordhoek uses Matlab to remove the annoying lines where Lunar Orbiter frames were joined together. This page repeats that text and includes the figures and Matlab code.
Be gone, obnoxious framelet lines!
Frequently older high resolution moon images are presented in LPOD that contain “framelet lines”.The images are stitched together from films, that were chemically processed (!), scanned and transmitted to earth from moon orbiting satellites such as the camera in Lunar Orbiter II. Though it is probably scientifically most correct to present the raw data as-is, a potentially pretty is image is spoilt by the missing data between the films and bands of varying brightness within the films. The film data were finally lost, because the orbiter was purposely crashed onto moon’s surface to prevent possible hazard to future Apollo missions.
To perform plastic surgery on the images, a filter was written in Matlab , an easy to use numerical software package, which can be used for image display and processing. The code reads in the image (fig 1),
low-pass filters the image in horizontal direction (fig 2 shows asymmetric filter kernel),
and high-pas filters the image in vertical direction. The result is an image that shows only the framelet lines and intensity modulations. (fig 3)
The original image is divided by this image, removing most of the artefacts. (fig 4)
Side effect is that the contrast of the image is somewhat reduced.
For those who are mathematically inclined but do not want to spend money on a commercial Matlab license, free alternatives are available to run the code: Octave, SciLab and FreeMat.
Appendix: Matlab code used:
%filter to remove horizontal streaks from images
%N.J. Noordhoek, September 2007, firstname.lastname@example.org
%input and output file specification
%sometimes the image contains a border, specify which area must be
%processed, first pixel=(1,1)
%offset is added to prevent negative values and problems in dark areas, later to be subtracted again
%incoming image must be padded to prevent artifacts at the edge from
%filtering, padding size matched to filter kernel size
%store orig data on disk to save memory
save c:\temp\buffer ima_orig
kernelsize=padsize/2; %horizontal low pass filter width
kernel= gaussmf(-kernelsize:kernelsize,[kernelsize/4 0]);
verwidth=1.5; %should match width of framelet lines
kernelver= gaussmf([-round(verwidth+0.5):round(verwidth+0.5)],[verwidth/4 0]).’;
kernel=kernel/sum(sum(kernel)); %normalise kernel
%convolute image with kernel to detect framelet lines
%low pass filter vertically again to be left with blurred image
kernel= gaussmf(-kernelsize:kernelsize,[kernelsize/4 0]).’;
%detected lines intensity=hi/lo pass filtered image divided by completely low pass
%normalize with median
%divide orig image with the detected lines image and zet neg values to 0,
%remove offset, this is the corrected image with lines reduced
%preserve average brightness:
%load orig image and replace processed part with the processed result,
%write back result
imwrite(ima_orig/max(max(max(ima_orig))),[infile outfile_appendage out_extension]);