标签: gpuimage

从点阵列中获取矩形

使用GPUImage,我能够检测图像中书籍/页面的角落.但有时,它会超过4个点,在这种情况下,我需要处理并找出这些点中最好的矩形.这是一个例子:

在此输入图像描述

在这种情况下,找出最佳矩形的最有效方法是什么?谢谢

signal-processing image-processing avfoundation ios gpuimage

2
推荐指数
1
解决办法
1572
查看次数

GPUImage动画高斯模糊滤镜

我使用GPUImage高斯模糊滤镜来模糊静止图像.我想将模糊大小与UI元素联系起来,当用户更改元素时,我会模糊图片.我现在正在做的方法是在发生重大(> 0.25)更改时更改blurSize,重新应用过滤器并将新图像设置为imageView动画.

有没有更有效的方式让我这样做?

在iPhone 5上,虽然性能不是很迟钝,但它也不是非常流畅(但也许这是因为这个操作太昂贵而不能超级流畅).

objective-c gpuimage

2
推荐指数
1
解决办法
2680
查看次数

GPUImage显示图像而不是实时视频

我已经浏览了obj-c GPUImage框架,并且根据文档中的示例,我添加了以下代码片段,旨在显示已过滤的实时视频:

    CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame];
    GPUImageVideoCamera *videoCamera = [[GPUImageVideoCamera alloc] initWithSessionPreset:AVCaptureSessionPreset640x480 cameraPosition:AVCaptureDevicePositionBack];
    videoCamera.outputImageOrientation = UIInterfaceOrientationPortrait;

    GPUImageFilter *customFilter = [[GPUImageFilter alloc] initWithFragmentShaderFromFile:@"PositionColor"];
    GPUImageView *filteredVideoView = [[GPUImageView alloc] initWithFrame:mainScreenFrame];

    // Add the view somewhere so it's visible
    [self.view addSubview:filteredVideoView];
    [videoCamera addTarget:customFilter];
    [customFilter addTarget:filteredVideoView];

    [videoCamera startCameraCapture];
Run Code Online (Sandbox Code Playgroud)

它工作,但我得到一个静止图像而不是视频.我已经查看了它并查看了示例,但无法确定它为何无法正常工作.任何帮助将非常感激.

谢谢!

xcode objective-c gpuimage ios7

2
推荐指数
1
解决办法
290
查看次数

GPUImagePicture与GPUImageView目标?

我正在尝试将输出发送GPUImagePicture到a GPUImageView,

这或多或少是我的代码:

