BradLarson / GPUImage2

GPUImage 2 is a BSD-licensed Swift framework for GPU-accelerated video and image processing.
BSD 3-Clause "New" or "Revised" License
4.88k stars 611 forks source link

Normal Blend black outs base image #329

Open fazal-e-majid opened 3 years ago

fazal-e-majid commented 3 years ago

I've two images (given below) and I want to blend them using NormalBlend.

Background sBackground

Blend Image front

After applying Normal Blend like so:

var background = PictureInput(imageName: "sBackground.jpg")
var blendImage = PictureInput(imageName: "front.jpg")

var transformOperation = TransformOperation()
transformOperation.transform = Matrix4x4(getScaledCGAffineTransform( ) )

var normalBlend = NormalBlend()

background.addTarget(normalBlend, atTargetIndex: 0)

blendImage.addTarget(transformOperation)
transformOperation.addTarget(normalBlend, atTargetIndex: 1)

normalBlend.addTarget(renderView)

background.processImage()
blendImage.processImage()

I get this result : output

But this is not what I want and expect. Instead I want my result to be like this:

required

@BradLarson , @joshbernfeld if you could help me please. Thank you very much.