JCBodymarkerCamera is a camera for body measurement. It has both front body marker and side body marker. It also has an indicator to show the vertical angle of your device.
JCBodymarkerCamera only works with portrait position. It doesn't contain the algrithm for body measurement.
JCBodymarkerCamera is built for iOS 10.2 or later.
There are two enums to setup a camera view controller.
// define marker
typedef NS_ENUM(NSInteger, BodyMarkerOption) {
BodyMarkerOptionUnspecified,
BodyMarkerOptionFront,
BodyMarkerOptionSide
};
// define camera
typedef NS_ENUM(NSInteger, CameraOption) {
CameraOptionUnspecified = 0,
CameraOptionRearCamera = 1,
CameraOptionFrontFacingCamera = 2,
};
To create a camera view controller, you can simply do this: Import JCCameraViewController to your source file.
#import "JCCameraViewController.h"
JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] initWithBodyMarkerOption:BodyMarkerOptionFront];
[self presentViewController:cameraViewController animated:YES completion:nil];
JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] initWithBodyMarkerOption:BodyMarkerOptionSide];
[self presentViewController:cameraViewController animated:YES completion:nil];
JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] init];
cameraViewController.cameraOption = CameraOptionFrontFacingCamera;
[self presentViewController:cameraViewController animated:YES completion:nil];
JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] init];
cameraViewController.cameraOption = CameraOptionRearCamera;
[self presentViewController:cameraViewController animated:YES completion:nil];
cameraViewController.successedCompletion = ^(NSData *imageData) {
// it is on the main thread
// process your image data
};
cameraViewController.failedCompletion = ^(NSError *error) {
// pop error message
};
NSCameraUsageDescription
JCBodymarkerCamera is using Masonry for autolayout.
JCBodymarkerCamera is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'JCBodymarkerCamera'
Juncheng Han, namrie1990@gmail.com
My Blog: https://junchenghan.com/
JCBodymarkerCamera is available under the MIT license. See the LICENSE file for more info.