5

Is it possible to transform images (as shown below) via matrices with Compose.jl? If so, could you please provide a simple example?

I'm aware of the rotation keyword argument in the Compose.context method, but I was wondering if there was something similar for general affine transformations. Thanks!

shear transformation

Alain
  • 853
  • 11
  • 10
  • This seems to be an open feature request: [Compose.jl#115](https://github.com/GiovineItalia/Compose.jl/issues/115). – mbauman Oct 13 '17 at 15:01

1 Answers1

1

You can use Shear. For example, you can transform

enter image description here

from the tutorials (code below)

julia> composition = compose(context(),
               (context(units=UnitBox(0, 0, 1000, 1000)),
                polygon([(0, 1000), (500, 1000), (500, 0)]),
                fill("tomato")),
               (context(),
                polygon([(1, 1), (0.5, 1), (0.5, 0)]),
                fill("bisque")))

and shear it with

julia> composition_sheared = compose(context(shear=Shear(0.3,0.0,0.5,1.0)),
               (context(units=UnitBox(0, 0, 1000, 1000)),
                polygon([(0, 1000), (500, 1000), (500, 0)]),
                fill("tomato")),
               (context(),
                polygon([(1, 1), (0.5, 1), (0.5, 0)]),
                fill("bisque")))

to obtain

enter image description here

Benoit Pasquier
  • 2,868
  • 9
  • 21