问题
%Padding Part%
Padding_Bottom_And_Top = zeros(round(Image_Height/2),Image_Width,3);
Side_Padding = zeros(Image_Height+2*size(Padding_Bottom_And_Top,1),Image_Width/2,3);
Padded_Image = [Padding_Bottom_And_Top; Original_Image];
Padded_Image = [Padded_Image; Padding_Bottom_And_Top];
Padded_Image = [Side_Padding Padded_Image];
Padded_Image = [Padded_Image Side_Padding];
[Padded_Image_Height,Padded_Image_Width,~] = size(Padded_Image);
Rotated_Image = zeros(Image_Height,Image_Width,3);
This is an classical padding code. As u see this code do same padding for all images. I need to have a padding code that just do enough amount (Enough to not cut the edges of the picture ) of padding while rotating between 0 to 45 degrees.
Padding_Bottom_And_Top = zeros(round(Image_Height/2),Image_Width,3);
For instance, in this piece of code we are taking 'image_height/2' to make a padding , so absouletly it is not gonna clip with creating a padding with same height of the image, but isn't it more than necessary.
What is the useful amount of height-width for padding ? Can u help me ?
来源:https://stackoverflow.com/questions/65012904/best-padding-for-images