作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 GPUImageChromaKeyBlendFilter
并得到不需要的输出。我要么让我的相机输入正确,要么我的背景图像混合在一起。我有一个尺寸为 930x620 的 View ,我的背景图像为 1200x800,可在保持宽高比的同时缩放至 930x620。
filter = GPUImageChromaKeyBlendFilter()
filter?.setColorToReplaceRed(0.0, green: 1.0, blue: 0.0)
filter?.thresholdSensitivity = CGFloat(effectSlider)
filter?.thresholdSensitivity = 0.40
filter?.smoothing = 0.14
如果我使用下面的背景图像正确显示,但是,图像的预览被拉伸(stretch),如果我删除预览图像是正确的,但背景是倾斜的。
filter?.forceProcessing(at: overlayImage.frame.size) (the overlay is again 1200x800/930x620)
我正在使用 kGPUImageFillModePreserveAspectRatioAndFill
。
最佳答案
func chromaKeyBlendOneVideoWithTexture() {
// background texture
let textureImage = UIImage(named: "texture.jpg")!
let sourceImage = PictureInput(image: textureImage)
sourceImage.processImage()
do {
let movieUrl = Bundle.main.url(forResource: "video", withExtension: "mp4")!
let movieInput = try MovieInput(url: movieUrl, playAtActualSpeed: true)
let chromaKeyBlendFilter = ChromaKeyBlend()
// first add green channel video than background texture.
movieInput --> chromaKeyBlendFilter --> renderView
sourceImage --> chromaKeyBlendFilter
movieInput.start()
} catch {
print("Couldn't process movie with error: \(error)")
}
}
关于ios - GPUImage ChromaKeyBlendFilter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54791119/
我正在使用 GPUImageChromaKeyBlendFilter 并得到不需要的输出。我要么让我的相机输入正确,要么我的背景图像混合在一起。我有一个尺寸为 930x620 的 View ,我的背景
我有一个 GPUImageStillCamera 层叠在 UIView 上(一些实时动画正在发生),其中对于 GPUImagePicture 我传递了 sourceImage 和 smoothlySc
我是一名优秀的程序员,十分优秀!