avcapture

AVCaptureVideoPreviewLayer and preview from camera position

偶尔善良 提交于 2019-12-03 21:40:40
I'm developing an app that permits user to takes photo. I've started using AVCam apple provides but i'm actually have a problem Simply i cannot position the camera layer where i want but it's positioned automatically on center of the View On the left side you can see what i actually have, on the right side what i'd like to have. The View that contains the preview that comes from the camera is a UIView subclass and this is the code class AVPreviewView : UIView { override class func layerClass() -> AnyClass { return AVCaptureVideoPreviewLayer.self } func session () -> AVCaptureSession { return

AVCaptureStillImageOutput Image returning upside down

邮差的信 提交于 2019-12-03 15:58:53
I am capturing images from the camera using captureStillImageAsynchronouslyFromConnection The images are being saved upside down. I tried saving the image using UIImage *flippedImage = [UIImage imageWithCGImage:image.CGImage scale:image.scale orientation:UIImageOrientationUp] but this orientation is only in the metadata and when I copy the data from the file to process it the processed images are upside down. (Quick look shows the originals upright, but the processed/filtered images are upside down). What is the correct way to set the orientation for the video capturing? I set the orientation

iOS 5 - AVCaptureDevice setting focus point and focus mode freezes the live camera picture

雨燕双飞 提交于 2019-12-03 10:17:02
问题 I'm using the following method to set point of focus since iOS 4: - (void) focusAtPoint:(CGPoint)point { AVCaptureDevice *device = [[self captureInput] device]; NSError *error; if ([device isFocusModeSupported:AVCaptureFocusModeAutoFocus] && [device isFocusPointOfInterestSupported]) { if ([device lockForConfiguration:&error]) { [device setFocusPointOfInterest:point]; [device setFocusMode:AVCaptureFocusModeAutoFocus]; [device unlockForConfiguration]; } else { NSLog(@"Error: %@", error); } } }

AVCaptureDevice Camera Zoom

和自甴很熟 提交于 2019-12-03 04:21:02
问题 I have a simple AVCaptureSession running to get a camera feed in my app and take photos. How can I implement the 'pinch to zoom' functionality using a UIGestureRecognizer for the camera? 回答1: The accepted answer is actually outdated and I'm not sure it will actually take the photo of the zoomed in image. There is a method to zoom in like bcattle answer says. The problem of his answer is that it does not take in charge the fact that the user can zoom in and then restart from that zoom position

iOS 5 - AVCaptureDevice setting focus point and focus mode freezes the live camera picture

喜欢而已 提交于 2019-12-03 00:45:29
I'm using the following method to set point of focus since iOS 4: - (void) focusAtPoint:(CGPoint)point { AVCaptureDevice *device = [[self captureInput] device]; NSError *error; if ([device isFocusModeSupported:AVCaptureFocusModeAutoFocus] && [device isFocusPointOfInterestSupported]) { if ([device lockForConfiguration:&error]) { [device setFocusPointOfInterest:point]; [device setFocusMode:AVCaptureFocusModeAutoFocus]; [device unlockForConfiguration]; } else { NSLog(@"Error: %@", error); } } } On iOS 4 devices this works without any problems. But on iOS 5 the live camera feed freezes and after

how to draw grid lines when camera is open avcapturemanager [closed]

℡╲_俬逩灬. 提交于 2019-12-02 21:05:59
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. I want to display grid line like the one which appears when a camera is open.I am using AVCaptureManager.Should i use core graphics to draw grid lines?what is the size of those grid lines? thanks You can indeed add a custom view as an overlay over your camera view to draw the grid using QuartzCore. That is how I did it in my app Subvision: The code I use to draw it ( note: my grid is adjustable so it's can be 10x10, 2x2

AVCaptureDevice Camera Zoom

血红的双手。 提交于 2019-12-02 18:40:00
I have a simple AVCaptureSession running to get a camera feed in my app and take photos. How can I implement the 'pinch to zoom' functionality using a UIGestureRecognizer for the camera? Gabriel Cartier The accepted answer is actually outdated and I'm not sure it will actually take the photo of the zoomed in image. There is a method to zoom in like bcattle answer says. The problem of his answer is that it does not take in charge the fact that the user can zoom in and then restart from that zoom position. His solution will create some kind of jumps that are not really elegant. The easiest and

AVCapture appendSampleBuffer

和自甴很熟 提交于 2019-12-02 18:37:21
I am going insane with this one - have looked everywhere and tried anything and everything I can thinks of. Am making an iPhone app that uses AVFoundation - specifically AVCapture to capture video using the iPhone camera. I need to have a custom image that is overlayed on the video feed included in the recording. So far I have the AVCapture session set up, can display the feed, access the frame, save it as a UIImage and marge the overlay Image onto it. Then convert this new UIImage into a CVPixelBufferRef. annnd to double check that the bufferRef is working I converted it back to a UIImage and

Getting only white screenshot

北城以北 提交于 2019-12-02 11:39:10
问题 I can read the barcode but I can't get the snapshot of the screen. getScreenImage function gets a white screen. How can I get the screenshot including the screen which I see the camera view? Thank you. @interface igViewController () <AVCaptureMetadataOutputObjectsDelegate,AVCaptureVideoDataOutputSampleBufferDelegate> { AVCaptureSession *_session; AVCaptureDevice *_device; AVCaptureDeviceInput *_input; AVCaptureMetadataOutput *_output; AVCaptureVideoPreviewLayer *_prevLayer; UIView *

How do I record a video on iOS without using a preset?

一个人想着一个人 提交于 2019-12-01 21:39:55
The simpler way to record a video on iOS is by setting a AVCaptureSession.sessionPreset . But that doesn't work for me since I want to control parameters like binning, stabilization (cinematic, standard, or none) and ISO. I find the format I want and assign it to activeFormat , but when I try to start recording, I get an error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureMovieFileOutput startRecordingToOutputFileURL:recordingDelegate:] No active/enabled connections' Here is my initialisation code: let device = AVCaptureDevice.defaultDevice(