标签: gpuimage

将GPUImage过滤器应用于UIView

我有一个问题.我需要应用一个类似于Pixelate or Blur整个过滤器UIView.喜欢的eBay iPad应用程序.

我想用,GPUImage但我不知道怎么做.有一种方法可以GPUImageView直接应用过滤器而不通过a UIImage?

主要问题是UIView在iPad3日制作大型屏幕截图是昂贵的(UIWindow抓取时间为2秒).因此,完美的解决方案是直接将过滤器应用于视图,就像eBay应用程序一样,但是......如何?

谢谢大家!

filter effect ios gpuimage

4
推荐指数
1
解决办法
4882
查看次数

在电影文件上使用GPUImageLookupFilter会产生黑屏

我正在将代码从静态图像应用程序移动到生成电影文件的应用程序.但是,以下代码存在问题,其中最终输出是使用GPUImageLookupFilter过滤器的黑色电影屏幕.任何人都可以发现我做错了什么或我可能错过了什么.

Header File Sample
GPUImagePicture *lookupImageSource;
GPUImageOutput<GPUImageInput> *filter;
GPUImageMovie *movieFile;
GPUImageMovieWriter *movieWriter;
@property(nonatomic,strong) GPUImagePicture *lookupImageSource;



Main File
filter = [[GPUImageFilterGroup alloc] init];

            self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage imageNamed:@"ExtremeVintage1.png"]];

            GPUImageLookupFilter * filterLookup = [[GPUImageLookupFilter alloc] init];

            [self.lookupImageSource addTarget:filterLookup];

            [self.lookupImageSource processImage];

            [(GPUImageFilterGroup *)filter addFilter:filterLookup];



            [(GPUImageFilterGroup *)filter setInitialFilters:[NSArray arrayWithObject:filterLookup]];
            [(GPUImageFilterGroup *)filter setTerminalFilter:filterLookup];


            [movieFile addTarget:filter];
Run Code Online (Sandbox Code Playgroud)

谢谢

****更新*****

新代码

self.lookupImageSource = [[GPUImagePicture alloc] initWithImage:[UIImage    imageNamed:@"ExtremeVintage1.png"]];
            [self.lookupImageSource processImage];

            filter = [[GPUImageLookupFilter alloc] init];
            [lookupImageSource addTarget:filter];

            [movieFile addTarget:filter];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

ios gpuimage

4
推荐指数
1
解决办法
827
查看次数

UITableViewCell contentView背景的快速模糊

我已经做了一个UIViewController符合UITableViewDataSource和UITableViewDelegate协议,并有一个UITableViewas的子视图.

我已将backgroundView表的属性设置为a UIImageView,以便将图像显示为表的背景.

为了在单元格之间有自定义间距,我使行高度大于我想要的,并将单元格的contentView自定义为我想要的大小,使其看起来有额外的空间(遵循此SO答案).

我想为单元格添加模糊,以便背景模糊,我通过Brad Larson的GPUImage框架完成了这项工作.然而,这工作正常,因为我希望背景模糊在滚动时更新,滚动变得非常迟缓.

我的代码是:

//Gets called from the -scrollViewDidScroll:(UIScrollView *)scrollView method
- (void)updateViewBG
{
    UIImage *superviewImage = [self snapshotOfSuperview:self.tableView];

    UIImage* newBG = [self applyTint:self.tintColour image:[filter imageByFilteringImage:superviewImage]];

    self.layer.contents = (id)newBG.CGImage;
    self.layer.contentsScale = newBG.scale;
}

