我在MATLAB中有smqt的问题是否有smqt函数的源代码?我希望自定义此功能以便更好地使用。
答案 0 :(得分:1)
最后......
function M = SMQT(V, l, L)
if l>L
M = zeros(size(V), 'like', V);
return;
end
meanV = nanmean(V(:));
D0 = V;
D1 = V;
if not(isnan(meanV))
D0(D0 > meanV) = NaN;
D1(D1 <= meanV) = NaN;
end
M = not(isnan(D1)) * (2^(L-l));
if l==L
return;
end
M0 = SMQT(D0, l+1, L);
M1 = SMQT(D1, l+1, L);
M = M + M0 + M1;
end
玩得开心..;)
使用:
lena = imread('c:\matlab\lena_gray_256.tif');
M = uint8(SMQT(double(lena),1,8));
imshow(M);