나는 AVCaptureVideoDataOutput
와 함께 일하고 있으며 CMSampleBufferRef
을 UIImage
으로 변환하고 싶습니다. 많은 답변이 UIImage created from CMSampleBufferRef not displayed in UIImageView? 및 AVCaptureSession with multiple previewsYUV 색상 공간으로 CMSampleBufferRef를 UIImage로 변환 하시겠습니까?
내가 BGRA에 VideoDataOutput 색 공간을 설정하면 그것은 잘 작동 위 videoSettings없이
NSString* key = (NSString*)kCVPixelBufferPixelFormatTypeKey;
NSNumber* value = [NSNumber numberWithUnsignedInt:kCVPixelFormatType_32BGRA];
NSDictionary* videoSettings = [NSDictionary dictionaryWithObject:value forKey:key];
[dataOutput setVideoSettings:videoSettings];
(이 답변 CGBitmapContextCreateImage error 적립)처럼, 동일, 나는을 받게됩니다 BGRA에 YUV (기본 AVCaptureSession 색 공간)에서 변환 오버 헤드가 있기 때문에 브래드과 코도 난에 의해 명시된 바와 같이 다음과 같은 오류가 BGRA 작업
CGBitmapContextCreate: invalid data bytes/row: should be at least 2560 for 8 integer bits/component, 3 components, kCGImageAlphaPremultipliedFirst.
<Error>: CGBitmapContextCreateImage: invalid context 0x0
은 좋은 선택이 아니다 n How to get the Y component from CMSampleBuffer resulted from the AVCaptureSession?
그래서 CMSampleBufferRef
을 UIImage
으로 변환하고 YUV 색 공간으로 작업하는 방법이 있습니까?
이에 대한 모든 솔루션으로 설정되어있는 경우
UIImage
에CMSampleBufferRef
를 변환하는 코드를 공유 그래서? –@AdarshVC 더 눈에 잘 띄게하기 위해 질문에 투표하지 않으시겠습니까? – onmyway133
이 질문을 확인하십시오 http://stackoverflow.com/questions/3305862/uiimage-created-from-cmsamplebufferref-not-displayed-in-uiimageview –