Copyright © Fred Weinhaus My scripts are available free of charge for non-commercial (non-profit) use, ONLY. For use of my scripts in commercial (for-profit) environments or non-free applications, please contact me (Fred Weinhaus) for licensing arrangements. My email address is fmw at alink dot net. If you: 1) redistribute, 2) incorporate any of these scripts into other free applications or 3) reprogram them in another scripting language, then you must contact me for permission, especially if the result might be used in a commercial or for-profit environment. Usage, whether stated or not in the script, is restricted to the above licensing arrangements. It is also subject, in a subordinate manner, to the ImageMagick license, which can be found at: http://www.imagemagick.org/script/license.php Please read the Pointers For Use on my home page to properly install and customize my scripts. |
Applies a perspective distortion to an image by providing three rotation angles and an optional perspective exaggeration |
last modified: December 15, 2018
USAGE: rotate3D pan,tilt,roll[,pef] infile outfile
pan ................. rotation about image vertical centerline: -180 to +180 (deg) PURPOSE: To apply a perspective distortion to an image by providing three rotation angles and an optional perspective exaggeration. DESCRIPTION: ROTATE3D applies a perspective distortion to an image by providing three optional rotation angle: pan, tilt and roll with an option to control the perspective exaggeration. PAN is a rotation of the image about its vertical centerline -180 to +180 degrees. Positive rotations turn the right side of the image away from the viewer and the left side towards the viewer. Zero is no rotation. A PAN of +/- 180 deg achieves the same results as -flip. TILT is a rotation of the image about its horizontal centerline -180 to +180 degrees. Positive rotations turn the top of the image away from the viewer and the bottom towards the viewer. Zero is no rotation. A TILT of +/- 180 deg achieves the same results as -flop. ROLL (like image rotation) is a rotation in the plane of the the image -180 to +180 degrees. Positive values are clockwise and negative values are counter-clockwise. Zero is no rotation. A ROLL of any angle achieves the same results as -rotate. PAN, TILT and ROLL are order dependent. If all three are provided, then they will be done in that order. PEF is the perspective exaggeration factor. It ranges from 0 to 3.19. A normal perspective is achieved with the default of 1. As PEF is increased from one the perspective effect moves towards that of a wide angle lens (more distortion). If PEF is decreased from one the perspective effect moves towards a telephoto lens (less distortion). PEF of 0.5 achieves an effect close to no perspective distortion. PEF values too large may cause part of the image appear above the 'horizon' in the 'sky'. Mathematics Background (32KB PDF) CAVEAT: No guarantee that this script will work on all platforms, nor that trapping of inconsistent parameters is complete and foolproof. Use At Your Own Risk. |
Original Image |
Various Perspective Distortions Applied To Image |
|||
arguments: |
arguments: |
arguments: |
arguments: |
Various Perspective Distortions Applied To Image |
|||
arguments: |
arguments: |
arguments: |
arguments: |
Comparison Of Perspective vs Bilinear Distortions |
|||
Perspective |
True Bilinear |
Pseudo Bilinear |
|
Peserves all straight lines from input |
Preserves all horizontal and vertical straight lines from input, but diagonal lines get curved. |
Does not preserve any straight lines from input. |
What the script does is as follows:
For the case of pan=30 and tilt=30, this is equivalent to:
|