JCBodymarkerCamera 0.1.2

JCBodymarkerCamera 0.1.2

Maintained by Jason Han.



  • By
  • JasonHan1990

JCBodymarkerCamera

Version License Platform

Description

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.

Example

example

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"

Open the camera with front body marker.

example-1

JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] initWithBodyMarkerOption:BodyMarkerOptionFront];
[self presentViewController:cameraViewController animated:YES completion:nil];

Open the camera with side body marker.

example-2

JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] initWithBodyMarkerOption:BodyMarkerOptionSide];
[self presentViewController:cameraViewController animated:YES completion:nil];

Open the camera with only front facing camera.

example-3

JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] init];
cameraViewController.cameraOption = CameraOptionFrontFacingCamera;
[self presentViewController:cameraViewController animated:YES completion:nil];

Open the camera with only rear camera.

example-4

JCCameraViewController *cameraViewController = [[JCCameraViewController alloc] init];
cameraViewController.cameraOption = CameraOptionRearCamera;
[self presentViewController:cameraViewController animated:YES completion:nil];

Get process your image data. Create completion blocks when you init a camera view controller.

cameraViewController.successedCompletion = ^(NSData *imageData) {
    // it is on the main thread
    // process your image data
};

cameraViewController.failedCompletion = ^(NSError *error) {
    // pop error message
};

Don't forget adding camera usage

NSCameraUsageDescription

Dependency

JCBodymarkerCamera is using Masonry for autolayout.

Installation

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

pod 'JCBodymarkerCamera'

Author

Juncheng Han, [email protected]

My Blog: https://junchenghan.com/

License

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