CameraEngine: The most advanced Camera framework in Swift

Related tags

Image CameraEngine
Overview

CameraEngine

CI Status Version License Platform

THIS REPOSITORY REFACTORED FROM ( https://github.com/remirobert/CameraEngine ) Speacial thanks for Remi ROBERT

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

CameraEngine is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'CameraEngine'

Author

Remi ROBERT, winlentia

License

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

Original Repository ReadMe.md

cameraenginelogo

🌟 The most advanced Camera framework in Swift 🌟

License MIT  Carthage compatible  CocoaPods  Build Status CocoaPods  Support  codebeat badge  Donate

CameraEngine is an iOS camera engine library that allows easy integration of special capture features and camera customization in your iOS app.

πŸ”₯ Features

CameraEngine
☺️ Support iOS8 - iOS9
πŸ“ Support orientation device
🏁 Fast capture
πŸ“· Photo capture
πŸŽ₯ Video capture
πŸ“ˆ quality settings presset video / photo capture
πŸ™‹ switch device (front, back)
πŸ’‘ flash mode management
πŸ”¦ torch mode management
πŸ”Ž focus mode management
:bowtie: detection face, barecode, and qrcode
πŸš€ GIF encoder

πŸ”¨ Installation

CocoaPods

  • Add pod "CameraEngine" to your Podfile.
  • Run pod install or pod update.
  • import CameraEngine

Carthage

  • Add github "remirobert/CameraEngine" to your Cartfile.
  • Run carthage update and add the framework to your project.
  • import CameraEngine

Manually

  • Download all the files in the CameraEngine subdirectory.
  • Add the source files to your Xcode project.
  • import CameraEngine

To add the Framework, you can also create a workspace for your project, then add the CameraEngine.xcodeproj, and the CameraEngine, then you should be able to compile the framework, and import it in your app project.

CameraEngine supports swift3, see the development branch for a swift 3 integration.

πŸš€ Quick start

First let's init and start the camera session. You can call that in viewDidLoad, or in appDelegate.

override func viewDidLoad() {
  super.viewDidLoad()
  self.cameraEngine.startSession()
}

Next time to display the preview layer

override func viewDidLayoutSubviews() {
  let layer = self.cameraEngine.previewLayer
        
  layer.frame = self.view.bounds
  self.view.layer.insertSublayer(layer, atIndex: 0)
  self.view.layer.masksToBounds = true
}

Capture a photo

self.cameraEngine.capturePhoto { (image: UIImage?, error: NSError?) -> (Void) in
  //get the picture tooked in the πŸ‘‰ image
}

Capture a video

private func startRecording() {
  guard let url = CameraEngineFileManager.documentPath("video.mp4") else {
    return
  }
            
  self.cameraEngine.startRecordingVideo(url, blockCompletion: { (url, error) -> (Void) in
  })
}

private func stopRecording() {
  self.cameraEngine.stopRecordingVideo()
}

Generate animated image GIF

guard let url = CameraEngineFileManager.documentPath("animated.gif") else {
  return
}
self.cameraEngine.createGif(url, frames: self.frames, delayTime: 0.1, completionGif: { (success, url) -> (Void) in
  //Do some crazy stuff here
})

πŸ”§ configurations

CameraEngine, allows you to set some parameters, such as management of flash, torch and focus. But also on the quality of the media, which also has an impact on the size of the output file.

Flash

self.cameraEngine.flashMode = .On
self.cameraEngine.flashMode = .Off
self.cameraEngine.flashMode = .Auto

Torch

self.cameraEngine.torchMode = .On
self.cameraEngine.torchMode = .Off
self.cameraEngine.torchMode = .Auto

Focus

          |  CameraEngine focus

--------------------------|------------------------------------------------------------ .Locked | means the lens is at a fixed position .AutoFocus | means setting this will cause the camera to focus once automatically, and then return back to Locked .ContinuousAutoFocus | means the camera will automatically refocus on the center of the frame when the scene changes

self.cameraEngine.cameraFocus = .Locked
self.cameraEngine.cameraFocus = .AutoFocus
self.cameraEngine.cameraFocus = .ContinuousAutoFocus

Camera presset Photo

self.cameraEngine.sessionPresset = .Low
self.cameraEngine.sessionPresset = .Medium
self.cameraEngine.sessionPresset = .High
...

Camera presset Video

self.cameraEngine.videoEncoderPresset = .Preset640x480
self.cameraEngine.videoEncoderPresset = .Preset960x540
self.cameraEngine.videoEncoderPresset = .Preset1280x720
self.cameraEngine.videoEncoderPresset = .Preset1920x1080
self.cameraEngine.videoEncoderPresset = .Preset3840x2160

πŸ‘€ Object detection

CameraEngine can detect faces, QRcodes, or barcode. It will return all metadata on each frame, when it detects something. To exploit you whenever you want later.

Set the detection mode

self.cameraEngine.metadataDetection = .Face
self.cameraEngine.metadataDetection = .QRCode
self.cameraEngine.metadataDetection = .BareCode
self.cameraEngine.metadataDetection = .None //disable the detection

exploiting face detection

self.cameraEngine.blockCompletionFaceDetection = { faceObject in
  let frameFace = (faceObject as AVMetadataObject).bounds
  self.displayLayerDetection(frame: frameFace)
}

exploiting code detection (barecode and QRCode)

self.cameraEngine.blockCompletionCodeDetection = { codeObject in
  let valueCode = codeObject.stringValue
  let frameCode = (codeObject as AVMetadataObject).bounds
  self.displayLayerDetection(frame: frameCode)
}

πŸš— πŸ’¨ Example

You will find a sample project, which implements all the features of CameraEngine, with an interface that allows you to test and play with the settings. To run the example projet, run pod install, because it uses the current prod version of CameraEngine.

Contributors 🍻

License

This project is licensed under the terms of the MIT license. See the LICENSE file.

This project is in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs.

If you want to support the development of this library, feel free to Donate. Thanks to all contributors so far!

bannabot

You might also like...
A free, multiplatform SDK for real-time facial motion capture using blendshapes, and rigid head pose in 3D space from any RGB camera, photo, or video.
A free, multiplatform SDK for real-time facial motion capture using blendshapes, and rigid head pose in 3D space from any RGB camera, photo, or video.

mocap4face by Facemoji mocap4face by Facemoji is a free, multiplatform SDK for real-time facial motion capture based on Facial Action Coding System or

Custom iOS camera and photo picker with editing capabilities
Custom iOS camera and photo picker with editing capabilities

Overview Paparazzo is a component for picking and editing photos. Key Features πŸ“· Taking photos using camera πŸ“± Picking photos from user's photo libra

ImagePicker : an all-in-one camera solution for your iOS app
ImagePicker : an all-in-one camera solution for your iOS app

Description ImagePicker is an all-in-one camera solution for your iOS app. It lets your users select images from the library and take pictures at the

The camera shoot a photo when animals apear in the frame
The camera shoot a photo when animals apear in the frame

AutoCatDogCam The camera shoot a photo when animals apear in the frame. How to u

Metazoom - A virtual camera plugin to pixellatedly share your screen

MetaZoom A virtual camera plugin to pixellatedly share your screen. See LICENSE.

CameraButton - A simple camera button that can be used for photo and video capturing
CameraButton - A simple camera button that can be used for photo and video capturing

CameraButton A simple camera button that can be used for photo and video capturi

ImagePicker - selecting images from the photo albums, with allowed permissions /on real device accesing the camera
ImagePicker - selecting images from the photo albums, with allowed permissions /on real device accesing the camera

ImagePicker - selecting images from the photo albums, with allowed permissions /on real device accesing the camera, permission also needed/after picking an image it has the possibility to rename it

Reconstruct a 3D face with RGB-D images captured by iPhone X's TrueDepth camera.
Reconstruct a 3D face with RGB-D images captured by iPhone X's TrueDepth camera.

!TrueDepth camera can only be accessed on iPhone X or later. TODO Get the RGB-D files (This repository) Generate 3D face mesh with landmark detector a

FlaneurImagePicker is an iOS image picker that allows users to pick images from different sources (ex: user's library, user's camera, Instagram...).                            It's highly customizable.
FlaneurImagePicker is an iOS image picker that allows users to pick images from different sources (ex: user's library, user's camera, Instagram...). It's highly customizable.

FlaneurImagePicker is a highly customizable iOS image picker that allows users to pick images from different sources (ex: device's library, device's c

Owner
Mertcan Bulut
Mertcan Bulut
Advanced framework for loading, caching, processing, displaying and preheating images.

Advanced framework for loading, caching, processing, displaying and preheating images. This framework is no longer maintained. Programming in Swift? C

Alexander Grebenyuk 1.2k Dec 23, 2022
Fetches the most dominant and prominent colors from an image.

UIImageColors iTunes style color fetcher for UIImage and NSImage. It fetches the most dominant and prominent colors. Installation Manual Copy UIImageC

null 3.2k Jan 1, 2023
Swifttty and easy camera framework for iOS.

SwiftttCamera Swifttty and easy camera framework for iOS. View Demo Β· Report Bug Β· Request Feature SwiftttCamera is a wrapper around AVFoundation that

Roger Oba 13 Sep 14, 2022
Instant camera hybrid with multiple effects and filters written in Swift.

Kontax Cam Download on the app store! No longer on the app store Kontax Cam is an instant camera built 100% using Swift for iOS. You can take your pho

Kevin Laminto 108 Dec 27, 2022
FlexibleImage is implemented with the hope that anyone could easily develop an app that provides features such as Camera Filter and Theme.

FlexibleImage is implemented with the hope that anyone could easily develop an app that provides features such as Camera Filter and Theme. When you wr

Jungwon An 815 Dec 30, 2022
Kanvas is an open-source iOS library for adding effects, drawings, text, stickers, and making GIFs from existing media or the camera.

Kanvas Kanvas is an open-source iOS library for adding effects, drawings, text, stickers, and making GIFs from existing media or the camera.

Tumblr 267 Nov 24, 2022
Extract opening hours tags from a camera image

OpeningHoursPhoto Extract opening hours tags from a camera image This project is no longer active. The latest development is taking part as part of Go

null 10 May 3, 2021
πŸ“Έ A wrapper for AVCaptureSession - The way easier to use the Camera.

Capturer A wrapper for AVCaptureSession - The way easier to use the Camera. Setting up let captureBody = CaptureBody( configuration: .init { $0.

Muukii 11 Jul 13, 2022
Simple camera application for iOS that uploads pictures to WebDAV server or Dropbox quickly. Available on the AppStore.

Upupu Simple camera application for iOS that uploads pictures to WebDAV server or Dropbox quickly. Also available on the AppStore. Features Easy and f

Xcoo 65 Nov 15, 2022
AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, best suited for authenticating users over the internet.

AnylineFaceAuthentication AnylineFaceAuthentication pairs identity document scanning with a real-time liveness check utilizing the iPhone's camera, be

null 0 Mar 7, 2022