ウェーブレット分解で画像係数 (近似と詳細の両方) を取得した後、近似係数と詳細係数の四分木構造が必要です。しかし、毎回同じエラーが発生します。助けてください。2 の代わりに 3 の累乗にしようとしましたが、役に立ちませんでした。私はどこかで間違っているかもしれません。
code for image decomposition
X=imread('abc.tif');
close all
clf
image(X)
colormap('default')
axis ('image'); set(gca,'XTick',[],'YTick',[]); title('Original')
pause
dwtmode('sym')
wname = 'bior4.4'
t = wtree(X,2,'bior4.4');
plot(t)
pause
close(2)
[wc,s] = wavedec2(X,5,wname);
a1 = appcoef2(wc,s,wname,1);
h1 = detcoef2('h',wc,s,1);
v1 = detcoef2('v',wc,s,1);
d1 = detcoef2('d',wc,s,1);
a2 = appcoef2(wc,s,wname,2);
h2 = detcoef2('h',wc,s,2);
v2 = detcoef2('v',wc,s,2);
d2 = detcoef2('d',wc,s,2);
a3 = appcoef2(wc,s,wname,3);
h3 = detcoef2('h',wc,s,3);
v3 = detcoef2('v',wc,s,3);
d3 = detcoef2('d',wc,s,3);
a4 = appcoef2(wc,s,wname,4);
h4 = detcoef2('h',wc,s,4);
v4 = detcoef2('v',wc,s,4);
d4 = detcoef2('d',wc,s,4);
a5 = appcoef2(wc,s,wname,5);
h5 = detcoef2('h',wc,s,5);
v5 = detcoef2('v',wc,s,5);
d5 = detcoef2('d',wc,s,5);
私が使用している四分木の場合:
S = qtdecomp(I,.27); %I is image in greyscale.
blocks = repmat(uint8(0),size(S));
for dim = [512 256 128 64 32 16 8 4 2 1];
numblocks = length(find(S==dim));
if (numblocks > 0)
values = repmat(uint8(1),[dim dim numblocks]);
values(2:dim,2:dim,:) = 0;
blocks = qtsetblk(blocks,S,dim,values);
end
end
blocks(end,1:end) = 1;
blocks(1:end,end) = 1;
imshow(I), figure, imshow(blocks,[])
表示されているエラーは次のとおりです。
??? Error using ==> qtdecomp>ParseInputs at 229
MAXDIM / MINDIM is not a power of 2
Error in ==> qtdecomp at 88
[A, func, params, minDim, maxDim] = ParseInputs(varargin{:});
or
??? Error using ==> qtdecomp>ParseInputs at 145
A must be two-dimensional
Error in ==> qtdecomp at 88
[A, func, params, minDim, maxDim] = ParseInputs(varargin{:});