> I want to predict the compression ratio or the rough estimate of
> output image size by at the Quantization step of JPEG. I know it's a
> little difficult (may be impossible) especially when I don't have the
> statistical model of my input data but still, I would be thanksful if
> someone can share some algorithm using which I can predict the image
> size at the quantization step or by the number of zeros.
Traditional JPEG or JPEG2000? Anyhow, there's a fine statistical
model that works for both; it's a bit better for wavelets, but anyhow:
The output of the DCT step is very well-modeled by data with a probability
distribution/amplitude density function
p(y) ~ exp(-\beta |y|^\alpha) (1)
where y is the amplitude and alpha, beta are two constants you need
to figure out from your data. alpha and beta can be measured from the
data by computing the second and the fourth moment of the amplitude
density (insert into the integral, compute yourself, be astonished
about gamma functions, leaving details aside).
Given the above law (1), one can again predict how much rate an
"optimal" 0-th order entropy encoder would generate. This is again by
observing that the output rate of this encoder is equal to its
H = \sum_i p_i log p_i (2)
where p_i is the probability of the ith symbol. In this case, p_i
is the probability of "hitting" the ith bucket of the quantizer.
From (1), one can compute p_i by integrating it over the bucket, then
insert in (2). All this is best done with some lookup tables to speed
it up. Of course, this is still pretty "rough" since JPEG Huffman is
neither zero order nor optimal, and (1) is of course also "ad hoc".
This method here over-predicts the rate for wavelet-based codes by
around 10-20%, I haven't tried for DCT.