标签:
我想说怀旧风格的效果很容易实现,就那么几句话,也没啥可说的。
1 % 怀旧风格滤镜 2 clear all; 3 close all; 4 [FileName,PathName] = uigetfile(‘*.jpg‘,‘Open an Image File‘); 5 img = imread([PathName FileName]); 6 figure, imshow(img); 7 img = double(img); 8 Rimg = img(:,:,1); 9 Gimg = img(:,:,2); 10 Bimg = img(:,:,3); 11 [x ,y] = size(Rimg); 12 Rimg0 = 0.393 * Rimg + 0.769 * Gimg + 0.189 * Bimg; 13 Gimg0 = 0.349 * Rimg + 0.686 * Gimg + 0.168 * Bimg; 14 Bimg0 = 0.272 * Rimg + 0.534 * Gimg + 0.131 * Bimg; 15 for i = 1 : x 16 for j = 1 : y 17 if(Rimg0(i, j)>255) 18 Rimg0(i, j) = 255; 19 end 20 if(Gimg0(i, j)>255) 21 Gimg0(i, j) = 255; 22 end 23 if(Bimg0(i, j)>255) 24 Bimg0(i, j) = 255; 25 end 26 end 27 end 28 img(:, :, 1) = Rimg0; 29 img(:, :, 2) = Gimg0; 30 img(:, :, 3) = Bimg0; 31 figure, imshow(uint8(img));
标签:
原文地址:http://www.cnblogs.com/2014-august/p/4330899.html