//Code to create an image from the area behind the 'blurred cell'
- (UIImage *)snapshotOfSuperview:(UIView *)superview
{
    CGFloat scale = 0.5;
    if (([UIScreen mainScreen].scale > 1 || self.contentMode == …
Run Code Online (Sandbox Code Playgroud)

performance image objective-c ios gpuimage

4
推荐指数
1
解决办法
3489
查看次数

GPUImageMovieWriter - 录制视频两端偶尔会出现黑框

我有录制应用程序实现,用户可以点击"录制"按钮开始/停止录制.我有一个基本的实现这一目标GPUImageVideoCamera具有输出设置为一个GPUImageView,以及一个GPUImageMovieWriter.

50%的时间,录制的剪辑最终会在两端都有一对(或单个)黑框,有时两者都是.实现相当简单,但无论如何都是这样.

gpuImageView = [[GPUImageView alloc] initWithFrame:cameraView.frame];
gpuImageView.fillMode = kGPUImageFillModePreserveAspectRatioAndFill;

[cameraView addSubview:gpuImageView];

videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPresetHigh cameraPosition:(usingBackCamera) ? AVCaptureDevicePositionBack : AVCaptureDevicePositionFront];

[videoCamera addTarget:gpuImageView];
[videoCamera addTarget:movieWriter];
videoCamera.audioEncodingTarget = movieWriter;
[videoCamera startCameraCapture];

double delayToStartRecording = 0.5;
dispatch_time_t startTime = dispatch_time(DISPATCH_TIME_NOW, delayToStartRecording * NSEC_PER_SEC);
        dispatch_after(startTime, dispatch_get_main_queue(), ^(void){
            NSLog(@"Start recording");
            [movieWriter startRecording];
        });
Run Code Online (Sandbox Code Playgroud)

然后使用以下内容停止录制(同时现场摄像机继续显示GPUImageView.

[movieWriter finishRecording];
Run Code Online (Sandbox Code Playgroud)

有没有其他人经历过这个和/或找到了避免黑框的解决方案?我无法暂停/恢复摄像头捕获,以确保无缝的用户体验.

avfoundation video-recording ios gpuimage

4
推荐指数
1
解决办法
912
查看次数

'GPUImageOutput <GPUImageInput>'没有可见的@interface声明选择器'imageFromCurrentlyProcessedOutputWithOrientation:'

我负责一段时间以前在我公司创建的旧项目,现在我必须使用XCode 5.1进行一些更改

问题是,即使它在一年前(2013年春天)编译好了,它现在也没有编译.该项目包含GPUImage库子项目.这是XCode产生的错误:

'GPUImageOutput <GPUImageInput>'没有可见的@interface声明选择器'imageFromCurrentlyProcessedOutputWithOrientation:'

当我尝试编译这两行时:

if( self.grayScaleOutput )
{
    photo = [grayscaleFilter imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp];
}
else
{
    photo = [blendFilter imageFromCurrentlyProcessedOutputWithOrientation:UIImageOrientationUp];
}
Run Code Online (Sandbox Code Playgroud)

我甚至让Xcode 5.1更改了我的项目的一些设置(它建议我这样做),但没有运气.任何提示?我需要激活的任何设置?一些ARC的苦难可能仍然存在于我的旧代码行中?

注意:我已经用我刚刚从GitHUB下载的那个库替换了我正在使用的1年历史的GPUImage库.也没有运气.

cocoa-touch compiler-errors objective-c ios gpuimage

4
推荐指数
1
解决办法
2920
查看次数

应用过滤器时GPUImageMovie暂停

我正在使用Brad Larson的伟大库GPUImage来处理我的应用程序.目前我遇到了一个问题.我的应用程序捕获10秒视频,之后允许filter应用.在申请filters时GPUImageMovie,我无法暂停播放并应用新filter视频,以便视频可以连续播放而无需从头开始播放.

我在这里看到了一个开放的github问题.如果有人遇到类似问题并找到解决方案,请发布您的答案.提前致谢.

video ios gpuimage

4
推荐指数
1
解决办法
2448
查看次数

GPUImageMovie不尊重imageOrientation

我正在使用正在播放电影文件的GPUImageMovie,这个文件是在iOS设备上录制的.

但是,当GPUImageMovie播放时,它的方向错误,因此视频不会旋转以便正确显示.

我如何让它尊重它的方向?我试过没有运气修改OpenGL代码.

ios gpuimage

4
推荐指数
1
解决办法
631
查看次数

在GPUImage中应用视频过滤器时播放音频

我用谷歌搜索了这个问题,但没有找到任何解决方案.

所以,我的问题是,我正在将视频滤镜GPUImage应用于视频文件.同时,该视频的声音没有播放.我知道在GPUImage应用过滤器时不支持声音播放.

那么,我该如何实现呢?

audio avfoundation ios gpuimage

4
推荐指数
1
解决办法
1322
查看次数

GPUImage - 点击和曝光无法正常工作 - 缺少某些东西?

我有一个用于AVFoundation设置相机的启动项目,它工作得很好.现在我需要将Camera机制转换为GPUImage.我在两个项目中都使用了相同的焦点和曝光方法(在项目中工作得很好AVFoundation),但在GPUImage项目中它没有正确聚焦而且总是错误的.

不介意应用过滤器,它们在所有过滤器上都是相同的

示例: 在屏幕的右上角,您可以看到羊羔.这就是它如何聚焦+曝光.

在此输入图像描述

设置GPU:

stillCamera = GPUImageStillCamera(sessionPreset: AVCaptureSessionPreset640x480, cameraPosition: .Front)
    CorrectPosition =  AVCaptureDevicePosition.Front
    stillCamera!.outputImageOrientation = .Portrait;
    stillCamera?.horizontallyMirrorFrontFacingCamera = true
    filter = GPUImageFilter()
    stillCamera?.addTarget(filter)
    filter?.addTarget(self.view as! GPUImageView)
    (self.view as! GPUImageView).fillMode = GPUImageFillModeType.init(2)
Run Code Online (Sandbox Code Playgroud)

TouchBegan方法:

   override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
        var tap : CGPoint!
        if let touch = touches.first as UITouch! {
            tap = touch.locationInView(self.view)
        }
        let device: AVCaptureDevice! = self.stillCamera?.inputCamera!
        var error: NSError? = nil
        do {
            try device.lockForConfiguration()
            if …
Run Code Online (Sandbox Code Playgroud)

focus ios avcapturedevice gpuimage gpuimagestillcamera

4
推荐指数
1
解决办法
1025
查看次数

如何使用Swift语法在GPUImage2中将两个图像混合在一起

我熟悉以下语法在GPUImage2中使用Swift语法中的这种方式进行单个图像过滤:

input --> blur --> output
Run Code Online (Sandbox Code Playgroud)

但是如何使用需要两个图像的图像处理操作?GPUImage2中的一个示例显示您可以执行此操作:

input --> self.lookup1 --> self.alphaBlend --> self.lookup2 --> output
          self.lookup1 --> self.gaussianBlur --> self.alphaBlend
Run Code Online (Sandbox Code Playgroud)

self.lookup1和self.lookup2是2个不同的图像.但我不确定这种语法,在这种情况下,第二个图像是否应该在alphaBlend过滤器之后?

image-processing ios gpuimage swift

4
推荐指数
1
解决办法
940
查看次数