Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What happend to Image?

77 views
Skip to first unread message

Alexei Boulbitch

unread,
May 8, 2013, 4:09:51 AM5/8/13
to

Dear Community,

I just noticed that the function Image[ ] has unexpectedly changed since 9.0.0.

Some time ago I have written a handy program working with the image. I have once published it here. Among others this program applied the operation

ReplacePart[image,{4,2}?size]

Where image was the image in use and size has been a parameter equal to a desired ImageSize option. This worked previously. Now it does not.

I checked that the Image indeed has changed somehow.

Let us load any image. For example, this:

lena = Import["ExampleData/lena.tif"]

One may check that this is indeed an image:

Head[lena]

Image

Let us do like this:

lena2= Image[lena, ImageSize -> 300]

then the {{4,2}} part should memorize its size.

One may look at its TreeForm (evaluate this and make sure that it has levels 0, 1, and 2), and {{4,2}} is indeed 300

TreeForm[lena2]

However, if one would evaluate this

Lena2[[4,2]]

he get the message
Part::partd: Part specification... is longer than depth of object\""

Not only {{4,2}}, but also other leaves of the tree are not acceccible.

What happened to the Image?

Alexei


Alexei BOULBITCH, Dr., habil.
IEE S.A.
ZAE Weiergewan,
11, rue Edmond Reuter,
L-5326 Contern, LUXEMBOURG

Office phone : +352-2454-2566
Office fax: +352-2454-3566
mobile phone: +49 151 52 40 66 44

e-mail: alexei.b...@iee.lu

Bob Hanlon

unread,
May 9, 2013, 3:56:58 AM5/9/13
to

lena = Import["ExampleData/lena.tif"];


lena2 = ImageResize[lena, 300];


ImageDimensions /@
{lena, lena2}


{{150, 116}, {300, 232}}


ImageMeasurements[#, "Dimensions"] & /@
{lena, lena2}


{{116, 150, 3}, {232, 300, 3}}


ImageMeasurements[lena, "Properties"]


{"AspectRatio", "Channels", "ColorSpace", "DataRange", "DataType", \
"Dimensions", "Energy", "Entropy", "IntensityCentroid", "Interleaving", \
"Max", "MaxIntensity", "Mean", "MeanIntensity", "Median",
"MedianIntensity", \
"Min", "MinIntensity", "SampleDepth", "Skew", "StandardDeviation", \
"StandardDeviationIntensity", "Total", "TotalIntensity", "Transparency"}



Bob Hanlon

Matthias Odisio

unread,
May 9, 2013, 3:57:08 AM5/9/13
to
Dear Alexei Boulbitch,
As of Mathematica 9, Image objects are atomic.
Wolfram Research has a strong commitment to and a track record of
preserving legacy across versions. Before Mathematica 9, it was never
documented, advised, or advertised to access or replace parts of an
Image object. All these operations should be performed using
documented functions like Image, ImageData, ImageQ, etc.
Image objects are atomic so it is easier for Wolfram Research to
expand the scope of image processing features while maintaining an
internal representation which is as efficient as possible.


As you found out, one can change the displayed size of an image using
Image:

lena = Import["ExampleData/lena.tif"];
newimg = Image[lena, ImageSize -> newsize]
Options[#, ImageSize] & /@ {lena, newimg}



Matthias Odisio
Wolfram Research

Bob Hanlon

unread,
May 10, 2013, 12:31:31 AM5/10/13
to

"As of Mathematica 9, Image objects are atomic."

Then someone at Wolfram needs to update the documentation since it states
for Image:

"New in 7 | Last modified in 8"


Bob Hanlon

Matthias Odisio

unread,
May 10, 2013, 12:31:47 AM5/10/13
to
Thanks for the relevant suggestion, Bob Hanlon.

Point taken. So far image processing functions have been tagged as
"Modified in x" only after update in documentation or design.

Matthias Odisio
Wolfram Research

David Bailey

unread,
May 10, 2013, 12:31:25 AM5/10/13
to
As you say, there are obvious reasons to make certain objects atomic,
though Image objects aren't yet quite atomic - try

Import["ExampleData/lena.tif"] // Length

or indeed

Import["ExampleData/lena.tif"] // InputForm

I also think it might help to be very upfront about such changes when a
new version of Mathematica is released!

David Bailey
http://www.dbaileyconsultancy.co.uk



0 new messages