Difference Image with offset applied

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gregb
Posts: 1
Joined: 2014-12-12T03:44:07-07:00
Authentication code: 6789

Difference Image with offset applied

Post by gregb »

Hi,

I want to calculate Temporal noise between two black frames, stored as 16bit tiff files.
As far as I understand the instructions, difference results in absolute values.
So using this command will result in a difference image with absolute values:
composite frame1.tif frame2.tif -compose difference difference.tif

Of course, for SNR I don't want absolute values.

So I thought I can maybe shift the difference image to 50% luminance, to avoid negative values.
composite frame1.tif frame2.tif -compose difference -level 50%,-50% difference.tif

Anyhow stupid idea, as difference still results i absolute values.


So long story short:
Is there a way to calculate difference images without absolute values?

Thanks in advance for any informations.

Greg
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Difference Image with offset applied

Post by snibgo »

One possibility:

Code: Select all

convert A.png B.png -compose Mathematics -define compose:args=0,1,-1,0.5 -composite out.png
This gives out = B - A + 0.5. Hence the result is 50% where A and B are equal, or values above 50% where B>A, etc.

If A and B contain values between 0 and 100%, and are not similar, use 0,0.5,-0.5,0.5 to avoid clipping.

Or, if you use HDRI (floating-point), "-compose MinusDst" will give you positive or negative results.
snibgo's IM pages: im.snibgo.com
Post Reply