GPUImage - ChromaKeyBlendFilter - sourceImage

I have GPUImageStillCamera

in a level UIView

(where the animation takes place in real time) in which for GPUImagePicture

I pass sourceImage

using smoothlyScaleOutput:YES

forChromaKeyBlendFilter

The code works fine (very humble thanks to Brad Larson!) And I get the camera feed with the green pixels removed where shown sourceImage

.

What I want to do is pass sourceImage

in which would call the background transparent for the feed, i.e. I don't want to show sourceImage

in the background where green pixels are removed, but instead I want the pixel to be transparent.

Here's an image from my project: enter image description here Look at this blurry square area in the center, I want it to be transparent so that it shows the actual background image, which is absolutely clear. right now I am passing the background image separately to the filter and it shows a blurry image.

To achieve this, I tried to loop through the transparent PNG, but I got a black background color. What should I do to achieve what I am looking for? Please suggest .. Thank you!

+3


source to share


2 answers


If you read it right, you want to make the background GPUImageView

transparent. As mentioned here , you can do this by setting both of the following properties:



strengthPreviewImageView.backgroundColor = [UIColor clearColor];
[strengthPreviewImageView setBackgroundColorRed:0 green:0 blue:0 alpha:0];

      

+1


source


You can try it by setting the "thresholdSensitivity" filter with UISlider.



[(GPUImageChromaKeyBlendFilter *)filter setThresholdSensitivity:[(UISlider *)sender value]];

      

0


source







All Articles