我遇到了这个惊人的响应Applying MATLAB's idwt2
several times我自己执行来理解它。但是,我无法了解如何将其用于处理 RGB 图像。所以,我有3个问题。
如何将代码应用于仅在输出中显示转换后的图像以及沿行和列的高频和低频分量的 RGB 图像,是否可以将所有分量的融合视为单个图像?我知道我必须使用 cat 运算符,但我不明白该怎么做。
其次,我也得到了一个迷宫般的图像!我很困惑,因为我似乎无法理解原因。我还附上了相同的代码以及显示该图像是如何生成的语句。
db1
3.函数签名中的术语是什么意思dwt
?
代码:
load woman; % Load image data
%startImage=imread('pic_rgb.jpg'); % IF I WANT TO WORK WITH RGB IMAGE
nLevel = 3; % Number of decompositions
nColors = size(map,1); % Number of colors in colormap
cA = cell(1,nLevel); % Approximation coefficients
cH = cell(1,nLevel); % Horizontal detail coefficients
cV = cell(1,nLevel); % Vertical detail coefficients
cD = cell(1,nLevel); % Diagonal detail coefficients
startImage = X;
for iLevel = 1:nLevel,
[cA{iLevel},cH{iLevel},cV{iLevel},cD{iLevel}] = dwt2(startImage,'db1');
startImage = cA{iLevel};
end
figure;colormap(map);
imagesc(dwt2(startImage,'db1')); %THIS GIVES THE MAZED IMAGE INSTEAD OF THE TRANSFORMED IMAGE
figure;
tiledImage = wcodemat(cA{nLevel},nColors);
for iLevel = nLevel:-1:1,
tiledImage = [tiledImage wcodemat(cH{iLevel},nColors); ...
wcodemat(cV{iLevel},nColors) wcodemat(cD{iLevel},nColors)];
end
figure;
imshow(tiledImage,map);
%reconstruct
fullRecon = cA{nLevel};
for iLevel = nLevel:-1:1,
fullRecon = idwt2(fullRecon,cH{iLevel},cV{iLevel},cD{iLevel},'db1');
end
partialRecon = cA{nLevel};
for iLevel = nLevel:-1:1,
partialRecon = idwt2(partialRecon,[],[],[],'db1');
end
figure;
imshow([X fullRecon; partialRecon zeros(size(X))],map,...
'InitialMagnification',50);