1.将一个图片嵌入一张图里,去除黑边
clc clear close all I = imread('qiegray.jpg'); I = rgb2gray(I); I = double(I); I1 = imresize(I, 0.3); I2 = I1 [M,N] = size(I2); for i = 1:M for j = 1:N I2(i,j) = -1; end end I2 = imrotate(I2,60); %figure, imshow(I2); I1 = imrotate(I1,60); [M,N] = size(I1); for i = 1:M for j = 1:N if(I2(i,j) == I1(i,j)) else I(i + 30, j + 30) = I1(i,j); end end end figure, imshow(uint8(I)); imwrite(uint8(I),'heli.jpg');