wysaid / android-gpuimage-plus

Android Image & Camera Filters Based on OpenGL.
MIT License
1.81k stars 475 forks source link

Can I add multiple filters? #238

Open huunhan18pro opened 7 years ago

huunhan18pro commented 7 years ago

Hi Wysaid, Can I apply multiple filters?

Example: Both

  1. "@beautify face 1 640 480"
  2. "@blend mix watermark.jpg 100"
wysaid commented 7 years ago

use “@beautify face 1 640 480 @blend mix watermark.jpg 100”

supportMyScoopApp commented 7 years ago

Thank you a lot.

supportMyScoopApp commented 7 years ago

Hi Wysaid, What filter will apply exactly color of watermark on photo? I use "@blend mix watermark.jpg 100" but look not good.

wysaid commented 7 years ago

try "@blend addrev watermark.jpg 100"

supportMyScoopApp commented 7 years ago

Great. Thank you a lot.

Ashutosh-Tiwari commented 6 years ago

@wysaid Looking at your demo.. I wish to apply multiple filters. Say for example, one from advanced and one from basic for brightness or something. How can I combine and execute them all together in final processing? Also I wish to retain the states of the filters applied to the image. So that the user, if required, can revert application of one of the applied filters. Guidelines?

Ashutosh-Tiwari commented 6 years ago

@NHANNGUYEN92 / @wysaid Can anyone from you guide me on this..??? : I wish to handle the intensities of both type of filters (Basic ones like Brightness, contrast, etc and Advanced one like any color filter ) together on single view (ImageGlSurfaceView from the library).

Looking at the demo, the method for applying advanced filter is setFilterIntensity(float intensity) but method for applying basic filter is like this.. seFilterIntensityForIndex(float intensity, int index). When I tried both using same methodseFilterIntensityForIndex(float intensity, int index) on single config string like @adjust brightness 0.5 @curve*** where index 0 was for @adjust brightness and index 1 was for @curve*** color filter. It simply didn't work. Then I tried both the methods.. in case of advanced filter I called method setFilterIntensity(float intensity) and in case of basic filter I called method but method for applying basic filter is like this.. seFilterIntensityForIndex(float intensity, int index). This time the logic simply misbehaved and the image was just turning into a mess of colors. Please help me on this.

wysaid commented 6 years ago

Hi @Ashutosh-Tiwari The basic ones are the same with advanced ones if you created them by rule strings.

A wrapper is used for intensity adjusting by default(You can cancel this by adding #unpack in front of the rule string). The wrapper will do a mix between the origin and the destination.

for example: @adjust xxx1 @adjust xxx2, this will generate a filter A, and the filter A is a filter wrapper, contains two filters a1 and a2. The filter a1 and a2 are the real filter.

setFilterIntensity is setting the filter wrapper's intensity .

seFilterIntensityForIndex(intensity, index) is setting the real filter's(a1 or a2) intensity.

anu30 commented 6 years ago

Hi Wysaid,

I have used this config: @adjust brightness 0 @adjust contrast 1 @adjust saturation 1 @adjust sharpen 0 @adjust lut aquaholic.jpg Using this config, multiple filters work successfully. But when I save the filtered image, only lut filtered image is saved and not the one with applied brightness/contrast/saturation/sharpen. How to save an image with all the filters?

wysaid commented 6 years ago

@adjust brightness 0 @adjust contrast 1 @adjust saturation 1 @adjust sharpen 0 The rule above did nothing. So only the lut is useful.

anu30 commented 6 years ago

@adjust brightness 0 @adjust contrast 1 @adjust saturation 1 @adjust sharpen 0 this changes brightness, saturation, contrast, sharpen of the lut image. I referred to this link: https://github.com/wysaid/android-gpuimage-plus/blob/master/cgeDemo/src/main/java/org/wysaid/cgeDemo/BasicImageDemoActivity.java

But when I save the final image after changing all these effects together, the image saved is just lut image and with brightness, saturation, contrast, sharpen filters on it.

wysaid commented 6 years ago

You should know, @adjust brightness 0 the brightness value is 0. It's nothing.

wysaid commented 6 years ago

The BasicDemo has a slider to change them

anu30 commented 6 years ago

Even if I pass any other value like @adjust brightness 0.9, then also it doesn't work.

anu30 commented 6 years ago

Even I have a slider to change values for all 4: brightness, saturation, contrast, sharpen. I can see the effects on image when I change the values using onProgressChanged method of seekBar. But that changes are not seen in saved image.

wysaid commented 6 years ago

Maybe you can reproduce your problem in the builtin demo, and give me a fork address. And I'll take a look for that.

anu30 commented 6 years ago

Sure. I will share a demo build with you to have a look.

evichrock commented 6 years ago

Hi @wysaid, "@beautify face 1 640 480", is "640 480" image size?, if it's image size so why we need them ?. Could you recommend me any refs to help me more efficient to explore image filtering concepts and technical? Thanks

wysaid commented 6 years ago

@evichrock The size is not very useful since we can get the image size after image loaded. So you can modify or remove the size, and get the size in the filter.

wysaid commented 6 years ago

I will do this later.

evichrock commented 6 years ago

Hi @wysaid, thanks for replying me. I want to apply only blur or beautify filters only for my face (skin), so I have to custom filters and using face tracker to do that?

wysaid commented 6 years ago

@evichrock
You can try that. Normally we just do a global blur&brighten.