MATLAB Answers

How to change background color with imrotate function?

15 views (last 30 days)
mju
mju on 8 Jan 2020
Answered: Image Analyst on 8 Jan 2020
I want to use imorotate function.
When this function let turn, a background color becomes the black.
Do you have the method to leave a background white?

  0 Comments

Sign in to comment.

Answers (2)

Adam Danz
Adam Danz on 8 Jan 2020
Edited: Adam Danz on 8 Jan 2020
Try
set(gca, 'color', 'w')
or
axis tight

  0 Comments

Sign in to comment.


Image Analyst
Image Analyst on 8 Jan 2020
Right now there is no option to set the color of the background that is exposed after rotation. You could make a copy of imrotate() and call it imrotateColor.m and then edit it to put in the color you want. Or you could rotate a uniform image and find the zero pixels and replace those in your actual image with the color you want. But making your own imrotate2 is easier.

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!