11

Is there a way to manually set low-level still-camera settings like shutter speed, aperture, or ISO in iOS4 on the iPhone 4? I don't think it exists in the official SDK but perhaps someone has found some private APIs to allow this?

I find my iPhone 4 camera to be unusable because even in fairly decent lighting, it always insists on shooting at the slowest 1/15th a second shutter speed causing motion blur if the subject is moving at all.

Thanks!

Michael Liu
  • 111
  • 1
  • 3
  • You can do this with private APIs in iOS 6, at least. http://stackoverflow.com/a/12939981/83853 – Michael Grinich Oct 17 '12 at 17:36
  • You can do this with private APIs in iOS 6, at least. Hopefully they'll be made public in the next release. Check out my detailed answer here: http://www.stackoverflow.com/a/12939981/83853 – Michael Grinich Oct 17 '12 at 17:42
  • Good question. It looks like AVCaptureDevice might be the best you can do, and I don't think it provides access to all of the settings you're looking to control. That said, it might be a good place to start. http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/doc/c_ref/AVCaptureDevice – Andrew Little Aug 11 '10 at 16:16

2 Answers2

1

Not directly. Please file a bug report.

Yes, there may be private APIs available, but that's of limited use.

Andrew Pouliot
  • 5,423
  • 1
  • 30
  • 34
  • Filing a bug report on a two-versions-old OS seems futile, particularly when it's really a feature request. – Paul Gregory Nov 25 '12 at 00:59
  • 1
    It's still relevant, as iOS 6 doesn't provide this as public API. – Andrew Pouliot Nov 26 '12 at 20:33
  • But not relevant to the exact question as it stands. I appreciate the question may simply specify iOS 4 because it's 2 years old. Perhaps the question should be edited to refer to any iOS version compatible with the iPhone 4? – Paul Gregory Nov 27 '12 at 08:42
-2

Try this, I could be useful for you:

@interface MyViewController ()

@property (nonatomic, retain) IBOutlet UIImageView *imageView;

@property (nonatomic, retain) IBOutlet UIToolbar *myToolbar;

@property (nonatomic, retain) OverlayViewController *overlayViewController;

@property (nonatomic, retain) NSMutableArray *capturedImages;

// toolbar buttons

- (IBAction)photoLibraryAction:(id)sender;

- (IBAction)cameraAction:(id)sender;


@end


@implementation MyViewController
- (void)viewDidLoad

{

    self.overlayViewController =

        [[[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil] autorelease];



    // as a delegate we will be notified when pictures are taken and when to dismiss the image picker

    self.overlayViewController.delegate = self;

    self.capturedImages = [NSMutableArray array];


    if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
    {

        // camera is not on this device, don't show the camera button

        NSMutableArray *toolbarItems = [NSMutableArray arrayWithCapacity:self.myToolbar.items.count];

        [toolbarItems addObjectsFromArray:self.myToolbar.items];

        [toolbarItems removeObjectAtIndex:2];

        [self.myToolbar setItems:toolbarItems animated:NO];

    }

}


- (void)viewDidUnload
{

    self.imageView = nil;

    self.myToolbar = nil;



    self.overlayViewController = nil;

    self.capturedImages = nil;

}


- (void)dealloc
{   

    [_imageView release];

    [_myToolbar release];



    [_overlayViewController release];

    [_capturedImages release];



    [super dealloc];

}


- (void)showImagePicker:(UIImagePickerControllerSourceType)sourceType
{

    if (self.imageView.isAnimating)

        [self.imageView stopAnimating];



    if (self.capturedImages.count > 0)

        [self.capturedImages removeAllObjects];



    if ([UIImagePickerController isSourceTypeAvailable:sourceType])
    {

        [self.overlayViewController setupImagePicker:sourceType];

        [self presentModalViewController:self.overlayViewController.imagePickerController animated:YES];

    }

}



- (IBAction)photoLibraryAction:(id)sender
{   

    [self showImagePicker:UIImagePickerControllerSourceTypePhotoLibrary];

}



- (IBAction)cameraAction:(id)sender
{

    [self showImagePicker:UIImagePickerControllerSourceTypeCamera];

}


// as a delegate we are being told a picture was taken

- (void)didTakePicture:(UIImage *)picture
{

    [self.capturedImages addObject:picture];

}


// as a delegate we are told to finished with the camera

- (void)didFinishWithCamera
{

    [self dismissModalViewControllerAnimated:YES];


    if ([self.capturedImages count] > 0)
    {

        if ([self.capturedImages count] == 1)
        {

            // we took a single shot

            [self.imageView setImage:[self.capturedImages objectAtIndex:0]];

        }

        else

        {

            // we took multiple shots, use the list of images for animation

            self.imageView.animationImages = self.capturedImages;



            if (self.capturedImages.count > 0)

                // we are done with the image list until next time

                [self.capturedImages removeAllObjects];  



            self.imageView.animationDuration = 5.0;    // show each captured photo for 5 seconds

            self.imageView.animationRepeatCount = 0;   // animate forever (show all photos)

            [self.imageView startAnimating];

        }

    }

}



@end
Bo Persson
  • 90,663
  • 31
  • 146
  • 203
anshika
  • 141
  • 2
  • 9
  • Please edit your answer and format the code to make it readable. – kleopatra Dec 08 '12 at 11:10
  • The poster asks about low-level access tot the camera.. Your example indeed provides access to the camera, but it certainly isn't low-level. I don't think this is helpful for him. – s1m0n Dec 08 '12 at 14:07
  • @s1m0n:- I tried to help him, but i also mentioned that "it may be helpful". i tried to help him according to my level best... – anshika Dec 20 '12 at 09:15