【问题标题】:Image Compression Using wavelet- MATLAB使用小波进行图像压缩 - MATLAB
【发布时间】:2013-01-25 14:57:30
【问题描述】:

我正在 MATLAB 中基于小波进行图像压缩...我已经构建了以下代码。一切正常,但压缩图像显示为纯黑白图像。如果我将分解级别设为 1,它将压缩图像显示为全黑,对于分解级别:2,它给出全白图像。对于分解级别 3,它给出 3/4 白色和 1/4 黑色。 。 请帮忙。我使用的代码是

clear all;

close all;

input_image1=imread('C:\Users\Prem\Documents\MATLAB\mandrill.jpg');

input_image=imnoise(input_image1,'speckle',.01);

figure;

imshow(input_image);

n=input('enter the decomposition level=');

[Lo_D,Hi_D,Lo_R,Hi_R] = wfilters('haar');

[c,s]=wavedec2(input_image,n,Lo_D,Hi_D);

disp(' the decomposition vector Output is');

disp(c);

[thr,nkeep] = wdcbm2(c,s,1.5,3*prod(s(1,:)));

 [compressed_image,TREED,comp_ratio,PERFL2] =wpdencmp(thr,'s',n,'haar','threshold',5,1);

 disp('compression ratio in percentage');

 disp(comp_ratio);

  re_ima1 = waverec2(c,s,'haar'); 

 re_ima=uint8(re_ima1);

  subplot(1,3,1);

 imshow(input_image);

 title('i/p image');

 subplot(1,3,2);

 imshow(compressed_image);

 title('compressed image');

 subplot(1,3,3);

 imshow(re_ima);

 title('reconstructed image');

【问题讨论】:

    标签: matlab wavelet


    【解决方案1】:

    我认为缩放图像的问题。您可以将结果图像按合适的数量划分或使用

    imagesc(desire image);
    
    subplot(1,3,2);
    
    imshow(compressed_image/156);
    
    title('compressed image');
    
    subplot(1,3,3);
    
    imagesc(re_ima);
    
    title('reconstructed image');
    

    【讨论】:

      【解决方案2】:

      在这条线上

       [compressed_image,TREED,comp_ratio,PERFL2] =wpdencmp(thr,'s',n,'haar','threshold',5,1);
      

      您将阈值作为信号传递......这是不正确的。

      【讨论】:

      • @user101509 试试[compressed_image,TREED,comp_ratio,PERFL2] =wpdencmp(input_image,'s',n,'haar','threshold',5,1); - 我目前无法访问小波工具箱,我不记得该函数对其输入的确切作用。 help wpdencmp 了解有关输入参数的更多信息
      • 它不起作用...现在压缩图像对于所有 3 个级别都是全白的
      猜你喜欢
      • 2013-08-07
      • 1970-01-01
      • 2011-07-19
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多