matlab 老照片处理,matlab实现PS算法之百叶窗、老照片
%{
設置好條紋的寬度和條紋的間隔,建立一個
遮罩層,等間隔的對原圖進行等間距的遮罩。
%}
clear,clc;
[filename,pathname] = uigetfile('*.jpg;*.bmp','選擇圖片','E:\pictures\For_Project\Matlab');
imgaepath = strcat(pathname,filename);
image = imread(imgaepath);
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, :)=1-row_i/height;
end
imshow(Map);
H_shade=10;
Interval=5;
Num=height/(H_shade+Interval);
Num=floor(Num);
mask=ones(height, width);
for j=1:Num+1
if(j<=Num)
begin_1=1+(j-1)*(H_shade+Interval);
mask(begin_1:begin_1+H_shade-1,:)=0;
else
begin_1=1+Num*(H_shade+Interval);
mask(begin_1:height, :)=0;
end
end
figure(2), imshow(mask);
for kk=1:3
Image(:,:,kk)=Image(:,:,kk).*(1-mask)+Map.*mask;
end
figure(3), imshow(Image);
figure(1),imshow((image));
%{
設置好條紋的寬度和條紋的間隔,建立一個
遮罩層,等間隔的對原圖進行等間距的遮罩。
%}
clear,clc;
[filename,pathname] = uigetfile('*.jpg;*.bmp','選擇圖片','E:\pictures\For_Project\Matlab');
imgaepath = strcat(pathname,filename);
image = imread(imgaepath);
figure,imshow(image);
Image = image;
Image=double(Image);
Image_new=Image;
Image_new(:,:,1)=0.393*Image(:,:,1)+0.769*Image(:,:,2)+0.189*Image(:,:,3);
Image_new(:,:,2)=0.349*Image(:,:,1)+0.686*Image(:,:,2)+0.168*Image(:,:,3);
Image_new(:,:,3)=0.272*Image(:,:,1)+0.534*Image(:,:,2)+0.131*Image(:,:,3);
figure,imshow(Image_new/255);
總結
以上是生活随笔為你收集整理的matlab 老照片处理,matlab实现PS算法之百叶窗、老照片的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 猜猜乐游戏php源码,C/C++百行代码
- 下一篇: was更换java版本,WAS如何更换J