📄 ica_image_demo.m
字号:
%
% David Gleich
% CS 152 - Neural Networks
% 12 December 2003
%
f1 = rgb2gray(imread('p1.jpg'));
f2 = rgb2gray(imread('p2.jpg'));
f3 = rgb2gray(imread('p3.jpg'));
f1 = imresize(f1, [128 120], 'bicubic');
f2 = imresize(f2, [128 120], 'bicubic');
f3 = imresize(f3, [128 120], 'bicubic');
rand('seed', 10);
[m n] = size(f1);
s1 = im2double(reshape(f1, 1, m*n));
s2 = im2double(reshape(f2, 1, m*n));
s3 = im2double(reshape(f3, 1, m*n));
figure(1);
s1m = mean(s1);
s2m = mean(s2);
s3m = mean(s3);
s1nm = s1 - s1m;
s2nm = s2 - s2m;
s3nm = s3 - s3m;
S = [s1; s2; s3];
Snm = [s1nm; s2nm; s3nm];
M = rand(3,3);
X = M*S;
x1 = mat2gray(reshape(X(1,:), m, n))*255/max(X(1,:));
x2 = mat2gray(reshape(X(2,:), m, n))*255/max(X(3,:));
x3 = mat2gray(reshape(X(3,:), m, n))*255/max(X(3,:));
figure(1);
montage([f1, f2, f3; x1, x2, x3]);
Bbs = bsica(X, 3, 'niter', 5);
Beasi = easi(X, 3, 'niter', 5);
Ybs = Bbs*X;
Yeasi = Beasi*X;
bs1 = mat2gray(reshape(Ybs(1,:), m, n));
bs2 = mat2gray(reshape(Ybs(2,:), m, n));
bs3 = mat2gray(reshape(Ybs(3,:), m, n));
bs1 = bs1 * 255./max(bs1(:));
bs2 = bs2 * 255./max(bs2(:));
bs3 = bs3 * 255./max(bs3(:));
e1 = mat2gray(reshape(Yeasi(1,:), m, n));
e2 = mat2gray(reshape(Yeasi(2,:), m, n));
e3 = mat2gray(reshape(Yeasi(3,:), m, n));
e1 = e1 * 255./max(e1(:));
e2 = e2 * 255./max(e2(:));
e3 = e3 * 255./max(e3(:));
figure(2);
montage([bs1 bs2 bs3; e1 e2 e3; f1 f2 f3]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -