【问题标题】:iPhone iOS4 low-level camera control?iPhone iOS4低级摄像头控制?
【发布时间】:2011-03-27 01:42:45
【问题描述】:

有没有办法在 iPhone 4 的 iOS4 中手动设置低级静态相机设置,例如快门速度、光圈或 ISO?我不认为它存在于官方 SDK 中,但也许有人找到了一些私有 API 来允许这样做?

我发现我的 iPhone 4 相机无法使用,因为即使在相当好的照明条件下,它也总是坚持以最慢的 1/15 秒快门速度拍摄,如果拍摄对象在移动,则会导致运动模糊。

谢谢!

【问题讨论】:

标签: iphone camera ios4 low-level


【解决方案1】:

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

@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

【讨论】:

  • 请编辑您的答案并格式化代码以使其可读。
  • 发帖人询问相机的低级访问。您的示例确实提供了对相机的访问,但它肯定不是低级的。我认为这对他没有帮助。
  • @s1m0n:- 我试图帮助他,但我也提到“这可能会有所帮助”。我尽量按照我的水平去帮助他……
【解决方案2】:

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

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

【讨论】:

  • 在旧的两个版本的操作系统上提交错误报告似乎是徒劳的,尤其是当它确实是一个功能请求时。
  • 它仍然是相关的,因为 iOS 6 没有将它作为公共 API 提供。
  • 但与目前的确切问题无关。我很欣赏这个问题可能只是指定 iOS 4,因为它已经 2 岁了。也许应该编辑问题以引用与 iPhone 4 兼容的任何 iOS 版本?
猜你喜欢
  • 1970-01-01
  • 2012-06-19
  • 1970-01-01
  • 2011-02-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多