Hi Anthony and Fred,

thanks to both of you for your extensive responses.

 > | Jan,
 > |
 > | You can use -compose difference to get the absolute difference
 > | between two image.
 > |
 > | Then you can use -compose lighten to get the lighter (max) of two
 > | images and you can do that in succession to get the lighter of a
 > | sequence of images.
 > |
 > | So try this as I think it functionally does what you are trying to 
do with -fx:
 > |
 > | convert image1 image2 image3 ... imageN -average averageimage
 > | convert \( image1 averageimage -compose difference  -composite \) \
 > |    \( image2 averageimage -compose difference -composite \)
 > | -compose lighten -composite \
 > |    \( image3 averageimage -compose difference -composite \)
 > | -compose lighten -composite \
 > |    .
 > |    .
 > |    .
 > |    \( imageN averageimage -compose difference -composite \)
 > | -compose lighten -composite \
 > |    resultimage
 > |
 > | Where resultimage should have at each pixel, the furthest absolute
 > | value from the mean from all the images.

That is not entirely it. In a further step, I would now need to compare 
resultimage to the single differences to averageimage (i.e. the results 
of each of the above bracketed expressions) to see which pixel in which 
image has this furthest absolute value. These are the pixels I need to 
copy out of my respective source image into the final result.
In separate steps, this would be something like

convert image1 averageimage -compose difference -composite singledifference
# create a mask for image1 where the pixels that are desired for the 
final result are transparent
convert singledifference resultimage -compose difference -transparent 
black -composite singlemask
# now create an image that only consists of the desired pixels
composite -compose dst-out singlemask image1 part1OfFinal
# ... and repeat this for image2 to imageN


 >
 >
 > My corrected version (for any number of images, in one command)
 > from my own response is thus...
 >
 >    convert image?.png \
 >            \( -clone 0--1 -average \
 >               null: -clone 0--1 -compose Difference -layers Composite \
 >               -colorspace Gray \
 >               \( -clone 0--1  -background Black -compose Lighten 
-flatten \
 >                  null: +insert  \) \
 >               -alpha Set -compose ChangeMask -layers Composite \
 >               null: +insert \) \
 >             -alpha set -compose DstIn -layers Composite \
 >             -background None  -flatten  depth_field_merge.png
 >
 >
 > Of course I can NOT properly test this without some example images.

In the meantime I have created an image sequence which I will mail to 
you shortly.
Unfortunately, your command does not quite seem to work here, and I 
obviously lack the understanding of what is going on. I think I can 
follow your example until here:

       \( -clone 0--1  -background Black -compose Lighten -flatten \
          null: +insert  \) \

and from this point on I have no idea of, for example, where the output 
of -clone is going, or what null: is doing here. Maybe I need to sleep 
for some hours and take a look at this afterwards again...
Good night, and thanks again for your effort,

Jan

PS: Apologies if once again it should happen that this mail does not 
properly appear within the thread, but as a new post. This is just 
another one of the vast number of things that I still do not understand...
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to