comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » cgBlendImage, more than 2 images?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
cgBlendImage, more than 2 images? [message #90716] Thu, 02 April 2015 07:25 Go to next message
sam.tushaus is currently offline  sam.tushaus
Messages: 14
Registered: February 2015
Junior Member
Hello! I was wondering if anyone had tried using cgBlendImage to blend more than 2 images. I have 4 images - I've tried blending 2 of the images, blending the other 2, and blending those together, but I've had no luck thus far. Has anyone tried this? Should I simply stick with two separate blended images instead?

Thanks!
Re: cgBlendImage, more than 2 images? [message #90717 is a reply to message #90716] Thu, 02 April 2015 09:40 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/2/15 8:25 AM, sam.tushaus@gmail.com wrote:
> Hello! I was wondering if anyone had tried using cgBlendImage to
> blend more than 2 images. I have 4 images - I've tried blending 2 of
> the images, blending the other 2, and blending those together, but
> I've had no luck thus far. Has anyone tried this? Should I simply
> stick with two separate blended images instead?

I don't know the details of cgBlendImage, but if you want to blend four
images like:

I = a * I1 + b * I2 + c * I3 + d * I4

where a + b + c + d = 1, then you should blend the first two images
together to get I12:

I12 = a / (a + b) * I1 + b / (a + b) I2

Blend images 3 and 4 to get I34:

I34 = c / (c + d) * I3 + d / (c + d) I4

Then blend the I12 and I34 to get the result:

I = (a + b) / (a + b + c + d) * I12 + (c + d) / (a + b + c + d) * I34

Is that what you are doing?

-Mike
Re: cgBlendImage, more than 2 images? [message #90718 is a reply to message #90717] Thu, 02 April 2015 10:11 Go to previous messageGo to next message
sam.tushaus is currently offline  sam.tushaus
Messages: 14
Registered: February 2015
Junior Member
On Thursday, April 2, 2015 at 11:40:39 AM UTC-5, Mike Galloy wrote:
> On 4/2/15 8:25 AM, wrote:
>> Hello! I was wondering if anyone had tried using cgBlendImage to
>> blend more than 2 images. I have 4 images - I've tried blending 2 of
>> the images, blending the other 2, and blending those together, but
>> I've had no luck thus far. Has anyone tried this? Should I simply
>> stick with two separate blended images instead?
>
> I don't know the details of cgBlendImage, but if you want to blend four
> images like:
>
> I = a * I1 + b * I2 + c * I3 + d * I4
>
> where a + b + c + d = 1, then you should blend the first two images
> together to get I12:
>
> I12 = a / (a + b) * I1 + b / (a + b) I2
>
> Blend images 3 and 4 to get I34:
>
> I34 = c / (c + d) * I3 + d / (c + d) I4
>
> Then blend the I12 and I34 to get the result:
>
> I = (a + b) / (a + b + c + d) * I12 + (c + d) / (a + b + c + d) * I34
>
> Is that what you are doing?
>
> -Mike

Yes! That's what I was trying to do. I'm not sure where you're getting a, b, c, and d though - I'm not weighting each image by anything. I don't think it's necessary, from the documentation.
Re: cgBlendImage, more than 2 images? [message #90719 is a reply to message #90718] Thu, 02 April 2015 17:02 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
sam.tushaus@gmail.com writes:

> Yes! That's what I was trying to do. I'm not sure where you're getting a, b, c, and d though - I'm not weighting each image by anything. I don't think it's necessary, from the documentation.

It's necessary. The values a, b, c, and d are numbers that sum to 1.0. I
would do this the way Mike advices.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Rebin or interpolate to resample data
Next Topic: OPENR F77 SWAP_IF_LITTLE_ENDIAN

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:17:13 PDT 2025

Total time taken to generate the page: 0.00605 seconds