PixInsight Forum

PixInsight => Wish List => Topic started by: georg.viehoever on 2017 October 14 08:52:57

Title: Rotation and Translation
Post by: georg.viehoever 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
Title: Re: Rotation and Translation
Post by: Juan Conejero 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.
Title: Re: Rotation and Translation
Post by: georg.viehoever on 2017 October 16 05:55:47
 8)