How to preserve edges when rotating images
3 views (last 30 days)
Elysi Cochin on 7 Jan 2021
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
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.