GPUImageView *backgroundImageView = [[GPUImageView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIImage *image = [UIImage imageNamed:@"photo"]; //The image is not nil
GPUImagePicture *imageInput = [[GPUImagePicture alloc] initWithImage:image];

[imageInput addTarget:backgroundImageView];
[self.view addSubview:backgroundImageView];
Run Code Online (Sandbox Code Playgroud)

问题是backgroundImageView似乎没有呈现图像......可能会发生什么?

objective-c ios gpuimage

2
推荐指数
1
解决办法
2130
查看次数

值转换问题:隐式转换失去整数精度:'NSInteger'(又名'long')到'int32_t'(又名'int')

我已将我的Xcode版本从5.0升级到5.1并在GPUImage库GPUImageVideoCamera.m中开始出现错误:301:54:隐式转换失去整数精度:'NSInteger'(又名'long')到'int32_t'(又名'int') )

在这行的下面的函数"connection.videoMaxFrameDuration = CMTimeMake(1,_frameRate);" 发生错误.

- (void)setFrameRate:(NSInteger)frameRate;
{

    _frameRate = frameRate;

    if (_frameRate > 0)
    {

        for (AVCaptureConnection *connection in videoOutput.connections)
        {

            if ([connection respondsToSelector:@selector(setVideoMinFrameDuration:)])

                connection.videoMinFrameDuration = CMTimeMake(1, _frameRate);

            if ([connection respondsToSelector:@selector(setVideoMaxFrameDuration:)])

                connection.videoMaxFrameDuration = CMTimeMake(1, _frameRate);

        }
    }

    else

    {
        for (AVCaptureConnection *connection in videoOutput.connections)

        {
            if ([connection respondsToSelector:@selector(setVideoMinFrameDuration:)])

                connection.videoMinFrameDuration = kCMTimeInvalid; 
                                // This sets videoMinFrameDuration back to default

            if ([connection respondsToSelector:@selector(setVideoMaxFrameDuration:)])

                connection.videoMaxFrameDuration = kCMTimeInvalid; 
                                // This sets videoMaxFrameDuration back to default

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

objective-c ios gpuimage xcode5.1

2
推荐指数
1
解决办法
2万
查看次数

AVAssetWriter startWriting状态为3时无法调用方法

我正在使用视频过滤.我使用了BradLarson的 GPUImage.它完美的图像工作,但现在我试图从库过滤视频文件,它给我错误[AVAssetWriter startWriting] Cannot call method when status is 3.我用过IOS7

heare是我的代码

- (void)viewDidLoad
{
    [super viewDidLoad];
    videoEditingPlayView = [[GPUImageView alloc] initWithFrame:CGRectMake(60,108,200,200)];

    [self.view addSubview:videoEditingPlayView];
}

-(IBAction)btnEffectsClick:(id)sender{
     NSURL *videoURl = [NSURL fileURLWithPath:self.strVideoURl];
    if (movieFile != nil) {
        videoFilter = nil;
       movieFile = nil;
     }
movieFile = [[GPUImageMovie alloc] initWithURL:videoURl];
movieFile.runBenchmark = YES;
videoFilter = [[GPUImageBrightnessFilter alloc] init];
[(GPUImageBrightnessFilter *)videoFilter setBrightness:0.0];
[movieFile addTarget:videoFilter];
videoEditingPlayView.hidden = NO;

GPUImageView *filterView = (GPUImageView *)videoEditingPlayView;
[videoFilter addTarget:filterView];

NSString *pathToMovie = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Movie.m4v"];
NSURL *movieURL …
Run Code Online (Sandbox Code Playgroud)

video-processing ios gpuimage

2
推荐指数
1
解决办法
3859
查看次数

"libRestKit.a,文件是为存档而构建的,而不是被链接的架构(armv7)"

我试图用xcodebuild联编建一个项目,但RestKitGPUImage下面是给问题:

ld:警告:忽略文件/project/libGPUImage.a,缺少文件/project/libGPUImage.a中所需的架构armv7(2个切片)

ld:警告:忽略文件/project/libRestKit.a,文件是为存档而构建的,而不是被链接的架构(armv7):/ project/librestKit.a

请帮忙!

xcode xcodebuild ios restkit gpuimage

2
推荐指数
1
解决办法
2816
查看次数

GPU内存崩溃与GPUImage

在过去的3天里我一直在努力解决这个问题,我无法弄清楚为什么/如何解决由于图像过滤导致的内存警告/崩溃.

就是这么简单:用户可以在不同的过滤器之间进行选择,然后保存图片.

我有不同的问题,我设法克服,这是我的最终代码(我删除了一切不重要的).

- (void)viewDidLoad{

// Setting up the filter chain, it's better to do it now to avoid lags 
// if we had done it in the "filter" methods, about 3 sec lag.

    stillImageSource = [[GPUImagePicture alloc]initWithImage:_photo];
    GPUImageBrightnessFilter *soft;
    GPUImageContrastFilter *medium;
    soft = [[GPUImageBrightnessFilter alloc]init];
    medium = [[GPUImageContrastFilter alloc]init];
    soft.brightness = -0.5;
    medium.contrast = 1.6;
}
- (IBAction)mediumFilter:(id)sender {

    [stillImageSource addTarget:medium];
    [medium useNextFrameForImageCapture];
    [stillImageSource processImage];

    //[medium endProcessing];   // Not sure what this does but i've seen it around.

    [self.imgPicture …
Run Code Online (Sandbox Code Playgroud)

memory image image-processing ios gpuimage

2
推荐指数
1
解决办法
2059
查看次数

如何从GPUImageView中删除过滤器

我开发了一个小应用程序GPUImage.我设置了一个过滤器GPUImageView并更改了图像,但是如何删除过滤器以查看真实图像?

android gpuimage

2
推荐指数
1
解决办法
2180
查看次数

iOS AVFoundation和多线程

在Apple的AVFoundation演示的每个示例代码中,所有会话任务都有一个单独的队列.

dispatch_queue_t sessionQueue = dispatch_queue_create("session queue", DISPATCH_QUEUE_SERIAL);
Run Code Online (Sandbox Code Playgroud)

这也用于观察焦点变化,曝光变化,白平衡变化等:

- (void)viewWillAppear:(BOOL)animated
{
     [super viewWillAppear:animated];
     dispatch_async([self sessionQueue], ^{
          [self addObservers];
          [[self session] startRunning];
     });
}

- (void)viewDidDisappear:(BOOL)animated
{
     dispatch_async([self sessionQueue], ^{
          [[self session] stopRunning];
          [self removeObservers];
     });
     [super viewDidDisappear:animated];

}
Run Code Online (Sandbox Code Playgroud)

当我遵循这个时,一切都很顺利,直到我采用'GPUImage',第三方api.我被告知这个api不需要多线程或单独排队,因为它全部都在内部处理.所以我完全取消了'sessionQueue'.

但是,现在我的应用程序运行起来非常不稳定,我认为这是由于主队列被告知处理大多数分支任务.

我可以有一个单独的队列来观察self.videoCamera的变化吗?这会占用mainQueue的大部分负担吗?

multithreading avfoundation grand-central-dispatch ios gpuimage

2
推荐指数
1
解决办法
1670
查看次数