Hello this is a short question regarding pixelcalculation in c/c++.
darkpic.composite(brightpic,0,0,MinusCompositeOp);
As you can see, I use the MinusCompositeOp operation, but tried also DifferenceOp and SubtractOp.
Usually it works but some pixels are calculated wrong.
Image A (value 2038) - Image B (value 2004) should be value 34!
But in the resulting Image there is the wrong value 65525. Bug?
Both images are 16-bit tif and I work with Windows Vista(64).
By the way...is there a possibility to avoid updating the current image (darkpic) but the other (brightpic)?.
Thank you in advance.
Subtract images - Bug or incompetence
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Subtract images - Bug or incompetence
Wouldn't this work?By the way...is there a possibility to avoid updating the current image (darkpic) but the other (brightpic)?.
Code: Select all
brightpic.composite(darkpic,0,0,MinusCompositeOp);
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Subtract images - Bug or incompetence
As hinted by el_supremo, you probably have the images the wrong way around.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Subtract images - Bug or incompetence
Thank you for your replies.
My intention is to subtract a dark picture from a bright one (same object) due to remove the "dark-current" artefacts.
If I change the way of subtraction then the result is a complete dark picture.
Because dark picture - bright picture = dark picture (overflow cropped to zero).
Am I wrong with my assumption?
My intention is to subtract a dark picture from a bright one (same object) due to remove the "dark-current" artefacts.
If I change the way of subtraction then the result is a complete dark picture.
Because dark picture - bright picture = dark picture (overflow cropped to zero).
Am I wrong with my assumption?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Subtract images - Bug or incompetence
You are wrong in your ordering.
You were subtracting the bright picture from the dark picture.
"Subtract" is a 'modulus' subtraction. If you used minus, you would have gotten all zeros.
Look at http://www.imagemagick.org/Usage/compose/tables/
and especially the gradient compose test results at the bottom.
I just updated this to include the Add and Subtract modulus compositions, which will appear in a day or so.
You were subtracting the bright picture from the dark picture.
"Subtract" is a 'modulus' subtraction. If you used minus, you would have gotten all zeros.
Look at http://www.imagemagick.org/Usage/compose/tables/
and especially the gradient compose test results at the bottom.
I just updated this to include the Add and Subtract modulus compositions, which will appear in a day or so.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/