Add dynamic text GPUImage

432 views Asked by At

I'm trying to add text to the video stream using GPUImage, however no text is showing. My filters are all working great however I can't seem to chain my text filter into the correct order. I want the text to be under my custom filter so the custom filter is having an effect on the text.

    videoCamera = [[GPUImageStillCamera alloc] initWithSessionPreset:AVCaptureSessionPresetMedium cameraPosition:AVCaptureDevicePositionBack];
videoCamera.outputImageOrientation = UIInterfaceOrientationLandscapeRight;

cropFilter = [[GPUImageCropFilter alloc] initWithCropRegion:CGRectMake(0, 0, 1, 1)];
mCurrentImage = [NPFilterBuilder getTextureOverlay];
sourcePicture = [[GPUImagePicture alloc] initWithImage:mCurrentImage smoothlyScaleOutput:NO];
[sourcePicture processImage];

customFilter = [NPFilterBuilder getFilter];
[videoCamera addTarget:cropFilter];
[cropFilter addTarget:customFilter atTextureLocation:0];
[sourcePicture addTarget:customFilter atTextureLocation:1];

[customFilter addTarget:mViewCameraPreview];

[videoCamera startCameraCapture];
1

There are 1 answers

0
Muhammad Naeem Paracha On

Try to update element, may be it will help you.

__unsafe_unretained GPUImageUIElement *weakUIElementInput = uiElementInput;
[filter setFrameProcessingCompletionBlock:^(GPUImageOutput * filter, CMTime frameTime){
[weakUIElementInput update];
}];