MATLAB旋转和平移时,以白色填充多出来的区域

主要思路:在旋转和平移操作之前进行一个~image操作,旋转和平移之后在~image(取反)回来就行。

    img = imread('1.bmp');
    img = rgb2gray(img);
    
    thresh = graythresh(img);           % 自动确定二值化阈值
    img = imbinarize(img,thresh);       % 对图像二值化
  
     temp = imrotate(~img, 30 );        % 旋转30度
     temp = ~temp;
        

猜你喜欢

转载自blog.csdn.net/u011622208/article/details/79968776