我想使用GPUImageView融合两个视频流。
除了一部分以外,此方法效果很好:输出是像素化的。
使用GPUImage在屏幕上直接显示裁剪位图时,它看起来没有任何像素化效果
以下是使用的代码:
let blurFilter = GPUImageGaussianSelectiveBlurFilter()
let backgroundBlendFilter = GPUImageNormalBlendFilter()
let circularMaskFilter = GPUImageMaskFilter()
let circularMask = GPUImagePicture(image: R.image.playback_crop_bitmap()!, smoothlyScaleOutput: false)!
let darkenFilter = GPUImageAlphaBlendFilter()
let transformFilter = GPUImageTransformFilter()
let view: GPUImageView
let darkenImage: GPUImagePicture
self.darkenImage = GPUImagePicture(cgImage: UIImage(color: UIColor.black, size: view.frame.size)!.cgImage, smoothlyScaleOutput: false)!
self.view = view
print("renderSize:\(view.frame.size)")
view.fillMode = kGPUImageFillModePreserveAspectRatioAndFill
transformFilter.affineTransform = CGAffineTransform(scaleX: 0.75, y: 0.75)
transformFilter.addTarget(backgroundBlendFilter, atTextureLocation: 0)
darkenImage.addTarget(darkenFilter)
darkenFilter.mix = 0.3
darkenImage.processImage()
darkenFilter.addTarget(blurFilter)
blurFilter.excludeCirclePoint = CGPoint(x: 0.5, y: 0.5)
blurFilter.excludeCircleRadius = 0.5 * 0.75
blurFilter.excludeBlurSize = 0
blurFilter.blurRadiusInPixels = 7
blurFilter.addTarget(circularMaskFilter)
circularMask.addTarget(circularMaskFilter)
circularMaskFilter.addTarget(backgroundBlendFilter, atTextureLocation: 1)
circularMask.processImage()
backgroundBlendFilter.addTarget(view)
let movie = assets.gpuImageMovie
movie.playAtActualSpeed = true
movie.addTarget(transformFilter)
movie.addTarget(darkenFilter)
movie.startProcessing()
该如何解决?