Skip to main content

Dilation

1 reply [Last post]
Huub
Offline
Joined: 2006-02-14

Hi,

I'm trying to dilate a jpg. By reading info I think I first have to use ColorConvert and Binarize before I can use Dilate. Problem is that I get this message:

operation "ColorConvert" requires 1 source object(s)

but I don't completely understand what I'm doing wrong.
This is part of the source I have so far:

ParameterBlock pb = new ParameterBlock();
pb.addSource(pi_src);
// Maak een gray-scale (single-banded) image
try
{
pi_sb = JAI.create("colorconvert", pb, kernel);
}
catch (IllegalArgumentException iae)
{
System.out.println("pi_sb = " + pi_sb);
iae.printStackTrace();
}
// Maak een binary image
try
{
pi_bin = JAI.create("binarize", pi_sb, kernel);
}
catch (IllegalArgumentException iae)
{
System.out.println("pi_bin = " + pi_bin);
iae.printStackTrace();
}
// Voer dilatie uit
try
{
pi_best = JAI.create("dilate", pi_bin, kernel);
}
catch (IllegalArgumentException iae)
{
iae.printStackTrace();
}

Is this code, apart from the error, ok the successfully dilate a jpg? Help is appreciated.

Thank you.

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

I think we dealt with this topic on interest@jai.dev.java.net. In any case, you need to specify a source object. The sources and parameters required for all operations are documented by the OperationDescriptor classes in the javax.media.jai.operator package.

Brian