Re: Merging images? Roepcke asks [message #6506] |
Wed, 10 July 1996 00:00 |
hahn
Messages: 108 Registered: November 1993
|
Senior Member |
|
|
panther@jungle.toppoint.de (Hendrik S. Roepcke) wrote:
> Hello,
> i have two images with 256 colors (in rgb-code eg).
> no I want wo merge this two images...
> a) pixel1+pixel2 / 2 is working, but not fine...
This works basically. However, you didn't specify what is
distracting. I can imagine that simply taking the average
on the red, green and blue parts is not the best idea.
Maybe you calculate brightness and the color by transforming
your data from rgb to the hsi or hsv colour system. IDL
has transformation procedures for that so you don't have to
look up the formulas. Now you can average the intensity (brightness)
and the contrast while averaging the hue doesn't make much sense
to me: What is the average between green and blue?? Cyan, as the
formula would give ???
> how about the brightness?
> In addition to that I want to fade both images in an
> interactive way with sliders and then finally choose
> an setting for saving.
Fading between both images is done easily. For a linear fade
over 10 images need an array running from 0.0 to 1.0 in 10
steps and another array running from 1.0 to 0.0 accordingly.
Thus:
factor1 = findgen(10)/9.0
With picture a stored in pic_a and picture b stored in pic_b you can
calculate the intermediate frame pic_i by
color_convert, pic_a_r, pic_a_g, pic_a_b, pic_a_h, pic_a_s, pic_a_v, /rgb_hsv
color_convert, pic_b_r, pic_b_g, pic_b_b, pic_b_h, pic_b_s, pic_b_v, /rgb_hsv
fi1 = factor1(i) & fi2 = 1.0 - fi1
pic_i_v = BYTE ( ( pic_a_v*fi1 + pic_b_v*fi2 ) /2.0 )
pic_i_s = BYTE ( ( pic_a_s*fi1 + pic_b_s*fi2 ) /2.0 )
and maybe the same for hue...
> Are there any fast algorithms doing this?
Avoid any loops. IDL works on the whole matrix of intensities in one statement.
Call color_convert before you enter the loop for the intermediate picture i.
> any hint needed!
Hope this helps...
> Hendrik
>
> --
> Panther in the Jungle __..--''``\--....___ _..,_
> -BELIEVE AND DECEIVE- _.-' .-/"; ` ``<._ ``-+'~=.
> http://www.ang-physik _.-' _..--.'_ \ `(^) )
> .uni-kiel.de/~hendrik ((..-' (< _ ;_..__ ; `'
Norbert Hahn
TH Darmstadt
|
|
|