Skip to main content

DCT Coefficients

1 reply [Last post]
axelfc
Offline
Joined: 2006-12-29

I am trying to get the DCT coefficients of an image using JAI and then quantize them. Apart from the fact that jai.dct changes the size of an image to powers of 2 if it isn't so i can't figure out how it puts the dct coefficients in an array. In the following source i get the dct coefficients in dctData[]. I know that dct is supposed to work in 8x8 blocks. So it produces 64 coefficients for its block. How are they placed in the dctData[] ?

<br />
ParameterBlock pbDCT = (new ParameterBlock()).addSource(grayImage);<br />
PlanarImage dct = JAI.create("dct", pbDCT, null);</p>
<p>//int dctWidth = dct.getWidth();<br />
//int dctHeight = dct.getHeight();</p>
<p>float[] dctData = dct.getData().getPixels(0, 0, rgbWidth, rgbHeight, (float[]) null);<br />

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23

Please refer to this thread in the old jai-interest archives:

http://archives.java.sun.com/cgi-bin/wa?A1=ind0204&L=jai-interest#18

> I am trying to get the DCT coefficients of an image
> using JAI and then quantize them. Apart from the fact
> that jai.dct changes the size of an image to powers
> of 2 if it isn't so i can't figure out how it puts
> the dct coefficients in an array. In the following
> source i get the dct coefficients in dctData[]. I
> know that dct is supposed to work in 8x8 blocks. So
> it produces 64 coefficients for its block. How are
> they placed in the dctData[] ?
>
> [code]
> ParameterBlock pbDCT = (new
> ParameterBlock()).addSource(grayImage);
> PlanarImage dct = JAI.create("dct", pbDCT, null);
>
> //int dctWidth = dct.getWidth();
> //int dctHeight = dct.getHeight();
>
> float[] dctData = dct.getData().getPixels(0, 0,
> rgbWidth, rgbHeight, (float[]) null);
> [/code]