close all;clear all;clc;
%對圖像進行Hadamard變換
I=imread('peppers.png');
I=rgb2gray(I);
I=im2double(I);
h1=size(I,1); %圖像的行
h2=size(I,2); %圖像的列
H1=hadamard(h1); %Hadamard變換矩陣
H2=hadamard(h2); %Hadamard變換矩陣
J=H1*I*H2/sqrt(h1*h2); %Hadamard變換
figure;
set(0,'defaultFigurePosition',[100,100,1000,500]);
set(0,'defaultFigureColor',[1 1 1]);
subplot(121);imshow(I);
subplot(122);imshow(J);
左圖爲原來的灰度圖像,右圖爲Hadamard變換的結果