dmitric / DLCImagePickerController

ImagePickerController with live filters, radial blur and more. Brought to you by Backspaces.

Home Page:www.backspac.es

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lookup filters instead of ACV filters

alexperri7 opened this issue · comments

I was wondering if it is possible to get the lookup filters working properly? They work on their own, but when you add the blur over it the image just goes black. The reason I want to use the lookup filters is that they allow more creative control over the kind of look I'm going for and anytime I made my own ACV filters and replaced yours or simply added them, they didn't work.

Any help would be greatly appreciated, and keep up the good work. I think you've got a great project here and I, as well as I'm sure many other people, am very thankful for everything you're doing.

ACVs allow you to play around in Photoshop and are more useful than those lookup filters. If you don't like using ACVs or are unsure how to create them, you can just change the code the work with lookups because this project is open source. I'm not doing anything with them here.

Hi @alexperri7. Use the GPUImageRGBFilter just as a is for FilterGroup purposes so you can override the problem. This doesn't affect your original filter (in this case Amatorka). Here is my code to help you:

case 4: {
    filter = [[GPUImageFilterGroup alloc] init];

    GPUImageAmatorkaFilter *amatorkaFilter = [[GPUImageAmatorkaFilter alloc] init];
    [(GPUImageFilterGroup *)filter addFilter:amatorkaFilter];

    GPUImageRGBFilter *rgbFilter = [[GPUImageRGBFilter alloc] init];
    [(GPUImageFilterGroup *)filter addFilter:rgbFilter];

    [amatorkaFilter addTarget:rgbFilter];

    [(GPUImageFilterGroup *)filter setInitialFilters:[NSArray arrayWithObject:amatorkaFilter]];
    [(GPUImageFilterGroup *)filter setTerminalFilter:rgbFilter];
} break;

If you get memory issues, make your photocapturebutton your FirstResponder under viewDidAppear. Hope it helps.

Interested to know how the first responder helps with low memory

@dmitric Actually the error I got was "wait_fences: failed to receive reply: 10004003", which I presume is related to memory issues, in my still learning stage of Objective-C, so I went to Instruments and it seems the photocapturebutton was causing it.

@dpestana nope it has to do with animations occurring when not on screen.

@dpestana Thanks for your code. It works great. But if I have the group filters on with live preview and then toggle blur, the screen turn out to be black. It works with static image, but seems filterGroup can't work with blur filter quite good on live preview.

btw, I reproduced it on 4S and iPod Touch 5 with iOS 6. Looks like it is a common problem.

@dmitric Thanks for the tip once again. Never would have figured out that one. @luosky , glad I could help. Indeed, I also have problems with the blur filter, so I removed it untilI figure out a way to improve it or eventually use a vignette instead of blur. If you by any chances know how to use the GPUImageOverlayBlendFilter in a FilterGroup please share it. I can't seem to understand how to use the blend filters.

EDITED: Nevermind. I got the Blend Filters to work.

@dpestana thanks for the help! I too am having the issue with the blur (that's what my original question was about). If I choose one of those lookup filters, it applies it to the image properly but the second I do a blur over that filter, the image goes black. I'd really like to know how to use them together.

@luosky @dpestana @alexperri7 I'm also having this problem. My images also turn out black once applying a blur over the filtered image. I find it a lot easier to create lookup filters with much better results, so hopefully someone can tell us how this works.

Hi everyone. I'm not using the Blur Filter. I removed it. But I'm trying to implement the same thing using a vignette. If I'm able to make it work I'll let you know.

@dpestana Having any luck? I'm still trying with the blur over here but not having much luck. I'm able to apply a lookup filter, but when I toggle the blur on is when the trouble starts. First, the blur turns on and the image goes black, but after tapping on the filter again both the filter and the blur are working. The same thing happens when turning the blur off. Image goes black and upon tapping the filter again the image reappears with only the filter on.

Hi @alexperri7 I haven't tried the blur. I removed all the code for blur, it's not an effect I want the users to take control. Instead I'm going to try Vignette and Borders. I believe the problem might be related to the Blur effect, because I used it on one of my custom group filters (in a chain of filters) and although I can see the blur on the live preview, when I take the picture the blur just vanishes. It might also be related to the order of the filters. I'm targeting the blur just like you, as the last effect on the chain, so maybe it will work by placing it on another place of the chain. I still have no idea, because I really haven't been giving that top priority.

Hi @alexperri7 . I have now tried to use the Blur and I had exactly the same problem you did and some other problems too. It seems that when you toggle the Blur all targets are removed. Meaning, there must be a string like [self removeAllTargets] which is not properly placed. I gave up using the Blur because it doesn't work with 2448 * 2448 photos. It only works great on 640 * 640 photos. Every other size crashes (at least with me). I tried the new code @dmitric posted and the Blur works great with his code, but with @dmitric code I can't take full resolution pictures, and that's very important for what I'm doing. Hope it helped. Best.