带有绿屏或抠像的avassetwriter [英] avassetwriter with greenscreen or chromakey

查看:131
本文介绍了带有绿屏或抠像的avassetwriter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以合成绿色屏幕图像(绿色背景下的动画演员)和背景图片,并使用iPhone上的avassetwriter制作视频片段.

我有一个应用程序,可以在绿色背景下创建一系列动画角色的屏幕截图.我想用他们图书馆的照片来合成这些照片.

是否可以通过某种方式将两者合并为iPhone上的视频?

谢谢

解决方案

是的.我刚刚在我的 GPUImage 框架中添加了一个色度键过滤器,该过滤器应该可以让您从相机上进行实时绿屏效果,图片或电影来源.您只需要使用GPUImageChromaKeyBlendFilter,在第一个图像或视频源中设置要替换的颜色,设置灵敏度阈值,还可以选择设置平滑度以用于与目标不完全匹配的颜色.

它的作用类似于框架中的其他混合滤镜,在该滤镜中,您提供要过滤的视频源作为过滤器的第一个输入,而将图像或视频替换为目标颜色的第二个输入.

我尚未针对此特定滤镜进行性能调整,但您应该能够轻松地在较旧的iPhone 4上以640x480帧的速度获得30 FPS处理(720p约为15-20 FPS).

Is it possible to composite green screen images -- an animated actor against a green background, with a backdrop photo and make a video of that using avassetwriter on the iPhone.

I have an application that creates a sequence of screenshots of an animated character against a green background. I'd like to composite those with a photograph from their library.

Is there some way to composite the two into a video on the iPhone?

Thanks,

解决方案

Yes, there is. I just added a chroma key filter to my GPUImage framework, which should let you do realtime green screen effects from camera, image, or movie sources. You just need to use a GPUImageChromaKeyBlendFilter, set the color you want to replace in the first image or video source, set the sensitivity threshold, and optionally set the amount of smoothing to use on colors that are not quite matches of your target.

It acts like the other blend filters in the framework, where you supply the video source to filter as the first input to the filter, and the image or video to replace you target color with as the second input.

I haven't yet tuned this particular filter for performance, but you should easily be able to get 30 FPS processing for 640x480 frames on an older iPhone 4 (~15-20 FPS for 720p).

这篇关于带有绿屏或抠像的avassetwriter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