gpuimage

Ios rotate, filter video stream in ios

亡梦爱人 提交于 2019-12-07 07:20:48
问题 Hello There I am rotating and applying image filters by GPUImage on vide live stream The task is consuming more time than expected resulting over-heating of iPhone Can anybody help me out in optimising my code Following is my used code: - (void)willOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer{ //return if invalid sample buffer if (!CMSampleBufferIsValid(sampleBuffer)) { return; } //Get CG Image from sample buffer CGImageRef cgImageFromBuffer = [self cgImageFromSampleBuffer:sampleBuffer]

GPUImage imageFromCurrentFramebuffer returning nil sometimes for GPUImageLookupFilter and it's subclasses

无人久伴 提交于 2019-12-07 06:59:38
问题 I have been using GPUImage for my project and I am getting into this problem where imageFromCurrentFramebuffer returns nil for some of the GPUImageLookupFilter's . I subclassed GPUImageFilterGroup like in the GPUImageAmatorkaFilter my code is as follows: -(MTLookupFilter *) initWithLookupImageName:(NSString *) lookupImageName { self = [super init]; if (self) { UIImage *image = [UIImage imageNamed:lookupImageName]; self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:image];

Blending using GPUImagePoissonBlendFilter

陌路散爱 提交于 2019-12-06 23:33:30
问题 Im trying to use GPUImagePoissonBlendFilter of the GPUImage framework to blend two faces in my face blending application. Here is my code. - (void)applyPoissonBlendToImage:(UIImage *) rearFace withImage:(UIImage *) frontFace { GPUImagePicture* picture1 = [[GPUImagePicture alloc] initWithImage:rearFace]; GPUImagePicture* picture2 = [[GPUImagePicture alloc] initWithImage:frontFace]; GPUImagePoissonBlendFilter * poissonFilter = [[GPUImagePoissonBlendFilter alloc] init]; poissonFilter.mix = .7;

Unable to edit video using GPUImage

做~自己de王妃 提交于 2019-12-06 21:23:29
I have created video using AVFoundation and now I want to edit it via GPUImage framework. I have set all the setting as per mention here . After seeing his example of "SimpleVideoFileFilter" I have just copied his code and replace my Assets URL for Video. Here is the code. movieFile = [[GPUImageMovie alloc] initWithURL:player.contentURL]; pixellateFilter = [[GPUImagePixellateFilter alloc] init]; [movieFile addTarget:pixellateFilter]; NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"]; unlink([pathToMovie UTF8String]); NSURL *movieURL = [NSURL

How To Apply GPUImage filters efficiently?

爱⌒轻易说出口 提交于 2019-12-06 21:12:04
In my project, I apply colors to an image then after a second I am applying a Kuwahara filter to it, for watercolor effect, but the thing is it takes time to apply the filter and if I change the colors too much the app eventually crashes due to memory issues. Can anyone help me how to use the filter in the best manner. Thanks CODE @objc func fillColorButtonTapped(_ sender : UIButton){ self.processingModel.isImageMixedColor = false if let popoverController = self.mkColorPicker.popoverPresentationController{ popoverController.delegate = self.mkColorPicker popoverController

GPUImageMovie not playing video file when initWithPlayerItem

99封情书 提交于 2019-12-06 15:37:21
I am using GPUImageMovie with initWithPlayerItem and its not starting the movie file on startProcessing. It was working fine with initWithUrl but I need playback controls for the player as told in this thread. I am using the following code -(void)loadVideo { _playerItem = [[AVPlayerItem alloc]initWithURL:movieURL]; _player = [AVPlayer playerWithPlayerItem:_playerItem]; movieFile = [[GPUImageMovie alloc] initWithPlayerItem:_playerItem]; movieFile.runBenchmark = YES; movieFile.playAtActualSpeed = YES; filter = [[TSFilter alloc] init]; _movieView = [[GPUImageView alloc] initWithFrame:self.view

No audio in video recording (using GPUImage) after initializing The Amazing Audio Engine

走远了吗. 提交于 2019-12-06 14:38:33
I'm using two third party tools in my project. One is "The Amazing Audio Engine" . I use this for audio filters. The other is GPUImage, or more specifically, GPUImageMovieWriter . When I record videos, I merge an audio recording with the video. This works fine. However, sometimes I do not use The Amazing Audio Engine and just record a normal video using GPUImageMovieWriter. The problem is, even just after initializing The Amazing Audio Engine, the video has only a fraction of a second of audio at the beginning, and then the audio is gone. + (STAudioManager *)sharedManager { static

GPUImage group filters

∥☆過路亽.° 提交于 2019-12-06 14:38:22
问题 I am trying to implement brightness,contrast and exposure filters in a single view same as you see in iPhoto app. I have tried to put up group filter for doing the same. But it shows up a white screen instead of modified picture. Here is the code I applied. GPUImageFilterGroup *groupFilter = [[GPUImageFilterGroup alloc]init]; GPUImageBrightnessFilter *brightnessFilter = [[GPUImageBrightnessFilter alloc]init]; [brightnessFilter setBrightness:brightnessValue]; GPUImageContrastFilter

GPUImage学习总结

此生再无相见时 提交于 2019-12-06 14:16:15
GPUImage是iOS上一个基于OpenGL进行图像处理的开源框架,内置大量滤镜,架构灵活,可以在其基础上很轻松地实现各种图像处理功能。 GPUImgae特性 1,丰富的输入组件 摄像头、图片、视频、OpenGL纹理、二进制数据、UIElement(UIView, CALayer) 2,大量现成的内置滤镜(4大类) 1). 颜色类(亮度、色度、饱和度、对比度、曲线、白平衡...) 2). 图像类(仿射变换、裁剪、高斯模糊、毛玻璃效果...) 3). 颜色混合类(差异混合、alpha混合、遮罩混合...) 4). 效果类(像素化、素描效果、压花效果、球形玻璃效果...) 3,丰富的输出组件 UIView、视频文件、GPU纹理、二进制数据 4,灵活的滤镜链 滤镜效果之间可以相互串联、并联,调用管理相当灵活。 5,接口易用 滤镜和OpenGL资源的创建及使用都做了统一的封装,简单易用,并且内置了一个cache模块实现了framebuffer的复用。 6,线程管理 OpenGLContext不是多线程安全的,GPUImage创建了专门的contextQueue,所有的滤镜都会扔到统一的线程中处理。 7,轻松实现自定义滤镜效果 继承GPUImageFilter自动获得上面全部特性,无需关注上下文的环境搭建,专注于效果的核心算法实现即可。 滤镜基本原理

GPUImage displaying image instead of live video

只愿长相守 提交于 2019-12-06 13:15:52
I've gone through the obj-c GPUImage framework, and as per the example in the documentation, I added the following snippet with intention to display filtered live video: CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame]; GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack]; videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait; GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"PositionColor"]; GPUImageView