BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.24k stars 4.61k forks source link

GPUImageChromaKeyFilter does not work in GPUImageView with UIImage #2541

Open goldenmobile028 opened 6 years ago

goldenmobile028 commented 6 years ago

Hi Brad.

I am using chromakey filter in GPUImageView and it's not working.

stillImageSource = [[GPUImagePicture alloc] initWithImage:image]; chromakeyImageFilter = [[GPUImageChromaKeyFilter alloc] init]; [chromakeyImageFilter setColorToReplaceRed:0.0 green:1.0 blue:0.0]; [chromakeyImageFilter setThresholdSensitivity:0.4];

[stillImageSource addTarget:chromakeyImageFilter]; [chromakeyImageFilter addTarget:foregroundImageView];

[chromakeyImageFilter useNextFrameForImageCapture]; [stillImageSource processImage];

Other filters is working well. Please help me.

BradLarson commented 6 years ago

Not working how? Without specifying how it is failing, we can't help you.

goldenmobile028 commented 6 years ago

Hi Brad. Thanks for your response. I wrote the code to remove the green color background from the UIImage and show it within foregroundImageView(GPUImageView).

When I replace the 'GPUImageChromaKeyFilter' to 'GPUImageGrayscaleFilter' or any others, the filtering was worked, but ChromaKey filter is not working.

So I used other way(I think this is not good). I generated new image using 'imageFromCurrentFramebuffer' and wrote this to file with png format. And then open this file again.

Now this is working.

Thank you GPUImage.