Skip to main content

Preserving negative values when subtracting images

3 replies [Last post]
deadpassive
Offline
Joined: 2009-02-05

Hi,

I've got two RenderedImages which I want to subtract. When I use the JAI Subtract operator it rounds up all negative values to 0. Is there any way of stopping this happening? I'm trying to carry out geospatial change detection and these negative values are vital!

Thanks,

Jon

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
deadpassive
Offline
Joined: 2009-02-05

Just out of curiosity, how would I use rendering hints to do this?

Cheers,

Jon

Bob Deen

What's the data type of the images? If they're byte, that's defined to
be unsigned in JAI. Try using the "format" operator to convert them to
short or int, both of which I believe are signed. You *might* be able
to use a rendering hint to attach an ImageLayout to the subtract
operator telling the output to be short or int... well I mean you
certainly can do that, but it may or may not have the desired effect.
It is easiest and fastest if it works, but if not, convert the inputs first.

Hope that helps...

-Bob

jai-interest@javadesktop.org wrote:
> Hi,
>
> I've got two RenderedImages which I want to subtract. When I use the JAI Subtract operator it rounds up all negative values to 0. Is there any way of stopping this happening? I'm trying to carry out geospatial change detection and these negative values are vital!
>
> Thanks,
>
> Jon
> [Message sent by forum member 'deadpassive' (man_kills_everything@hotmail.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=382358
>
> ---------------------------------------------------------------------
> 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

deadpassive
Offline
Joined: 2009-02-05

Thanks! Converting to int has solved my problem.

Jon