Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
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!
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
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.
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.")