项目作者: quockhai

项目描述 :
Live camera filter with CIFilter in Objective-C
高级语言: Objective-C
项目地址: git://github.com/quockhai/iCamera.git
创建时间: 2020-01-14T07:20:41Z
项目社区:https://github.com/quockhai/iCamera

开源协议:MIT License

下载


iCamera

Live camera filter with CIFilter in Objective-C


Platform: iOS 10+
Language: ObjC
License: MIT



Installation

Add KTCamera.h and KTCamera.m in your project.


Usage


Setup & Running camera session

  1. -(void)setupCamera {
  2. self.camera = [KTCamera new];
  3. self.camera.delegate = self;
  4. self.camera.flashMode = AVCaptureFlashModeOff;
  5. [self.camera setupSessionWithCompletionHandler:^(NSError * _Nonnull error) {
  6. if (error != nil) {
  7. NSLog(@"Setup camera error: %@", error.localizedDescription);
  8. return;
  9. }
  10. [self.camera startRunning];
  11. }];
  12. }


Add camera filter

  1. self.camera.filter = [CIFilter filterWithName:@"CIComicEffect"];


Capture photo

  1. [self.camera capturePhoto];


Delegate handle

  1. -(void)camera:(KTCamera *)camera didOutputSampleImage:(CIImage *)ciImage {
  2. dispatch_async(dispatch_get_main_queue(), ^{
  3. //Using ciImage for preview
  4. });
  5. }
  6. -(void)camera:(KTCamera *)camera didCaptureImage:(UIImage *)image {
  7. //Handle capture photo (filtered image)
  8. }


Contributing

As the creators, and maintainers of this project, we’re glad to invite contributors to help us stay up to date.

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.


License

KTCamera is available under the MIT license. See the LICENSE file for more info.