MATLAB Answers

How to preserve edges when rotating images

4 ビュー (過去 30 日間)
Elysi Cochin
Elysi Cochin 2021 年 1 月 7 日
回答済み: Walter Roberson 2021 年 1 月 7 日
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
Walter Roberson 2021 年 1 月 7 日
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.

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by