best online casinos 2013 no limit deposit and fastest payouts slotsforrealmoney.us us real money slots internet slots games newest slot machines

September 12, 2007

Destriping Orbiter Images

Filed under: — chuckwood @ 8:13 pm

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),

Niels-Fig1.jpg

low-pass filters the image in horizontal direction (fig 2 shows asymmetric filter kernel),

Niels-Fig2.jpg

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)

Niels-fig3.jpg

The original image is divided by this image, removing most of the artefacts. (fig 4)

Niels-fig4.jpg

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.

N.J. Noordhoek
www.njnoordhoek.com

—————————————-

Appendix: Matlab code used:

%filter to remove horizontal streaks from images
%N.J. Noordhoek, September 2007, njnoordhoek@hotmail.com

%clean start
clear all
close all

%input and output file specification
infile=’c:\temp\lines9′;
in_extension=’.jpg’;
outfile_appendage=’_filtered’;
out_extension=’.jpg’;

ima_orig=single(imread([infile in_extension]));
imasize=size(ima_orig);

figure
imagesc(ima_orig/max(max(max(ima_orig))));
title(’original image’);
colormap(gray)

%sometimes the image contains a border, specify which area must be
%processed, first pixel=(1,1)
startx=1;
stopx=imasize(2);
starty=1;
stopy=imasize(1);

%offset is added to prevent negative values and problems in dark areas, later to be subtracted again
addoffset=128

%incoming image must be padded to prevent artifacts at the edge from
%filtering, padding size matched to filter kernel size
padsize=round(imasize(2)/4);
ima=single(squeeze(mean(ima_orig,3))+addoffset);
ima=ima(starty:stopy,startx:stopx);
mean_orig=single(mean(mean(mean(ima))));
ima=padarray(ima,[padsize padsize],’replicate’);

%store orig data on disk to save memory
save c:\temp\buffer ima_orig
clear 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=conv2(kernel,kernelver);
kernel=kernel/sum(sum(kernel)); %normalise kernel

figure
surf(kernel)
title(’filter kernel’)

%convolute image with kernel to detect framelet lines
hp=conv2(ima,kernel,’same’);

size(ima)
%low pass filter vertically again to be left with blurred image
kernelsize=round(imasize(1)/10);
kernel= gaussmf(-kernelsize:kernelsize,[kernelsize/4 0]).’;
hp2=conv2(hp,kernel,’same’);

%detected lines intensity=hi/lo pass filtered image divided by completely low pass
%filtered image:
hp3=hp./(hp2);

%normalize with median
hp3=hp3/median(median(median(hp3)));
clear hp
clear hp2

%undo padding
ima=ima(padsize+1:imasize(1)+padsize,padsize+1:imasize(2)+padsize);
hp3=hp3(padsize+1:imasize(1)+padsize,padsize+1:imasize(2)+padsize);

figure
imagesc(hp3/max(max(max(hp3))));
colormap(gray)
title(’lines detected’);

%divide orig image with the detected lines image and zet neg values to 0,
%remove offset, this is the corrected image with lines reduced
ima=max(0,ima./hp3-addoffset);

clear hp3
%preserve average brightness:
ima=ima*mean_orig/mean(mean(mean(ima)));

%load orig image and replace processed part with the processed result,
%remove padding
load c:\temp\buffer
ima_orig(starty:stopy,startx:stopx,1)=ima;
ima_orig(:,:,2)=ima_orig(:,:,1);
ima_orig(:,:,3)=ima_orig(:,:,1);

%display result
figure
imagesc(ima_orig/(max(max(max(ima_orig)))))
colormap(gray)

%write back result
clear ima
imwrite(ima_orig/max(max(max(ima_orig))),[infile outfile_appendage out_extension]);
title(’corrected image’);

1 Comment »

  1. [...] Destriping Orbiter Images [...]

    Pingback by LPOD lunar photo of the day » — September 12, 2007 @ 9:04 pm

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

&uot

Powered by WordPress