IPhone: taking photos with the front camera programmatically

I want to take a picture programmatically using the front camera in my iphone application I do not want the user to select or perform any interaction with the image picker .. just want to take the image and save it in a document .. maybe?

+7
source share
3 answers

As I understand from your question, AV Foundation is all you need. Take a look at these demos from Apple: AVCam

+8
source

EDIT: My bad one, it looks like you can really do this with AVCaptureSession. Although I can not come to my senses why this is possible. Looks like potential abuse ground.

Original (wrong) answer: No, it is impossible to take photos without user interaction, regardless of whether it is a front or rear camera.

0
source

try it -

- (IBAction) scanButtonTapped { // ADD: present a barcode reader that scans from the camera feed ZBarReaderViewController *reader = [ZBarReaderViewController new]; reader.readerDelegate = self; reader.supportedOrientationsMask = ZBarOrientationMaskAll; ZBarImageScanner *scanner = reader.scanner; // TODO: (optional) additional reader configuration here // EXAMPLE: disable rarely used I2/5 to improve performance [scanner setSymbology: ZBAR_I25 config: ZBAR_CFG_ENABLE to: 0]; // present and release the controller [self presentModalViewController: reader animated: YES]; [reader release]; } - (void) imagePickerController: (UIImagePickerController*) reader didFinishPickingMediaWithInfo: (NSDictionary*) info { // ADD: get the decode results id<NSFastEnumeration> results = [info objectForKey: ZBarReaderControllerResults]; ZBarSymbol *symbol = nil; for(symbol in results) // EXAMPLE: just grab the first barcode break; // EXAMPLE: do something useful with the barcode data resultText.text = symbol.data; bid.text=symbol.data; // EXAMPLE: do something useful with the barcode image resultImage.image = [info objectForKey: UIImagePickerControllerOriginalImage]; // ADD: dismiss the controller (NB dismiss from the *reader*!) [reader dismissModalViewControllerAnimated: YES]; } 
0
source

All Articles