Reputation:
I use objective-c in Xcode 6.1.1. I am using the camera in my app. Is it possible to get the resolution of the camera programmatically? Can I get the resolution of the camera without letting the user use the camera and when it is open then get the camera resolution? Does Apple uses the full resolution of the camera or is the image down sampled when stored on the device?
Upvotes: 1
Views: 2384
Reputation: 313
To get the supported resolutions, you can use this in Objective-C:
AVCaptureDevice *captureDevice = [self cameraWithPosition:AVCaptureDevicePositionBack];
NSArray* availFormat=captureDevice.formats;
NSLog(@"%@",availFormat);
With:
- (AVCaptureDevice *)cameraWithPosition:(AVCaptureDevicePosition) position
{
NSArray *devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *device in devices) {
if ([device position] == position) {
return device;
}
}
return nil;
}
Upvotes: 4