Questions tagged [avcapturesession]

iPhone - To perform a real-time or offline capture, you instantiate an AVCaptureSession object and add appropriate inputs (such as AVCaptureDeviceInput), and outputs (such as AVCaptureMovieFileOutput).

You use an AVCaptureSession object to coordinate the flow of data from AV input devices to outputs.

To perform a real-time or offline capture, you instantiate an AVCaptureSession object and add appropriate inputs (such as AVCaptureDeviceInput), and outputs (such as AVCaptureMovieFileOutput).

The AVFoundation Programming Guide explains how to use AVCapureSession.

1246 questions
74
votes
3 answers

Trying to understand CMTime

I have seen some examples of CMTime (Three separate links), but I still don't get it. I'm using an AVCaptureSession with AVCaptureVideoDataOutput and I want to set the max and min frame rate of the the output. My problem is I just don't understand…
RileyE
  • 10,874
  • 13
  • 63
  • 106
70
votes
20 answers

AVCaptureVideoPreviewLayer orientation - need landscape

My app is landscape only. I'm presenting the AVCaptureVideoPreviewLayer like this: self.previewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:session]; [self.previewLayer setBackgroundColor:[[UIColor blackColor]…
soleil
  • 12,133
  • 33
  • 112
  • 183
63
votes
6 answers

Switch cameras with avcapturesession

Using this tutorial here: http://www.musicalgeometry.com/?p=1297 I have created a custom overlay and image capture with AVCaptureSession. I am attempting to allow the user to switch between the front and back camera. Here is my code in…
Kyle Begeman
  • 7,169
  • 9
  • 40
  • 58
55
votes
11 answers

Why AVCaptureSession output a wrong orientation?

So, I followed Apple's instructions to capture video session using AVCaptureSession: http://developer.apple.com/iphone/library/qa/qa2010/qa1702.html. One problem I'm facing is that even though the orientation of the camera / iPhone device is…
Peter
  • 663
  • 1
  • 6
  • 7
48
votes
4 answers

How to crop an image from AVCapture to a rect seen on the display

This is driving me crazy because I can't get it to work. I have the following scenario: I'm using an AVCaptureSession and an AVCaptureVideoPreviewLayer to create my own camera interface. The interface shows a rectangle. Below is the…
Tobi
  • 5,499
  • 3
  • 31
  • 47
46
votes
8 answers

Turn on torch/flash on iPhone

I know that the only way to turn on the flash and keep it on on iPhone 4 is by turning the video camera on. I'm not too sure of the code though. Here is what I am trying: -(IBAction)turnTorchOn { AVCaptureSession *captureSession =…
John
  • 611
  • 2
  • 9
  • 12
46
votes
2 answers

How to capture picture with AVCaptureSession in Swift?

I have a UIViewController in which I use AVCaptureSession to show the camera and it is working just fine and fast. I placed a UIButton object on top of this camera view and added a IBAction for the button. This is how it looks like right now: Now I…
rodrigoalvesvieira
  • 7,895
  • 15
  • 63
  • 84
44
votes
4 answers

Barcode on swift 4

I'm trying to upgrade mi app to swift 4, but the barcode reader is not working. I have isolated the barcode reader code, and still not working. The camera works but it does not detect the barcode. The code worked just fine on swift 3 iOS 10. This is…
Dx_
  • 1,566
  • 1
  • 16
  • 17
35
votes
9 answers

How do I use the metadataOutputRectOfInterestForRect method and rectOfInterest property to scan a specific area? (QR Code)

I am building a QR code scanner with Swift and everything works in that regard. The issue I have is that I am trying to make only a small area of the entire visible AVCaptureVideoPreviewLayer be able to scan QR codes. I have found out that in…
The_Dude
  • 574
  • 2
  • 6
  • 16
32
votes
3 answers

How to apply "filters" to AVCaptureVideoPreviewLayer

My app is currently using AVFoundation to take the raw camera data from the rear camera of an iPhone and display it on an AVCaptureVideoPreviewLayer in real time. My goal is to to conditionally apply simple image filters to the preview layer. The…
eschurter
  • 686
  • 1
  • 7
  • 8
29
votes
2 answers

How to use AVCaptureSession with Slide Over and Split View in iOS 9?

My team is developing a set of SDKs for barcode scanning, ID scanning and OCR. We use device's camera, specifically, AVCaptureSession, to obtain video frames on which we perform our processing. We're exploring new iOS 9 multitasking features Slide…
Cerovec
  • 1,273
  • 10
  • 19
29
votes
2 answers

CALayer - Place sublayer below storyboard UIButtons?

I've got a view controller in my storyboard with several UIButtons. One of them activates an AVFoundation camera preview layer shown in a sublayer: captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc]…
golmschenk
  • 11,736
  • 20
  • 78
  • 137
28
votes
3 answers

Detecting heart rate using the camera

I need the same functionality as the application Instant Heart Rate. The basic process requires the user to: Place the tip of the index finger gently on the camera lens. Apply even pressure and cover the entire lens. Hold it steady for 10…
ellenpage
  • 281
  • 1
  • 4
  • 5
27
votes
5 answers

How to generate an UIImage from AVCapturePhoto with correct orientation?

I am calling AVFoundation's delegate method to handle a photo capture, but I am having difficulty converting the AVCapturePhoto it generates into an UIImage with the correct orientation. Although the routine below is successful, I always get a…
Andre Guerra
  • 1,117
  • 1
  • 9
  • 18
27
votes
5 answers

How to calculate FOV?

Initial Context I am developping an augmented reality application location based and I need to get the field of view [FOV] (I just update the value when the orientation change, so I am looking for a method which can get this value when I call…
Humbertda
  • 364
  • 1
  • 6
  • 23
1
2 3
83 84