Quick Photo Capture with Stop Motion

Quick Photo Capture with Stop Motion

Released 3 years ago , Last update 2 years ago

Create Quick Capture Photo applications, discreet capture (without preview) and Stop-Motion Video in a few lines of code.

LTQuickPhotoCapture & Stop MotionVideo Creator

With this component, you will be able to :

  • Capture image from front and back cameras without having to use UIImagePickerViewController
  • Capture multiples images without having to close a preview confirmation and reopen the capture window
  • Capture images discreetly, without having to show a real-time preview (just the way does some "folder protect" applications)
  • Create a Stop-Motion QuickTimeMovie in just 4 lines of code.

The main advantage of this set of methods is that, for taking pictures, you can decide : everything because you can «design» everything : having a preview or not, take multiple shots without having to go through a final preview confirmation, then a restart of a controller, add transparent buttons to the real-time preview, etc.

And finally, you can do all of those things in a couple of minutes.

Following is a link of a Stop Motion video created by the demonstration program included in the source-code of this component. Stop-Motion Video Demonstration

5.0
  • 5 1
  • 4 0
  • 3 0
  • 2 0
  • 1 0
1 Reviews Read Reviews

Pricing

$59.99

Application License + Support

  • Perpetual license

  • unlimited applications

  • Can distribute binary products only

  • Commercial use

  • 6 months support

Installation

How to use ?

Step 1 Copy both LTQuickPhotoCapture.m & LTQuickPhotoCapture.h files in your project.

Image1

Step 2 Add the following Frameworks to your project by clicking your project name, going to the «Build Phases» tab, opening «Link Binary with Librairies» and clicking the «+» button :

  • ImageIO
  • CoreVideo
  • CoreMedia
  • QuartzCore
  • AVFoundation
  • AssetsLibrary 

Image2

Step 3 In the header of the .h file of your view controller, add :

#import "LTQuickPhotoCapture.h"

Then declare LTQuickPhotoCapture using a similar approach :

LTQuickPhotoCapture *photoCapture;

Step 4 Set your view controller as a delegate of LTQuickPhotoCapture :

: UIViewController 

Thats all for the installation.

Usage Sample

Now here are some sample of initializations :

Create a capture photo mode with a real-time preview :

Add an UIView to you nib, connect it to an outlet named, for example «preview» then add use this code :

photoCapture = [[LTQuickPhotoCapture alloc] init];
[photoCapture setParent:self];

This will tell photo capture that your viewController will receive all events

[photoCapture initCaptureWithCamera:LTCameraFront andQuality:LTCaptureQualityHigh inPreview:preview];

Camera can be LTCameraFront or LTCameraBack according to the one you want to setup Quality can be one of the following : LTCaptureQualityPhoto LTCaptureQualityHigh LTCaptureQualityMedium LTCaptureQualityLow

Now to receive the image, add the following method responder :

- (void)cameraHasTakenPicture:(UIImage *)picture withExifInformation:(NSDictionary *)exif {
    //::.. here, do what you want with «picture» ..::
}

Finally to take a photo, just call :

[photoCapture takePicture];

Create an «invisible» capture photo mode :

Same approach as previously, described, the only difference is that you will not use «initCaptureWithCamera:andQuality:inPreview» to initialize the capture, but :

[photoCapture initDiscreetCaptureWithCamera:LTCameraFront andQuality:LTCaptureQualityHigh];

Of course, there’s no need of an UIView in this mode because there’s no realtime preview ;-)

##Ask to take 1 photo, every second, 10 times, then stop

Instead of calling [photoCapture takePicture], use :

[photoCapture doMotionCaptureAtInterval:1.0f forANumberOfPicturesOf:10];

Where «Interval» is the duration in seconds between each taken photo, and numberOfPictures is the total number of pictures to take before stopping.

Every taken picture will call the selector « (void)cameraHasTakenPicture: » so you’ll get each picture as they are taken

Initialize for motion video capture

In the same explained way for the still image capture, add an UIView and it outlet, and initialize the component like this :

photoCapture = [[LTQuickPhotoCapture alloc] init];
[photoCapture setParent:self];
[photoCapture prepareManualMotionCaptureAndRecordAsVideoWithFrameDuration:5.0f withCamera:LTCameraBack andQuality:LTCaptureQualityHigh inPreview:preview];

The first parameter specify how many frames are recorded in the QuickTime movie using 1 take. The common usage for a «motion video style» is 5 frames per picture.

The other 3 parameters have been explained in the still image capture.

That’s all for the initialization, now how to :

Add an image to the motion video

Just call :

[photoCapture takePictureAndAddToRecordedMotionVideo];

Again here, each time a photo has been taken, the delegate «(void)cameraHasTakenPicture:» is called for you to do something else with the image (preview it, do a «photo roll» like in the demo, etc)

Stop recording and save the motion video to the camera roll

When you’re done with the recording, you’ve got 2 choices :

Stop the recording, and wait (for example to ask the user if he wants to save the result to the camera roll), with (void)stopRecordedMotionVideoWithoutSaving;
 Then you can decide either to save the file manually with

(void)saveRecordedMotionVideoToCameraRoll;

or the delete it using

(void)deleteRecordedMotionVideo;


Stop the recording and save immediatly to the camera roll with :


(void)stopRecordedMotionVideoAndSaveToCameraRoll;


This will automaticaly save the film to the camera roll, and delete the temporary created file.

This component offers some others possibilities, check the method & delegate lists below to have a good overview, and go through the demo source code to see how it simply works.

Thanks a lot for trusting WPTechnology.

