3
ビデオにテキストをオーバーレイしようとしていますが、これまでに何も成功していません。GPUImage iOSでテキストオーバーレイが表示されない
videoCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;
cropFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0, 0, 1, 1)];
mCurrentImage = [UIImage imageNamed:@"tex16"];
sourcePicture = [[GPUImagePicture alloc] initWithImage:mCurrentImage smoothlyScaleOutput:NO];
[sourcePicture processImage];
customFilter = [[GPUFilter alloc] initWithFragmentShaderFromFile:@"shader"];
[videoCamera addTarget:cropFilter];
[cropFilter addTarget:customFilter atTextureLocation:0];
[sourcePicture addTarget:customFilter atTextureLocation:1];
[customFilter addTarget:mViewCameraPreview];//(GPUImageView*)mViewCameraPreview];
blendFilter = [[GPUImageAlphaBlendFilter alloc] init];
blendFilter.mix = 1.0;
UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 240.0f, 320.0f)];
timeLabel.font = [UIFont systemFontOfSize:17.0f];
timeLabel.text = @"Time: 0.0 s";
timeLabel.textAlignment = NSTextAlignmentCenter;
timeLabel.backgroundColor = [UIColor clearColor];
timeLabel.textColor = [UIColor whiteColor];
uiElementInput = [[GPUImageUIElement alloc] initWithView:timeLabel];
[customFilter addTarget:blendFilter];
[uiElementInput addTarget:blendFilter];
[blendFilter addTarget:mViewCameraPreview];
[videoCamera startCameraCapture];
すべてが例外をスローせずに実行されますが、見つかるテキストはありません。
誰かが私が間違っているのを見ていますか?
ありがとうございました。
cropFilterが小さすぎます。それは1x1です。 CGRectMake(0,0,1,1)。 – WasimSafdar