Author Topic: Rotation and Translation  (Read 1703 times)

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Rotation and Translation
« on: 2017 October 14 08:52:57 »
Hi,

PI does not have a process that allows to translate an image.
- The existing Rotation process does not allow for translation
- The existing Rotation process does not allow to define the center of the rotation (always rotates around the middle of the image)
- The existing Rotation process also has the problem of always producing a resized image rotated, and thus cannot be used with ImageContainer or in cases where a resized image is not desireable.
- It is possible with PixelMath (see below), but not really straight forward.

I suggest to add a process that allows for translation, rotation around arbitrariy center, and may be scale+shear (=affine projection).

Workaround for the moment: PixelMath with appropriate symbol definition and an expression like this:

Code: [Select]
rotation=-5.5;
translationX=0;
translationY=0;
centerX=w()/2;
centerY=h()/2;
rotationArc=rotation/180*pi();
sinArc=sin(rotationArc);
cosArc=cos(rotationArc);
dx=x()-centerX;
dy=y()-centerY;
pixel($T,centerX-translationX+dx*cosArc-dy*sinArc, centerY-translationY+dx*sinArc+dy*cosArc)
Georg
« Last Edit: 2017 October 15 05:40:29 by georg.viehoever »
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
Re: Rotation and Translation
« Reply #1 on: 2017 October 16 05:54:29 »
Hi Georg,

Actually, I've been wanting to write an AffineTransformation tool for years. Time permitting, count on this tool being available in the short term. Thanks for pointing this out.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Re: Rotation and Translation
« Reply #2 on: 2017 October 16 05:55:47 »
 8)
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)