How to preserve edges when rotating images

8 views (last 30 days)
How can i make sure that my images dont cut off when using rotation in image augmentation
imageAugmenter = imageDataAugmenter('RandRotation',[0,360]);
In = imread('input_image.bmp');
Out = augment(imageAugmenter,In);
What additional parameters, do i need to set, to ensure the image dont get cut off at the edges

Accepted Answer

Walter Roberson
Walter Roberson on 7 Jan 2021
pad the image with nan so that it becomes sqrt(2) times its original size. Do the random rotation on that. Find the bounding box of non-nan elements and crop. Fill the remaining nan with something appropriate.
Or... don't use the image augmenter, and use imrotate with a random angle, specifying an appropriate padding strategy.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!