Skip to content

Live camera filter with CIFilter in Objective-C

License

Notifications You must be signed in to change notification settings

quockhai/iCamera

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

-(void)setupCamera {
    self.camera = [KTCamera new];
    self.camera.delegate = self;
    self.camera.flashMode = AVCaptureFlashModeOff;
    [self.camera setupSessionWithCompletionHandler:^(NSError * _Nonnull error) {
        if (error != nil) {
            NSLog(@"Setup camera error: %@", error.localizedDescription);
            return;
        }
        
        [self.camera startRunning];
    }];
}

Add camera filter

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

Capture photo

[self.camera capturePhoto];

Delegate handle

-(void)camera:(KTCamera *)camera didOutputSampleImage:(CIImage *)ciImage {
    dispatch_async(dispatch_get_main_queue(), ^{
        //Using ciImage for preview
    });
}

-(void)camera:(KTCamera *)camera didCaptureImage:(UIImage *)image {
	//Handle capture photo (filtered image)
}

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.

Releases

No releases published

Packages

No packages published