Problems combining new v7.0 Image command with other graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg95081] Problems combining new v7.0 Image command with other graphics
- From: Mac <mwjdavidson at googlemail.com>
- Date: Tue, 6 Jan 2009 04:08:54 -0500 (EST)
The new image processing features of Mathematica are very useful and
very much needed at least for my work. There are, however, three key
features that are missing in my opinion or are implemented in an
inconsistent fashion:
1) The ability to manipulate image data that is not scaled between 0
and 1. In many cases image data represent useful physical information
(e.g. brightness of stars, temperature etc...) which are usually
encoded in reals. Scaling everything between 0 and 1 to be able apply
the image processing routines like ImageCrop[], ImageTake[] and
ImagePartition[] seems clumsy and unnecessary. My previous experience
with the IDL language didn't require jumping through these kind of
hoops. Note that the Raster[] command does give the possibility of
scaling data on the fly for display.
2) The ability to apply image processing to user defined regions. It
would be very useful to be able to define regions of interest (say
with polygons) and apply image processing or information extraction
techniques to this region only instead of treating the whole image.
3) Inconsistent behaviour with respect to combined graphics. An
example is given below illustrating how difficult it is to combine
Image data with other Mathematica graphics. The fact that the Show[]
command works with a single image but not with multiple image +
graphic combinations seems to be inconsistent with the syntax and
purpose of the Show[] command. Using Raster[] we get the expected
behaviour but cannot use the new image processing routines of v. 7.0.
If you have any work arounds for the above problems or comments I
would be interested in hearing these.
Mac
Example:
Generate an small test image
img = RandomReal[{0, 1}, {100, 200}];
This works and produces a graphic in the notebook
Image[img]
This also works
Show[Image[img]]
However, although show works with a single image, showing several
graphics combined produces the error "Image is not a Graphics
primitive" even though the Show[] syntax is respected.
Show[Image[img, ImageSize -> 200], Graphics@Circle[]]
This also produces a the same error
Graphics@Image[img]
whereas graphics can be combined using the old-fashioned Raster
command without problem
Show[Graphics@Raster[img], Graphics[{Red, Circle[{100, 50}, 40]}]]