avcapturesession

iOS Capture “screenshot” of camera controller

跟風遠走 提交于 2019-11-29 12:12:32
In my app I display the camera and I am taking screenshots of certain perts using UIGetScreenImage, (I tried UIGraphicsGetImageFromCurrentImageContext and it works great for screenshots on almost any part of my app but for the camera view it will just return a blank white image) ... Anyways, I fear Apple will reject my app because of UIGetScreenImage... How can I take a "screenshot" of a 50px by 50px box from the upper left corner of the camera without using this method? I searched and all I could find was "AVCaptureSession" and I couldn't find much about what that does, or if it's even what I

iOS camera: manual exposure duration but auto ISO?

天大地大妈咪最大 提交于 2019-11-29 09:29:45
问题 I'm using the camera video feed for some image processing and would like to optimise for fastest shutter speed. I know you can manually set exposure duration and ISO using setExposureModeCustomWithDuration:ISO:completionHandler: but this requires one to set both the values by hand. Is there a method or clever trick to allow you to set the exposure duraction manually but have the ISO handle itself to try to correctly expose the image? 回答1: I'm not sure if this solution is the best one, since I

Changing AVCaptureDeviceInput leads to AVAssetWriterStatusFailed

北城余情 提交于 2019-11-29 07:00:39
I am trying to change the Camera View Front and Back .it is working well.if video is recorded without flipping with Pause/Record Option it is working fine.But if we Flip Camera View once then, further recording video is not saving which leads to AVAssetWriterStatusFailed - The operation could not be completed . Can anybody help me to find where i have gone wrong ? Below is my code. Camera.m - (void)flipCamera{ NSArray * inputs = _session.inputs; for ( AVCaptureDeviceInput * INPUT in inputs ) { AVCaptureDevice * Device = INPUT.device ; if ( [ Device hasMediaType : AVMediaTypeVideo ] ) {

Captured photo is stretched with AVCaptureSession sessionPreset = AVCaptureSessionPresetPhoto

大憨熊 提交于 2019-11-29 04:35:45
IMPORTANT: if I use: session.sessionPreset = AVCaptureSessionPresetHigh; my preview image is not stretched !! If I save the photo to the device UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); the image is normal, only in the preview it is stretched. I m using AVFoundation to capture photo. session = [[AVCaptureSession alloc] init]; session.sessionPreset = AVCaptureSessionPresetHigh; CALayer *viewLayer = vImagePreview.layer; NSLog(@"viewLayer = %@", viewLayer); AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session];

How to capture frame-by-frame images from iPhone video recording in real time

試著忘記壹切 提交于 2019-11-29 03:59:13
问题 I am trying to measure the saturation of a selected color in real-time, like this: I am following this guide from Apple. I updated the code to work with ARC, and of course made my view controller an AVCaptureVideoDataOutputSampleBufferDelegate , but I don't know how to actually start capturing the data, as in starting up the camera to get some actual input. Here is my code: #import "ViewController.h" @interface ViewController () @property (nonatomic, strong) AVCaptureSession *session;

iOS: camera orientation

陌路散爱 提交于 2019-11-29 03:50:28
I want to capture an image with the camera using AVCaptureSession. It works ok, I start the camera and I can get the output. However, I have some problems with video orientation when I rotate the device. First, I want to support landscape left and right orientations and may be portrait modes too later. I implement: - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation{ return UIInterfaceOrientationIsLandscapse(interfaceOrientation); } When I rotate the device, it rotates the app from landscape left to landscape right or vice versa, but I only see the

Preventing AVCaptureVideoPreviewLayer from rotating, but allow UI layer to rotate with orientation

对着背影说爱祢 提交于 2019-11-29 02:34:40
I have two view controllers. One is the root VC and contains the UI interface such as the record button. On this view controller, I also display the view of another VC at index 0. This view contains a AVCaptureVideoPreviewLayer. I would like my video camera to mimic the Apple video camera app, where the interface layout adjusts with the rotation, but the video preview layer does not. You can see how the recording timer (UILabel) in the stock video app disappears and reappears at the top depending on the orientation. Any idea how to do this? I found one suggestion that recommendeds adding the

Applying Effect to iPhone Camera Preview “Video”

 ̄綄美尐妖づ 提交于 2019-11-29 01:57:20
问题 My goal is to write a custom camera view controller that: Can take photos in all four interface orientations with both the back and, when available, front camera. Properly rotates and scales the preview "video" as well as the full resolution photo. Allows a (simple) effect to be applied to BOTH the preview "video" and full resolution photo. Implementation (on iOS 4.2 / Xcode 3.2.5): Due to requirement (3), I needed to drop down to AVFoundation. I started with Technical Q&A QA1702 and made

Get Camera Preview to AVCaptureVideoPreviewLayer

我只是一个虾纸丫 提交于 2019-11-28 23:43:58
I was trying to get the camera input to show on a preview layer view. self.cameraPreviewView is tied to a UIView in IB Here is my current code that I put together from the AV Foundation Programming Guide. But the preview never shows AVCaptureSession *session = [[AVCaptureSession alloc] init]; session.sessionPreset = AVCaptureSessionPresetHigh; AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; NSError *error = nil; AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error]; if (!input) { NSLog(@"Couldn't create video

Capturing Images from AVCaptureSession

ぐ巨炮叔叔 提交于 2019-11-28 22:11:07
I am learning about AVCaptureSession and how to capture multiple images with its delegate method - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection My goal is to capture 1 or many images with a predefined rate per second. For example, 1 or 2 images per 1 second. So I set AVCaptureVideoDataOutput *captureOutput = [[AVCaptureVideoDataOutput alloc] init]; captureOutput.alwaysDiscardsLateVideoFrames = YES; captureOutput.minFrameDuration = CMTimeMake(1, 1); When [self.captureSession