我想根據GPUImage示例中的FilterShowcase應用程序使用GPUImageChromaKeyFilter,但顯然我缺少一些東西,因爲它崩潰。GPUImageAlphaBlendFilter - 不完整的篩選器FBO:36054
這裏是我的代碼:
videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
GPUImageChromaKeyFilter *filter = [[GPUImageChromaKeyFilter alloc] init];
[filter setColorToReplaceRed:0.0 green:1.0 blue:0.0];
[filter prepareForImageCapture];
videoView = [[GPUImageView alloc] initWithFrame:CGRectMake(0, 0, 640, 480)];
[self.view addSubview:videoView];
UIImage *inputImage = [UIImage imageNamed:@"bedroom.jpeg"];
GPUImagePicture *sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePicture processImage];
[sourcePicture addTarget:filter];
[sourcePicture removeTarget:filter];
[videoCamera removeTarget:filter];
[videoCamera addTarget:filter];
GPUImageAlphaBlendFilter *blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;
[sourcePicture addTarget:blendFilter];
[filter addTarget:blendFilter];
[blendFilter addTarget:videoView];
[videoCamera startCameraCapture];
當我運行它,它只是告訴這個:
2013年6月24日15:24:45.369 GPUImage測試[1284:1703] *斷言故障 在 - [GPUImageAlphaBlendFilter createFilterFBOofSize:], /用戶/你好/桌面/ xcode中/ GPUImage測試/ GPUImage /框架/來源/ GPUImageFilter.m:369
2013年6月24日15:24:45.383 GPUImage試驗[1284:1703] *終止應用程序 由於未捕獲的異常 'NSInternalInconsistencyException',原因: '不完全濾波器FBO:36054'
*首先扔調用堆棧:
(0x3134f3e7 0x391d9963 0x3134f29d 0x31c25fa3 0xc9563 0xd608d 0xc8b3d 0xc9885 0xdaa63 0xcc11f 0xdb39f 0xca07b 0xcc153 0xd266f 0xd2dbb 0xd3f35 0x395f3793 0x395f6b3b 0x395f467d 0x395f7613 0x395f77d9 0x3961b7f1 0x3961b684)
的libC++ abi.dylib:終止叫做拋出異常
有誰看到我做錯了什麼?
在此先感謝。
看起來像問題可能是該過濾器設置爲混合過濾器的來源 – rezand