Jan Harnisch on wrote...
| > 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 \) \
|
Did you see my other mail where I explained the above line by line?
That line starts a new 'working image sequence' grabs a copy of all the
difference images, and combins them all using a 'Lighten' compose
so as to produce a image with the maximum difference between all the
images.
A 'null:' image is then added before that new image, before the working
sequnec eis finahs and the two images present are appended to the
previous working sequence.
At that point you have
saved sequence: the_original_images
working sequence: difference_images null: maximum_difference_image
the next line composes the maximum_difference_image against each of
the difference_images one image pair at a time, using -compose
ChangeMask.
That compose makes transparent ANY pixel with is different!
Producing a shaped mask of the just the pixels which were maximim in each
difference image.
That mask is then -layer composite in pairs with the original images
making any pixel in the original that was NOT the maximim difference
transparent.
Overlaying all those images together combines all the image into an
image containing only maximum difference pixels.
The -layers compose is tricky as it matchs up two sequneces of images
for example, if one image set containso only one image...
A B C D null: a
will be composed together in pairs to produce
Aa Ba Ca Da
While composing sequneces with multiple images will
A B C D null: a b c d
will be paired up and composed to produce...
Aa Bb Cc Dd
It is sort of like a shuffled composition....
But it allows you to compose image sets without having to know how many
images you are actually dealing with!!!!
OKAY.....
I have the test set of images...
Good set of images by the way....
Hmmm I have my first mistake... -compose ChangeMask
produces masking images of areas that are different!!!!
As such the masks it generated are of the parts that are NOT maximum
The solution is to use the mask in a negated sense. Change the next
compose from DstIn to DstOut. that is get the pixels that are NOT
masked. Or NOT the not-maximum or Maximum...
Second mistake.. I did not reset the compose method back to 'OVER'
for the final flattenn
The corrected result WORKED....
convert ??.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 DstOut -layers Composite \
-background None -compose Over -flatten \
depth_field_merge.png
I am getting a compined image of maximum difference from average.
However the flash is causing some images to 'flare' with reflections
making these areas more different than the desired 'infocus' image!!!
The threads of the screws for example is 'infocus'. But the rest of the
screew is the 'flare' of the unfocused flash.
Adding a -blur 0x3 just before -average helped But the result is still
a wash of flash colors and in-focus elements.
I think you need to get rid of a glary flash when taking the photos, and
use a more 'natural' or 'diffuse' light source, that will not overpower
the image, if you want to use this method.
Anthony Thyssen ( System Programmer ) <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
There can never be an `Absoulte Chaos',
since any absolute must be lawful,
I.E. It is lawful in its chaos.
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users