小编Sla*_*ena的帖子

iOS 4.2,寻找一种操纵iPhone 4相机焦距的方法

我正在AR项目中工作,我们想要操纵iPhone4相机的对焦距离.这甚至可能吗?到目前为止,我们发现只需将切换和自动聚焦作为此处列出的选项:http://developer.apple.com/library/ios/#documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html%23//apple_ref/OCC/instm/AVCaptureDevice/isAdjustingFocus

提前感谢任何提示!:)

iphone camera ios-4.2

6
推荐指数
1
解决办法
2745
查看次数

可以在AVCaptureVideoPreviewLayer上绘制一个矩形吗?

我已经在这几天敲打了我的脑袋.

我想在CALayer(AVCaptureVideoPreviewLayer)上绘制一个矩形,恰好是iPhone4上摄像头的视频输入.

这是我设置的一部分;

    //(in function for initialization)

        -(void)initDevices {
           AVCaptureDeviceInput *captureInput = [AVCaptureDeviceInput                   deviceInputWithDevice:[AVCaptureDevicedefaultDeviceWithMediaType:AVMediaTypeVideo] error:nil];

           AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init];
           captureOutput.alwaysDiscardsLateVideoFrames = YES; 
           captureOutput.minFrameDuration = CMTimeMake(1, 30);
           dispatch_queue_t queue;
           queue = dispatch_queue_create("cameraQueue", NULL);
           [captureOutput setSampleBufferDelegate:self queue:queue];
           dispatch_release(queue);

           NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey; 
           NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA]; 
           NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key]; 
           [captureOutput setVideoSettings:videoSettings]; 
           self.captureSession = [[AVCaptureSession alloc] init];
           [self.captureSession addInput:captureInput];
           [self.captureSession addOutput:captureOutput];
           [self.captureSession setSessionPreset:AVCaptureSessionPresetHigh];   
           self.prevLayer = [AVCaptureVideoPreviewLayer layerWithSession: self.captureSession];
           self.prevLayer.frame = CGRectMake(0, 0, 400, 400); 
           self.prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; …
Run Code Online (Sandbox Code Playgroud)

camera drawing ios iphone-4

6
推荐指数
1
解决办法
9345
查看次数

标签 统计

camera ×2

drawing ×1

ios ×1

ios-4.2 ×1

iphone ×1

iphone-4 ×1