Skip to main content

DFT operator set image size to 0 width, 0 height

3 replies [Last post]
mjazwinski
Offline
Joined: 2005-04-05

Hi !

I encountered a strange (from my point of view) problem. I want to use DFT and IDFT operations in JAI to compute image autocorrelation, according to Wiener-Khinchin theorm. But after the dft operation image size is set to 0 width and zero height. It's not JAIs pull rendering model, because the image simply can't be rendered (an exception is thrown in one of JAI classes). I can't also use another operator after DFT, because I get exception with message that DataBuffer cannot be created.

My code is fairly simple:
1. Load image using "fileload" operation
2. create parameter block
3. add scaling and data nature properties to parameter block
I tried using different scaling properties, and I specified data nature as REAL_TO_COMPLEX
4. invoke JAI.create with dft as the target operation

Invoking dft directly doesn't help either (which is expected, as javadoc claims that it simply invokes JAI.create after performing come initializations)

If some of you had such problem and solved it (or simply knows what am I doing wrong) please help

Best regards
Maciek

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

An actual complete test case or failing that a code snippet would be helpful
here.

Brian

On Thu, 10 May 2007, jai-interest@javadesktop.org wrote:

> Hi !
>
> I encountered a strange (from my point of view) problem. I want to use DFT and IDFT operations in JAI to compute image autocorrelation, according to Wiener-Khinchin theorm. But after the dft operation image size is set to 0 width and zero height. It's not JAIs pull rendering model, because the image simply can't be rendered (an exception is thrown in one of JAI classes). I can't also use another operator after DFT, because I get exception with message that DataBuffer cannot be created.
>
> My code is fairly simple:
> 1. Load image using "fileload" operation
> 2. create parameter block
> 3. add scaling and data nature properties to parameter block
> I tried using different scaling properties, and I specified data nature as REAL_TO_COMPLEX
> 4. invoke JAI.create with dft as the target operation
>
>
> Invoking dft directly doesn't help either (which is expected, as javadoc claims that it simply invokes JAI.create after performing come initializations)
>
> If some of you had such problem and solved it (or simply knows what am I doing wrong) please help
>
> Best regards
> Maciek
> [Message sent by forum member 'mjazwinski' (mjazwinski)]
>
> http://forums.java.net/jive/thread.jspa?messageID=216391
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

mjazwinski
Offline
Joined: 2005-04-05

Sorry for late response, but I had to do some other stuff, and i would have sworn that there was no reply here on Wednesday :) (and certainly not 10-th of may) - I must have been very tired when I checked for some response

Here is the code for DFT filter. It is one of many filters that for filter chain.

[pre]
public class DFT implements ImageFilter {
public DFT() {
}

public PlanarImage performProcessing(PlanarImage image) {

ParameterBlock pb = new ParameterBlock();
pb.addSource(image);
pb.add(DFTDescriptor.SCALING_NONE).add(DFTDescriptor.REAL_TO_COMPLEX);
PlanarImage dftImage = JAI.create("DFT", pb);
// DFTDescriptor dft = new DFTDescriptor();
// PlanarImage dftImage = dft.create(image, DFTDescriptor.SCALING_DIMENSIONS, DFTDescriptor.REAL_TO_COMPLEX, new RenderingHints(new HashMap()));
return dftImage;
}

public void configure(Configuration c) {
}
}
[/pre]

Thank you for your response (it gives me hope :))

Maciek

Message was edited by: mjazwinski

bpb
Offline
Joined: 2004-06-23

I don't see any obvious problem.

> Sorry for late response, but I had to do some other
> stuff, and i would have sworn that there was no reply
> here on Wednesday :) (and certainly not 10-th of may)
> - I must have been very tired when I checked for some
> response
>
> Here is the code for DFT filter. It is one of many
> filters that for filter chain.
>
> [pre]
> public class DFT implements ImageFilter {
> public DFT() {
> }
>
> public PlanarImage performProcessing(PlanarImage
> image) {
>
> ParameterBlock pb = new ParameterBlock();
> pb.addSource(image);
>
> b.add(DFTDescriptor.SCALING_NONE).add(DFTDescriptor.RE
> AL_TO_COMPLEX);
> PlanarImage dftImage = JAI.create("DFT",
> pb);
> / DFTDescriptor dft = new DFTDescriptor();
> // PlanarImage dftImage = dft.create(image,
> DFTDescriptor.SCALING_DIMENSIONS,
> DFTDescriptor.REAL_TO_COMPLEX, new RenderingHints(new
> HashMap()));
> return dftImage;
>
> public void configure(Configuration c) {
> }
> }
> [/pre]
>
> Thank you for your response (it gives me hope :))
>
> Maciek
>
> Message was edited by: mjazwinski