[AstroPy] Moving Ahead with Raw Image Conversion
Tue Apr 14 13:29:24 CDT 2009
2009/4/14 Wayne Watson <firstname.lastname@example.org>:
> Well, one more question about manipulation.
> rawim_numpy = numpy.fromfile('sent_internal.raw', dtype='uint8')
> was a good device for producing this from a file:
> array([1, 1, 1, ..., 1, 1, 1], dtype=uint8)
> a numpy array. In my program, I'm getting* the image in a string 307200
> "characters" long. Is there a device (fromstring?) that would do this in
> one fell swoop to get a numpy array?
> * as here: img_string=self.current_image.tostring()
There is, yes, but if what you have is a PIL image, you can make a
numpy array directly from the underlying memory:
Incidentally, if you want to do image processing on the contents of a
FITS file, you might try scipy's ndimage tools. They are likely to be
a better fit to the sort of tasks you want to do than PIL's image
processing. There may also be more astronomical image processing
libraries available (pyraf?), I haven't really looked for them.
More information about the AstroPy