MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: affine transformation to rasters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83073] Re: affine transformation to rasters
  • From: "David Park" <djmpark at comcast.net>
  • Date: Fri, 9 Nov 2007 05:19:33 -0500 (EST)
  • References: <fguqhg$pi7$1@smc.vnet.net>

Juan,

I think that translations and scalings were performed - but I'm not certain 
of the composition of your affine transform. In any case, add a Frame to 
your plot to better see what is happening.

oce = Import["ExampleData/ocelot.jpg"];
oceras = oce[[1]];

Graphics[oceras,
 Frame -> True]

Graphics[GeometricTransformation[oceras,
  AffineTransform[{{{-0.139, 0.263}, {0.246,
      0.224}}, {0.57, -0.036}}]],
 Frame -> True]

The following shows that scalings and translations are performed on Rasters.

Graphics[GeometricTransformation[oceras,
  ScalingTransform[{1/200, 1/200}]],
 Frame -> True]

Graphics[GeometricTransformation[oceras,
  TranslationTransform[{-100, -100}]],
 Frame -> True]

The DrawGraphics6 package has alternative forms of all the geometric 
transforms so that they can be applied directly to pieces of graphics as 
postfix operations.

Needs["DrawGraphics6`DrawingMaster`"]

Draw2D[
 {oceras
     // TranslateOp[{-100, -100}]
    // RotateOp[Pi/4]
   // ShearingTransformOp[Pi/4, {1, 0}, {0, 1}]},
 Frame -> True]


-- 
David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/


"juan flores" <juanfie at gmail.com> wrote in message 
news:fguqhg$pi7$1 at smc.vnet.net...
> Hi all,
>
> I am working on fractals through IFS (Iterated Function Systems).  An
> IFS ca be defined as a set of affine transformations that are
> iteratively applied to an initial image.  All examples in the Wolfram
> Demonstrations Project do IFSs with polygons.  When you apply an
> affine transformation to a raster image, you get the rotations,
> reflections, and shearings right, but not the translations nor the
> scalings.
>
> I am reading a jpg file with import, extracting the raster from it,
> and applying an affine transformation.
>
> oce = Import["ExampleData/ocelot.jpg"];
> oceras = oce[[1]];
> Graphics[GeometricTransformation[oceras,
>  AffineTransform[{{{-0.139, 0.263},
>                            {0.246, 0.224}},
>                           {0.57, -0.036}}]]]
>
> In this case, the affine transformation is a composition of
> translation, rotation, reflection, and shearing.
>
> Any ideas on how to proceed?  Any tricks?
>
> Regards,
>
> Juan Flores
> Universidad Michoacana
> Mexico
>
> 



  • Prev by Date: Re: Re: Can you get a package back to a notebook easily?
  • Next by Date: ContourPlot Problem
  • Previous by thread: Re: affine transformation to rasters
  • Next by thread: What is #6 to SphericalPlot3D[]