我使用苹果公司制造的AVCam作为我的自定义相机视图。老实说,如果你第一次看到它,那么就不要简单地理解课程AVCamViewController
中发生了什么。AVCam保存全屏捕获的图像
现在我很感兴趣,他们如何设置捕获图像的帧。我试图找到一些名人或类似的东西,但我还没有找到任何东西。
我在谷歌搜索,发现这里的答案AVCam not in fullscreen
但是,当我实施了解决方案,我才意识到,这只是做直播摄像头预览层具有相同的大小作为我的观点,但是当应用程序的方法保存图像图片中的- (IBAction)snapStillImage:(id)sender
图片仍然是左右两条条纹。
我的问题是如何删除此条纹或在源代码中的哪一行苹果设置这个东西?
此外,作为附加的子问题,我如何设置类型创建照片,因为应用程序要求我“麦克风设置”,我不需要它只是需要照片,就是这样。
来自苹果的这段代码将图片保存到照片库。
- (IBAction)snapStillImage:(id)sender
{
dispatch_async([self sessionQueue], ^{
// Update the orientation on the still image output video connection before capturing.
[[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] setVideoOrientation:[[(AVCaptureVideoPreviewLayer *)[[self previewView] layer] connection] videoOrientation]];
// Flash set to Auto for Still Capture
[AVCamViewController setFlashMode:AVCaptureFlashModeAuto forDevice:[[self videoDeviceInput] device]];
// Capture a still image.
[[self stillImageOutput] captureStillImageAsynchronouslyFromConnection:[[self stillImageOutput] connectionWithMediaType:AVMediaTypeVideo] completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) {
if (imageDataSampleBuffer)
{
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer];
UIImage *image = [[UIImage alloc] initWithData:imageData];
UIImage *proccessingImage = [SAPAdjustImageHelper adjustImage:image];
NSNumber *email_id = [SAPCoreDataEmailHelper currentEmailId];
[SAPFileManagerHelper addImage:proccessingImage toFolderWithEmailId:email_id];
}
}];
});
}
请,根据添加代码或截图预览... – hmdeep 2014-09-05 11:49:30
我的经验,它的做工精细的iPhone5的,但问题是,只在iPhone 4,右??? – hmdeep 2014-09-05 11:56:14
您可以在此处下载代码https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html,如上所述。我没有修改任何 – 2014-09-05 11:57:26