문제

what i want to do is a histogram for quantized DCT coefficient for an image, to detect Double Quantization effect. when i use hist(x) it will categorize it in to 10s and if i changed it to hist(x,20) or 30 it does not really show the DQ effect. so is there any better way for this?? here is the code: on 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
도움이 되었습니까?

해결책

First, no need to quantize the coefficients. Secondly, the effect can be observed by plotting histograms of certain frequencies. You need to go through various positions in the blocks and look for the pattern. Plotting FFT of the histogram helps.

Here is the matlab code:

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

More details and background can be found in this paper: http://www.sciencedirect.com/science/article/pii/S0031320309001198

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top