Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Function: Excise largest area rectangle from a rotated image
Function
Function which will excise the largest possible rectangular region from an image which has been rotated.
Version
version:20170606, v1.0
Author
D. R. G. Mitchell
Acknowledgements
This script was based on Python code found at: https://stackoverflow.com/questions/16702966/rotate-image-and-crop-out-black-borders/16778797#16778797. My thanks to the author.
Comments

This function takes an image and a rotation angle and returns the rotated image. Positive rotation angles (specified in radians) result in anticlockwise rotation. The function will return by reference the coordinates of the maximum area area rectangle in the returned (rotated) image. In addition to the function, a short piece of demonstration code illustrates the use of the function. Note another script on this site excises the largest possible square region from a rotated image.

System Requirements
Tested on GMS 2.3 but should work with all versions.
Known Issues

None.

Supported
Yes
Included Files
Source code
Source Code

See attached script