質問

I am trying to capture still image with 8 mega pixel.I profiled time taken by the camera pipeline to come to the completion handler, On an average iPhone 5S is taking 0.33 second where as iPhone 5 takes less than 0.15 second.Can any body explain this. This is my profiling code.

__block NSDate *TimerAcross = [NSDate date];
    [stillImageOutput captureStillImageAsynchronouslyFromConnection:connection
                                                  completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error)
     {
         DLog(@"handler call  timer = %f", [[NSDate date] timeIntervalSinceDate:TimerAcross]);
    }`

When i try the same code in square cam (apple demo code). I see the time taken by the iPhone 5S is is around 0.6s and lesser than iPhone 5. What is the reason behind this.

My settings are for capturing YUVSP image. `NSMutableDictionary *outputSettings = [NSMutableDictionary dictionaryWithObject:AVVideoCodecJPEG forKey:AVVideoCodecKey];

[outputSettings setValue:@(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) forKey:(id)kCVPixelBufferPixelFormatTypeKey];

NSMutableDictionary *videoOutputSettings = [NSDictionary dictionaryWithObject:@(kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) forKey:(id)kCVPixelBufferPixelFormatTypeKey];

[stillImageOutput setOutputSettings:outputSettings];
[videoDataOutput setVideoSettings:videoOutputSettings];
videoDataOutput.alwaysDiscardsLateVideoFrames = YES;

if([captureSession canAddOutput:stillImageOutput] && [captureSession canAddOutput:videoDataOutput])
{
    [captureSession addOutput:videoDataOutput];
    [captureSession addOutput:stillImageOutput];
    NSLog(@"added output to captureSession");
    return YES;
}
else
{
    NSLog(@"error in adding still image output");
    return NO;
}

}`

役に立ちましたか?

解決

Please share or check your connection's video orientation settings.

If it set to some fixed orientation hardware may take some time to return through call back. Please use the method [connection setVideoOrientation:] set orientation based on your current device orientation and it will be a faster call back.

For more details you may read this Link

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top