Skip to main content

[JAI] getting black border around SubsampleAveraged image

5 replies [Last post]
Anonymous

Hello,

I am applying a SubsampleAverageDescriptor onto an image and, depending on
the size of that image, I sometimes get a thin black border on two
neighboring edges of the image. I have tried using border extenders without
any results.

For example, if I subsample a 100x53 image with scale factors at 0.85 and
0.8490566... I get the black border.

Any suggestions?
Cheers!

Marc

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

Reply viewing options

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

Hi Marc,

Can you try to disable the native acceleration to see if the problem
will go away?

It could be similar to the problem mentioned in this thread:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0502&L=jai-interest&D=0&P=...

However I don't see this in the bug database. I appreciate if you can
log an issue at

https://jai-core.dev.java.net/servlets/ProjectIssues

Or, if you'd like to have me do so, could you please provide more info
like: platform, os, jdk version, jai version, and etc.

Thanks,
-James

On 06/30/05 02:44 PM, Marc Boscher wrote:
> Hello,
>
> I am applying a SubsampleAverageDescriptor onto an image and, depending on
> the size of that image, I sometimes get a thin black border on two
> neighboring edges of the image. I have tried using border extenders without
> any results.
>
> For example, if I subsample a 100x53 image with scale factors at 0.85 and
> 0.8490566... I get the black border.
>
> Any suggestions?
> Cheers!
>
> Marc

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

Marc Boscher

Posted as issue 24.

And yes, this problem goes away if using the pure java implementation.

Is there a way to disable native acceleration on a per-operation basis, such
as with a rendering hints?

Thanks

Marc

-----Original Message-----
From: James Cheng [mailto:James.Cheng@Sun.COM]
Sent: June 30, 2005 6:26 PM
To: interest@jai.dev.java.net
Subject: Re: [JAI] getting black border around SubsampleAveraged image

Hi Marc,

Can you try to disable the native acceleration to see if the problem
will go away?

It could be similar to the problem mentioned in this thread:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0502&L=jai-interest&D=0&P=...

However I don't see this in the bug database. I appreciate if you can
log an issue at

https://jai-core.dev.java.net/servlets/ProjectIssues

Or, if you'd like to have me do so, could you please provide more info
like: platform, os, jdk version, jai version, and etc.

Thanks,
-James

On 06/30/05 02:44 PM, Marc Boscher wrote:
> Hello,
>
> I am applying a SubsampleAverageDescriptor onto an image and, depending on
> the size of that image, I sometimes get a thin black border on two
> neighboring edges of the image. I have tried using border extenders
without
> any results.
>
> For example, if I subsample a 100x53 image with scale factors at 0.85 and
> 0.8490566... I get the black border.
>
> Any suggestions?
> Cheers!
>
> Marc

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

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

Brian Burkhalter

On Mon, 4 Jul 2005, Marc Boscher wrote:

> Posted as issue 24.

Thanks.

> And yes, this problem goes away if using the pure java implementation.
>
> Is there a way to disable native acceleration on a per-operation basis, such
> as with a rendering hints?

You can change the order of preference of the RenderedImageFactory associated
with the operation. Please see the attached sample code.

Brian

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[SetPreferredRIF.java]
---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Marc Boscher

Excellent!

Now, is there a noticeable performance difference between the native and
pure java implementation of SubsampleAveraged?

Thanks

Marc

-----Original Message-----
From: Brian Burkhalter [mailto:Brian.Burkhalter@Sun.COM]
Sent: July 11, 2005 7:25 PM
To: interest@jai.dev.java.net
Subject: RE: [JAI] getting black border around SubsampleAveraged image

On Mon, 4 Jul 2005, Marc Boscher wrote:

> Posted as issue 24.

Thanks.

> And yes, this problem goes away if using the pure java implementation.
>
> Is there a way to disable native acceleration on a per-operation basis,
such
> as with a rendering hints?

You can change the order of preference of the RenderedImageFactory
associated
with the operation. Please see the attached sample code.

Brian

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
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

James Cheng

> Now, is there a noticeable performance difference between the native and
> pure java implementation of SubsampleAveraged?

It depends on multiple factors: platform, data type, image size, scale
factor, how it is used, and etc. Generally speaking, for small images,
simple operations, and simple chain of operations, using the pure Java
implementation may give you better performance. Loading the native
library takes about a couple of hundred milliseconds, but this is a
one-time overhead for an invocation of JVM. Calling a native function
may or may not cause extra overhead on data copying or reformatting,
but if it does, it may hurt performance for small images and simple
operations.

SubsampleAveraged is a relatively simple operation in terms of
computation complexity. If your chain of operation is also simple,
say load an image, scale it down with SubsampleAveraged, and store the
resulting image, then you'd probably better off using the pure Java
implementation. On the other hand, if it is just one node in a complex
chain of operations, and some other operations in the chain have better
performance with the native implementation, it might be good to use the
native implementation for SubsampleAveraged. After all, you might have
to do some experiment in your specific case.

HTH,
-James

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