i want to take a picture programmatically by the front camera in my iphone app i don't want the user to pick or do any interaction with the image picker .. just want to take the image and save it in the document.. is that possible?
Asked
Active
Viewed 6,299 times
7
-
possible dunplicate of http://stackoverflow.com/questions/5237941/ios-take-picture?lq=1 – Sandeep Singh Jun 22 '16 at 15:39
3 Answers
0
EDIT: My bad, it seems you can actually do that from AVCaptureSession. Though I can't wrap my mind why should this be possible. Seems like a potential ground for abuse to me.
Original (wrong) answer: No, it is not possible to take photos without user interaction, no matter if it's the front or back camera.

Peter Sarnowski
- 11,900
- 5
- 36
- 33
-
You'd think that, but nope. You can grab video frames without the user knowing at all, front or back camera. I think getting a high-res still image from the camera will always trigger the shutter sound. – davehayden Feb 23 '12 at 20:54
-
Hmm, but from what framework? I thought all image capturing frameworks provide UI that user must activate to begin video/still image capture? – Peter Sarnowski Feb 24 '12 at 01:07
-
Check out AVCaptureSession. After setting up the input and output devices and starting the session, you get camera frames in the captureOutput:didOutputSampleBuffer:fromConnection: callback. No UI needed. – davehayden Feb 24 '12 at 03:21
0
try this--
- (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];
}

Pugalmuni
- 9,350
- 8
- 56
- 97

Nishant Mahajan
- 264
- 4
- 9