Mean image subtraction

View: New views
2 Messages — Rating Filter:   Alert me  

Mean image subtraction

by Muqeet Khan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have created a mean image out of all the images in a series. Now i would like to subtract the mean image from the actual original image. I do it something like this

       int origSize = targetImage.getWidth() * targetImage.getHeight();
       int subSize = meanImage.getWidth() * meanImage.getHeight();

        for (int x = 0; x < meanImage.getWidth(); x++) {
                 
                for(int y = 0; y < meanImage.getHeight(); y++) {
                        int subPix  = meanImage.get(x, y);
                        int origPix = targetImage.get(x, y);
                        double newPix = origPix - subPix;

                        targetImage.set(x, y, (int) Math.round(newPix));
                }
        }


I don't see the proper effect on the canvas when i apply this? its completely blacked out. Any ideas?

Parent Message unknown Re: Mean image subtraction

by Jarek Sacha-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The simplest way to subtract images is like this:

        targetImage.copyBits(meanImage, 0, 0, Blitter.SUBTRACT);

Make sure that you images are FloatProcessor, otherwise you will have problems with negative values.

You do not show code that you use for display, so it is hard to say why you have problem there.

Jarek

You wrote:

I have created a mean image out of all the images in a series. Now i would

>like to subtract the mean image from the actual original image. I do it
>something like this
>
>       int origSize = targetImage.getWidth() * targetImage.getHeight();
>       int subSize = meanImage.getWidth() * meanImage.getHeight();
>
> for (int x = 0; x < meanImage.getWidth(); x++) {
>
> for(int y = 0; y < meanImage.getHeight(); y++) {
> int subPix  = meanImage.get(x, y);
> int origPix = targetImage.get(x, y);
> double newPix = origPix - subPix;
>
> targetImage.set(x, y, (int) Math.round(newPix));
> }
> }
>
>
>I don't see the proper effect on the canvas when i apply this? its
>completely blacked out. Any ideas?

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ij-plugins-users mailing list
Ij-plugins-users@...
https://lists.sourceforge.net/lists/listinfo/ij-plugins-users