【问题标题】:How to reconstruct image from a percentage of largest DWT coefficients in Matlab如何从 Matlab 中最大 DWT 系数的百分比重建图像
【发布时间】:2018-05-11 11:00:30
【问题描述】:

我想仅从最大系数的 5% 的多级 DWT 变换重建图像,同时将其余系数设置为零。 我不确定我需要从哪些系数中选择最大的 5%? A、H、V 还是 D?

这是我到目前为止所做的:

% Read image
x = imread('app.bmp'); 

% Define wavelet name
wavelet = 'haar';
% Define wavelet decomposition level
level = 4;
% Define colormap
map = gray;
% Compute multilevel 2D wavelet decomposition
[C, S] = wavedec2(x,level,wavelet);
for i = 1:levle
    % Approximation coefficients
    A = appcoef2(C,S,'haar',i);
    % Detailed coefficients
    [H,V,D] = detcoef2('all',C,S,i);
 end

任何帮助将不胜感激!

【问题讨论】:

    标签: matlab image-processing compression dwt wavelet-transform


    【解决方案1】:

    为了获取矩阵/向量的最高 x% 值,我通常这样做:

    % define the threshold (5% here)
    thr = 0.05;
    % sort the variable in descending order
    As = sort(A(:),'descend');
    % obtain the elements belonging to the top x%
    At = As(1:ceil(numel(As) * thr));
    

    现在 At 变量包含矩阵/向量 A 的前 x% 值。由于您想保持 A 的原始形状并将其所有低于阈值的元素设置为 0:

    % take the minimum value of the result
    Am = min(At);
    % take the original matrix and set all the elements below the minimum top x% to zero:
    A(A < Am) = 0;
    

    在这里您获得了 A 矩阵/向量的最终形式。

    【讨论】:

    • 感谢您的回答,但这里的 A 是什么?哪个级别的哪个系数?当我重建图像时,我应该使用 waverec2,那么我应该将哪些变量作为 C 和 S 传递?
    • 在尝试了您建议的代码后,我认为它不起作用,因为我认为我们需要在 A(A
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-12-28
    • 2015-03-02
    • 2021-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多