【问题标题】:how to do histogram for dct coeffcient to show Double Quantiztion effect?如何为 dct 系数做直方图以显示双量化效果?
【发布时间】:2014-03-29 15:15:37
【问题描述】:

我想要做的是图像量化 DCT 系数的直方图,以检测双量化效果。当我使用 hist(x) 时,它会将其分类为 10 秒,如果我将其更改为 hist(x,20) 或 30,它并不会真正显示 DQ 效果。那么有没有更好的方法呢? 这是代码:在matlab上

im = jpeg_read('image');
% Pull image information - Lum, Cb, Cr
lum = im.coef_arrays{im.comp_info(1).component_id};
cb = im.coef_arrays{im.comp_info(2).component_id};
cr = im.coef_arrays{im.comp_info(3).component_id};
% Pull quantization arrays
lqtable = im.quant_tables{im.comp_info(1).quant_tbl_no};
cqtable = im.quant_tables{im.comp_info(2).quant_tbl_no};
% Quantize above two sets of information
qcof = quantize(lum,lqtable);
bqcof = quantize(cb,cqtable);
rqcof = quantize(cr,cqtable);
hist(qcof,30); %lum quantized dct coefficient histogram

【问题讨论】:

    标签: matlab histogram dct quantization


    【解决方案1】:

    首先,不需要量化系数。其次,可以通过绘制某些频率的直方图来观察效果。您需要遍历块中的各个位置并寻找模式。绘制直方图的 FFT 会有所帮助。

    这是matlab代码:

    imJPG2 = jpeg_read('foto2.jpg');
    lum = imJPG2.coef_arrays{imJPG2.comp_info(1).component_id};
    for i = 1:8
         for j = 1:8
            r = lum( i:8:end, j:8:end );
            histogram(r(:), 'binmethod','integers');
            pause();
        end
    end
    

    更多细节和背景可以在这篇论文中找到:http://www.sciencedirect.com/science/article/pii/S0031320309001198

    【讨论】:

      猜你喜欢
      • 2011-05-08
      • 2015-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-02
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      相关资源
      最近更新 更多