clc;
clear all;
close all;
Image=imread('4.jpg');
Image=double(Image)/255;
size_info=size(Image);
height=size_info(1);
width=size_info(2);
Map=zeros(height, width);
for row_i=1:height
Map(row_i, :)=row_i/height*0.75;
end
Img_1=Image;
for kk=1:3
Img_1(:,:,kk)=Image(:,:,kk).*Map;
end
% % figure, imshow(Img_1);
Img_2=Img_1;
for ii=1:height
Img_2(ii,:,:)=Img_1(height+1-ii,:,:);
end
% % figure, imshow(Img_2);
%% 縮放要注意,不要超出背景圖的尺寸
small_1=imresize(Image, 0.45);
small_2=imresize(Img_2, 0.45);
Canvas=zeros(height, width, 3);
l_row=floor(height/2);
l_col=floor(width/4);
%% 將圖像對(duì)稱(chēng)放置
Canvas(l_row:l_row+size(small_1,1)-1,l_col:l_col+...
size(small_1,2)-1,: )=small_2;
Canvas(l_row-size(small_1,1):l_row-1,l_col:l_col+...
size(small_1,2)-1,: )=small_1;
figure, imshow(Canvas);
原圖:
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。