赞
踩
如果你是第一次看到这篇博客请看http://blog.csdn.net/xoxo_x/article/details/52695032
如果app需求仅仅是自己得到美颜的效果, 请看这里http://blog.csdn.net/xoxo_x/article/details/52743107
如果想了解更多的滤镜使用方法,请看这里http://blog.csdn.net/xoxo_x/article/details/52749033
接下来咱们要做的工作是如何对 CMSampleBufferRef 数据进行渲染、然后显示 美颜效果
一、通过AVCaptureVideoDataOutputSampleBufferDelegate获取视频流:
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "ViewController.h"
#import <AVFoundation/AVFoundation.h>
@interface ViewController ()<AVCaptureVideoDataOutputSampleBufferDelegate>
@property (nonatomic, strong) AVCaptureVideoPreviewLayer *preLayer;
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
[self setupCaptureSession];
}
//捕获到视频的回调函数
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
{
}
//开启摄像头
- (void)setupCaptureSession
{
NSError *error = nil;
// 创建session
AVCaptureSession *session = [[AVCaptureSession alloc] init];
// 可以配置session以产生解析度较低的视

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。