FMStickerCaptureView Class Reference
| Inherits from | UIView |
| Conforms to | AVCaptureVideoDataOutputSampleBufferDelegate |
| Declared in | FMStickerCaptureView.h |
Overview
FMStickerCaptureView is a subclass of UIView used to display the video feed coming from the camera of iPhone and iPad and overlay images that use points generated by the Face Detection API available from iOS 5 onwards. It can be setup both in Interface Builder or programmatically in code and the video is automatically scaled to fit the view.
The view is initialised by the startCapture method. Face Detection can be paused and resumed programmatically with pauseFaceDetection and resumeFaceDetection methods.
There are also two convenience methods to handle the camera. Calling switchCamera: will perform a transition between the front and back facing camera. The shutter button should call the takePicture: method which on completion returns the final UIImage with the sticker attached or a NSError if something went wrong.
Images applied to the preview and the final picture should be set on the sticker property.
Tasks
Public properties
-
stickerThe FMSticker object currently used.
property -
showFlashA flag to activate a flash-like effect on the preview view.
property -
numberOfStickerDetectedThe number of stickers currently detected
property -
accessoryViewA view positioned between the previewLayer and the stickers.
property
Initializing a capture session
-
+ setLicense:Sets the license string for the authorised bundle ID.
-
+ licenseReturns the current license string
-
– startCaptureStarts the capture session and initialise all the required components.
Manage face detection
-
– pauseFaceDetectionPause the face detection.
-
– resumeFaceDetectionResume the face detection.
Manage camera
-
– switchCamera:Switch between the front and back facing camera.
-
– takePicture:Takes the picture from the camera and starts the image manipulation process.
Apply stickers to an image
-
– processPicture:completion:Takes the picture and starts the image manipulation process.
Properties
accessoryView
A view positioned between the previewLayer and the stickers.
@property (readonly) UIView *accessoryViewDiscussion
This view can be used to display additional items between the video feed and the stickers.
Declared In
FMStickerCaptureView.hnumberOfStickerDetected
The number of stickers currently detected
@property (readonly) NSInteger numberOfStickerDetectedDiscussion
This property indicates the number of stickers detected in the video feed, in real time.
Declared In
FMStickerCaptureView.hClass Methods
setLicense:
Sets the license string for the authorised bundle ID.
+ (void)setLicense:(NSString *)licenseParameters
- license
The license NSString
Discussion
The FMStickerEngine framework is a paid component. You can try it for free in development by using the bundle ID and the license provided in this project.
In order to publish your app on the App Store, you need to purchase a valid license and set this property accordingly.
Declared In
FMStickerCaptureView.hInstance Methods
pauseFaceDetection
Pause the face detection.
- (void)pauseFaceDetectionSee Also
Declared In
FMStickerCaptureView.hprocessPicture:completion:
Takes the picture and starts the image manipulation process.
- (void)processPicture:(UIImage *)image completion:(void ( ^ ) ( UIImage *picture , NSError *error ))completionParameters
- image
A UIImage on which the sticker will be applied. You should supply an image with the correct orientation.
- completion
A block which is called when the detection process is completed. It returns an UIImage.
Declared In
FMStickerCaptureView.hresumeFaceDetection
Resume the face detection.
- (void)resumeFaceDetectionSee Also
Declared In
FMStickerCaptureView.hstartCapture
Starts the capture session and initialise all the required components.
- (void)startCaptureDiscussion
This method should be called when ready to show the preview view.
Declared In
FMStickerCaptureView.hswitchCamera:
Switch between the front and back facing camera.
- (void)switchCamera:(void ( ^ ) ( void ))completionParameters
- completion
A block which is called when the camera switch is completed.
Declared In
FMStickerCaptureView.htakePicture:
Takes the picture from the camera and starts the image manipulation process.
- (void)takePicture:(void ( ^ ) ( UIImage *picture , NSError *error ))completionParameters
- completion
A block which is called when the detection process is completed. It returns an UIImage.
Declared In
FMStickerCaptureView.h