Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14460

Re: What happend to Image?

From Matthias Odisio <matthias@wolfram.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: What happend to Image?
Date 2013-05-09 07:57 +0000
Message-ID <kmfksk$br3$1@smc.vnet.net> (permalink)
References <20130508080952.52D386837@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


Dear Alexei Boulbitch,

On 5/8/13 3:09 AM, Alexei Boulbitch wrote:
> 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.boulbitch@iee.lu
> 

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

Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: What happend to Image? Matthias Odisio <matthias@wolfram.com> - 2013-05-09 07:57 +0000
  Re: What happend to Image? David Bailey <dave@removedbailey.co.uk> - 2013-05-10 04:31 +0000

csiph-web