Help for SPARSE
PURPOSE
Sparse simulates the effect of a sparse aperture by constructing a complex
pupil, computing the OTF, and applying it to the input image.
It can also apply a wiener filter to correct for the effect of an aperture
(see the SN keyword).
EXECUTION
direct:
sparse inp=(in,junk,pupil) out=blurred (Note: junk is ignored)
or
sparse inp=(in) out=blurred circle=(257,257,50,0)
inverse:
sparse inp=(blurred,reference,pupil) out=corrected 'optimize
or
sparse inp=(blurred,reference) out=corrected 'optimize
or
sparse inp=(blurred) out=corrected sn=45 circle=(257,257,50,0)
SOME CLARIFICATIONS:
Note on centering the pupil:
The images must be a power of 2 in nl and ns. This means there is no center
pixel. We have defined the center at nl/2+1 and ns/2+1. For incoherent
imaging it doesen't matter. For coherent imaging it makes a big difference.
Note on the size of the pupil:
In the incoherent case no part of the filled pupil (aperture) may lie
outside a circle centered in the pupil and having a radius of 1/4 the image
nl or ns. It is up to you to check for this condition.
The largest "filled aperture" would be created like this:
sparse inp=original.img out=blurred.img circle=(257,257,128,0)
if the picture were 512 by 512 pixels.
Note on simulating spectral bandwidth:
The program creates monochromatic images. To simulate a spectrum you must
run the program many times and add the images. Each run will require you to
scale the pupil in proportion to the wavelength.
Note on pupil phase errors:
The phase errors introduced are in units of wavelength. To simulate a spectrum
you will need to make many runs, each with a scaled phase error in proportion to
the wavelength, and add the results.
Note on wiener correction of color imagery:
If you have a broadband input image the psf is a function of color. To correct
for this you must correct for a family of psf's and later select locally
the best one based upon a the local color.
METHOD:
Incoherent case:
1. The pupil (aperture) is constructed.
2. The otf is the autocorrelation of the pupil.
3. The otf is multiplied by the fft of the image.
4. Inverse fft.
Coherent case:
1. The pupil (aperture) is constructed.
2. The otf is the pupil.
3. The otf is multiplied by the fft of the image.
4. Inverse fft.
If SN is specified, requiring a wiener filter, then
Incoherent case:
1. The pupil (aperture) is constructed.
2. The otf is the autocorrelation of the pupil.
3. The filter F=otf/(otf*otf+1/(sn*sn))
4. The filter F is multiplied by the fft of the image.
5. Inverse fft.
Coherent case:
1. The pupil (aperture) is constructed.
2. The otf is the pupil.
3. The filter F=conjg(otf)/(|otf|**2+1/(sn*sn))
3. The filter F is multiplied by the fft of the image.
4. Inverse fft.
RESTRICTIONS
Image must be of a power of 2.
Image <= 512*512 total pixels.
Cognizant Programmer: JJ Lorre November 1998
PARAMETERS:
INP
1. input image
2. reference image
3. pupil
OUT
1. output image
2. pupil image (optional)
3. otf (optional)
4. psf (optional)
CIRCLE
Sub apertures
line,sample,radius,piston
RING
1. number of sub apertures,
2. radius
SPOKES
1. number of spokes.
2. number of mirrors/spoke.
3. center hole radius.
4. radius of inner circle.
5. radius increase factor.
6. (optional) # circles in ring.
SN
Wiener s/n ratio
OPTIMIZE
Finds best SN value.
COHERE
Coherent case
DEFOCUS
Amount of defocus.
FIND
To match signal to noise.
ROTATE
smear rotate otf 180.
NOISE
Add noise amount.
REFLAMDA
Reference wavelength.
LAMDA
Actual wavelength.
FULLWELL
Electrons/ccd bin
SCALE
pupil scale
See Examples:
Cognizant Programmer: