[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
RE: [APML] Machholz, Cassiopeia, and Double Cluster
Hi George,
Right now I am only doing the image subtraction in Matlab, to deal with
vignetting. Doing the image subtraction in Matlab is so easy, it's only a
few lines of code:
cd 'E:\informal\pictures'
a = double(imread('macs7.tif'));
b = double(imread('macs7med100gb250.tif'));
c = uint16(a-b);
imwrite(c,'testmac.tif');
image(c);
1. The first line obviously sets the working directory
2. The second line reads the file "macs7.tif" using the Matlab function
imread, which determines the file type by the .tif extension. I convert the
image immediately to double precision (64 bits per pixel, floating point)
during reading using the Matlab double function, and assign the image to the
array a (which will be m x n x 3 in dimension, where m x n is the image size
and 3 is for the r, g, and b channels).
3. I read in the file that contains the flat field the same way, and assign
it to array b. This file was created in PS using a median filter of radius
100 followed by a gaussian blur of radius 250.
4. I subtract b from a, and convert the result back into a 16 bit per pixel
unsigned integer format (each pixel is a value 0 to 64k, which is what is
expected for a 16 bit tiff file) using Matlab's uint16 function. The result
is assigned to array c. Note that Matlab takes care of subtracting the r, g,
and b channels separately.
5. I write the image c back out to the file testmac.tif, using the Matlab
function imwrite. Again, it knows to write a 16-bit tiff file from the file
extension and from the fact that the array c is a 16-bit per pixel array.
6. I also display the image in Matlab for a quick confirmation that
everything worked, using the image command.
I have been contemplating using Matlab for more extensive processing, but I
don't have the image processing plug-in for it, so I would have to write
most of my own code or shell out $hundreds for the plug-in. The reason
Matlab would be great for image processing is its ability to work at
64-bit-per-pixel depth. I find that doing the subtraction at 64 bits per
pixel produces a noticeably better result than doing it at 8 bits in PS,
plus it preserves the color depth for further processing in PS like level
adjusting.
CS!
Andy
-----Original Message-----
From: astro-photo-bounces@seds.org
[mailto:astro-photo-bounces@seds.org]On Behalf Of George Anderson
Sent: Saturday, February 12, 2005 12:21 AM
To: Discussion of Film Astrophotography
Subject: Re: [APML] Machholz, Cassiopeia, and Double Cluster
Hi Andy
Do you have any details/routines that you use with Matlab for processing
images? The last time I used Matlab was ten years ago and I am curious
on how you read the files for processing.
I have access to Matlab on one of the PC's at work and am curious.
George Anderson
Montreal Canada
Clear skies and good health
Andrew Clegg wrote:
>
> Hi Ray,
>
> Thanks! Your questions about flat-fielding are right on, and they are
> questions that I wonder about as well. The flat fielding does seem to
> subtract at least some component of the Milky Way, unfortunately, but
> exactly how much (i.e., what would my final shot look like if the Milky
Way
> hadn't been partially subtracted) is not easy to say. I apply a 100-pixel
> median filter to the original big scan (the 2410x3212 version). That seems
> to be the largest radius that PS allows, although if I'm wrong, let me
know!
> That still leaves some visible components, like some of the nebula and the
> overall effect of the Milky Way, so I then apply a large gaussian blur
(100
> pixel radius I think; I'd have to check my notes). This leaves basically a
> version of the original scan devoid of all stars and features other than
the
> apparent vignetting. Although as you suspect, some component of that
> "vignetting" is surely the Milky Way running through the middle.
>
> I do the subtraction in Matlab instead of PS just because I get better
> results. I am a novice with both programs, but using subtraction in PS
> leaves me with residual field fall-off, plus it can only be done on an
8-bit
> image. In Matlab, I can read in as a 16-bit image, then convert up to a 24
> bit/pixel image, do the subtraction, then convert back down to 16-bit per
> pixel, and write back out as a 16 bit/pixel TIFF file for further
processing
> in PS. The result seems to be an absolutely flat field, although perhaps
> with some of the Milky Way subtracted as well!
>
> As you point out, there are multiple models of field illumination to deal
> with. Theoretically, I should be doing a division to get rid of vignetting
> and a subtraction to deal with gradients. I haven't gotten that far yet. I
> wondered if it would be reasonable to build an empirical model of the
> vignetting of my lenses at various aperture settings, and then divide my
> shots by the appropriate model to compensate for the vignetting. One of
> these days I'll try to take some "flat field" images of an illuminated
card
> or the open daytime sky, and see if I can build a set of models.
>
> I have used IRAF in years past (and AIPS--the radio astronomy package, not
> the commercial amateur astronomy package), but that was for radio
astronomy
> data. How are you finding IRAF for processing astrophotos?
>
> Hope your skies clear soon. Machholz is fading!
>
> Andy
>
> -----Original Message-----
> From: astro-photo-bounces@seds.org
> [mailto:astro-photo-bounces@seds.org]On Behalf Of Ray Butler
> Sent: Wednesday, February 09, 2005 6:44 AM
> To: Discussion of Film Astrophotography
> Subject: Re: [APML] Machholz, Cassiopeia, and Double Cluster
>
> Andy, that is sweet! How I wish I could get the skies to clear here -
> I'd be doing exactly the same with my 645 and 6x6 cameras + E200...
>
> I note that you flatfielded by subtracting the median/blur. Does this
> partially (undesirably) flatten out the Milky Way as well? Do you find
> it hard to adequately flatfield when the Milky Way runs through the
> image, and/or there is a gradient in the sky background due to
> increasing skyglow in one direction? A true flatfield should be able to
> disentangle these two additive effects from the multiplicative effects
> of the system vignetting.
>
> This is a problem I'm tackling at the moment with my own processing
> algorithms in IRAF. I think I've developed a good iterative approach to
> tackle this sort of scenario, but I haven't had a chance to hone it
> fully yet, thanks in part to some computer troubles.
>
> Ray "nursing a very sick laptop back to health at the moment" Butler
>
> Andrew Clegg wrote:
>
> > Good weather in the Shenandoah Valley this weekend. I shot Machholz
> > piggyback with the 6x7 on Saturday night, and developed the film while
> > watching the Super bowl last night. Scanned the film this morning (using
> the
> > new Microtek ScanMaker i900) and did some processing in Matlab and
> Photoshop
> > at lunchtime. The results are at www.w4je.com/machholz.htm. Comments
> > welcome!
> >
> > Clear skies,
> > Andy
> >
> > _______________________________________________
> > Astro-Photo mailing list
> > Astro-Photo@seds.org
> > http://seds.org/mailman/listinfo/astro-photo
>
> --
> Dr. Ray Butler (ray.butler@nuigalway.ie || ray@physics.nuigalway.ie)
> Lecturer, Dept. of Physics || Computational Astrophysics Laboratory
> National University of Ireland, Galway, University Road, Galway, Ireland.
> Tel: +353-91-524411 ext. 3788 FAX: +353-91-525700
>
> _______________________________________________
> Astro-Photo mailing list
> Astro-Photo@seds.org
> http://seds.org/mailman/listinfo/astro-photo
>
> _______________________________________________
> Astro-Photo mailing list
> Astro-Photo@seds.org
> http://seds.org/mailman/listinfo/astro-photo
_______________________________________________
Astro-Photo mailing list
Astro-Photo@seds.org
http://seds.org/mailman/listinfo/astro-photo
_______________________________________________
Astro-Photo mailing list
Astro-Photo@seds.org
http://seds.org/mailman/listinfo/astro-photo