我使用蘋果公司製造的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