Closed allenkiehl closed 5 years ago
I am using the method below to filter
greenscreenCamera = GPUImageStillCamera(sessionPreset: AVCaptureSession.Preset.photo, cameraPosition: .back)
filter = GPUImageChromaKeyBlendFilter() filter?.setColorToReplaceRed(0.0, green: 1.0, blue: 0.0) filter?.thresholdSensitivity = CGFloat(effectSlider) filter?.thresholdSensitivity = 0.40 filter?.smoothing = 0.14 gpuImage.fillMode = kGPUImageFillModePreserveAspectRatioAndFill
greenscreenCamera?.addTarget(filter) backgroundPicture!.addTarget(filter) filter?.addTarget(gpuImage) backgroundPicture!.processImage() greenscreenCamera?.startCapture()
@BradLarson any ideas?
I am using the GPUImageChromaKeyBlendFilter and getting undesired output. I either have my camera input correct, or my background image thats blending not both. I have a view size of 930, 620, and my background image is 1200x800 which scales to 930x620 while maintaining aspect ratio.
filter = GPUImageChromaKeyBlendFilter() filter?.setColorToReplaceRed(0.0, green: 1.0, blue: 0.0) filter?.thresholdSensitivity = CGFloat(effectSlider) filter?.thresholdSensitivity = 0.40 filter?.smoothing = 0.14
If I use the below the backround image shows correctly, however, the preview of the image is stretched, if I remove preview image is correct, but background is skewed. filter?.forceProcessing(at: overlayImage.frame.size) (the overlay is again 1200x800/930x620)
I am using kGPUImageFillModePreserveAspectRatioAndFill, any help would be appreciated.