Methods & Delegates

List of available methods :

- (void)setParent:(NSObject *)_parent;

Use this method to set your view-controller as the parent of all delegate methods. If you want to receive the taken image, or get information or errors, it is necessary to set the parent.

- (BOOL)canInitAVSession;

This method will return YES if your device can handle AVCaptureSession (so can work with this component), which means that the iOS version is compatible.

- (BOOL)initDiscreetCaptureWithCamera:(LTCaptureCamera)camera andQuality:(LTCaptureQuality)quality;

This will initialize the Camera Capture without showing a real-time preview. camera can have the following values : LTCameraFront LTCameraBack

quality can have the following values : LTCaptureQualityPhoto LTCaptureQualityHigh LTCaptureQualityMedium LTCaptureQualityLow

According to your choice of camera & quality, the resolution of the resulted picture/video will change to fit the different possibilities.

- (BOOL)initCaptureWithCamera:(LTCaptureCamera)camera andQuality:(LTCaptureQuality)quality inPreview:(UIView *)preview;

Same method as the previous one, the only difference here is that you can attach an UIView which will be used to show a real-time preview of the choosen camera.

- (void)takePicture;

This method will take a picture, then call the « cameraHasTakenPicture » delegate to inform the parent that a new picture is available.

- (void)takeAPictureInSeconds:(int)seconds;

This method allows you to ask the component to take a picture after a delay specified in seconds. So after «seconds» seconds, it will call automaticaly the «takePicture» method.

- (void)doMotionCaptureAtInterval:(float)intervalInSeconds forANumberOfPicturesOf:(int)numberOfPictures;

This method ask the component to take one picture, each «intervalInSeconds» seconds, and to automaticaly continue until «numberOfPictures» has been taken. It also uses the «takePicture» method, so the delegate will receive image per image.

- (int)motionCaptureGetRemainingPictures;

This method returns the number of remaining pictures to take when you’ve started the previous method.

- (void)stopManualMotionCapture;

This method stops immediatly the timed manual capture.

##Stop Motion specific methods

- (void)prepareStopMotionCaptureAndRecordAsVideoWithFrameDuration:(float)_frameDurationInFrames withCamera:(LTCaptureCamera)camera andQuality:(LTCaptureQuality)quality inPreview:(UIView *)preview;

This will prepare the component to create a Stop Motion Video QuickTime Film. A Stop Motion film is a video which is constructed by still images, added one by one, in the same way made for the old video animations for children.

_frameDurationInFrames specify how many frames on the QuickTime Video will be created with one image. You can specify from one to X, but we usually use "5" to create a comic animation in stop-motion.

camera, quality & preview must have the same values as decribed in "initCaptureWithCamera".

- (void)takePictureAndAddToStopMotionVideo;

This will ask the component to take a picture and add it to the QuickTime video, according to the parameters setted previously.

- (void)stopStopMotionVideoAndSaveToCameraRoll;

This method stops the recording, close the video, transfer it to the camera roll and delete its temporary file.

- (void)stopStopMotionVideoWithoutSaving;

Stop the recording of the Movie, and close the session & file. You must then call "saveStopMotionVideoToCameraRoll" to transfer it to the camera roll, and "deleteStopMotionVideo" to delete its temporary file.

- (void)deleteStopMotionVideo;

Deletes the temporary file used to create the QuickTime Movie.

- (NSURL *)getStopMotionVideoFilename;

Returns the temporary filename used to store the creation of the QuickTime Movie during the recording process and before its transfer to the camera roll.

- (int)getNumberOfRecordedPicturesInStopMotion;

Returns the number of recorded pictures to create the current QuickTime Movie timeline.

- (float)getNumberOfRecordedFramesInStopMotion;

Returns the number of recorded frames in the QuickTime Movie (it means "RecordedPictures" * "_frameDurationInFrames").

- (void)saveStopMotionVideoToCameraRoll;

Will save the temporary file created by the stop motion system into the Camera Roll of the iDevice.
You must call "deleteStopMotionVideo" to manualy delete the temporary file just after that.

List of delegate methods :

- (void)cameraHasTakenPicture:(UIImage *)picture withExifInformation:(NSDictionary *)exif;

This delegate method is called each time a picture has been taken, manually, automaticaly or in stop-motion.
It returns the picture itself and an NSDictionary including the Exif information of the photo.

- (void)motionVideoError:(NSError *)error;

This method is called when an error occured in Stop Motion recording. (NSError *)error contains the description of the error.

- (void)motionVideoRecordingSavedSuccessfully;

This method is called when the stop-motion video has been successfully saved to the camera roll

- (void)motionVideoRecordingNotSavedWithError:(NSError *)error;

This method is called when an error occured while saving the Stop Motion recording to the Camera Roll. (NSError *)error contains the description of the error.

2 licenses, starting from From » $59.99 View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
  • A a 1 year ago
    can you tell me which apps use this so i can check it out? Examples...
  • A Arik 2 years ago
    Will this code work on first gen iPhone? (considering the needed minimum SDK version)
  • JG Jing Gu License holderApplication License + Support
    6 month support
    Purchased on Sep 27, 2012
    2 years ago
    Great component, but how to turn off the shutter sound?
    • Laurent Taupin Publisher 2 years ago
      Hi Devia, Unfortunately it is not possible, due to a limitation of iOS. The only possibility to avoid the shutter sound is to use another method (that in reality use the video capture, and take an image from the video flux) but it decrease drastically the quality of the picture taken :(
    • Jing Gu 2 years ago
      Many thanks.