iPhone iOS4 低级相机控制?

11

在 iPhone 4 的 iOS4 上有没有办法手动设置静态相机的低级别设置,例如快门速度、光圈或ISO?我认为官方 SDK 中不存在这种功能,但也许有人已经找到了一些私有 API 来实现此功能?

我发现我的 iPhone 4 相机无法使用,因为即使在相当不错的照明条件下,它总是坚持以最慢的1/15秒快门速度拍摄,导致主体稍有移动就会产生运动模糊。

谢谢!


好问题。看起来AVCaptureDevice可能是你能做的最好的选择,但我认为它并不能提供你想要控制的所有设置的访问权限。话虽如此,这可能是一个不错的起点。http://developer.apple.com/iphone/library/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/doc/c_ref/AVCaptureDevice - Andrew Little
至少在iOS 6中,您可以使用私有API来完成此操作。 - Michael Grinich
您至少可以在 iOS 6 中使用私有 API 来实现这一点。希望它们会在下一个版本中公开。请查看我的详细答案:http://www.stackoverflow.com/a/12939981/83853 - Michael Grinich
2个回答

1

不是直接的。请提交错误报告。

是的,可能有私有API可用,但受限使用。


在一个两个版本以前的操作系统上提交错误报告似乎是徒劳无功的,特别是当实际上是一个功能请求时。 - Paul Gregory
1
这仍然是相关的,因为iOS 6没有提供此作为公共API。 - Andrew Pouliot
但与当前问题无关。我理解这个问题可能只是指定iOS 4,因为它已经有2年了。也许应该编辑问题,以涉及与iPhone 4兼容的任何iOS版本? - Paul Gregory

-2

试试这个,可能对你有用:

@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

请编辑您的答案并格式化代码以使其易读。 - kleopatra
海报询问有关相机的低级访问权限。您的示例确实提供了对相机的访问权限,但它肯定不是低级别的。我认为这对他没有帮助。 - s1m0n
@s1m0n:我尝试帮他,但我也提到了“可能有帮助”。我尽力按照我的水平来帮他。 - anshika

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接