我正在尝试使用GPUImage rawInput和rawOutput来做一些自定义的东西,但不知怎的,我的输出被轮换了。
我正在设置我的GPUImageVideoCamera:
self.videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
self.videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
self.videoCamera.runBenchmark = YES;
然后就是这个。
CGSize rawSize = CGSizeMake(640.0, 480.0 );
GPUImageRawDataOutput *rawOutput = [[GPUImageRawDataOutput alloc] initWithImageSize:rawSize resultsInBGRAFormat:YES];
GPUImageRawDataInput __block *rawInput = [[GPUImageRawDataInput alloc] initWithBytes:[rawOutput rawBytesForImage] size:rawSize];;
__weak GPUImageRawDataOutput *weakRawOutput = rawOutput;
[rawOutput setNewFrameAvailableBlock:^{
[weakRawOutput rawBytesForImage];
[rawInput updateDataFromBytes:[weakRawOutput rawBytesForImage] size:rawSize];
[rawInput processData];
}];
当然
[self.videoCamera addTarget:rawOutput];
[rawInput addTarget:self.cameraView];
[self.videoCamera startCameraCapture];
这就是我得到的
https://www.dropbox.com/s/yo19o7ryagk58le/2013-12-05%2018.02.56.png
任何想法如何正确处理这个?
编辑:
我刚刚发现,在rawOutput校正旋转之前放置sepia过滤器,但是grayScale过滤器没有......