BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.25k stars 4.61k forks source link

Configure GPUImageToonFilter for these cartoon effetcs #241

Closed ayman-melhem closed 12 years ago

ayman-melhem commented 12 years ago

I want to get these cartoon effects by using GPUImageToonFilter from GPUImage framework for ios, but i couldn't find the correct parameter to generate these effects shown the listed links

GPUImageToon Filter: This uses Sobel edge detection to place a black border around objects, and then it quantizes the colors present in the image to give a cartoon-like quality to the image.

texelWidth: texelHeight: These parameters affect the visibility of the detected edges threshold: The sensitivity of the edge detection, with lower values being more sensitive. Ranges from 0.0 to 1.0, with 0.2 as the default quantizationLevels: The number of color levels to represent in the final image. Default is 10.0

here the images link:

https://docs.google.com/open?id=0Bxjx-OJ_OAWDa1drTS1iMmJyeWs

https://docs.google.com/open?id=0Bxjx-OJ_OAWDeHZ4eE1zWFc0Y1k

https://docs.google.com/open?id=0Bxjx-OJ_OAWDeHZ4eE1zWFc0Y1k

ayman-melhem commented 12 years ago

if these effects are generated by another filter please mention these filters and how to configure it's parameters

BradLarson commented 12 years ago

I see you didn't read my comment on your exact same Stack Overflow question:

http://stackoverflow.com/q/11352019/19679

From what I wrote there, neither of these are done using the GPUImageToonFilter. The first is produced using an unsharp mask (GPUImageUnsharpMaskFilter), combined with increased saturation, and the second is due to a bilateral blur (GPUImageBilateralFilter). I'll leave the exact configuration of these filters up to you.

ayman-melhem commented 12 years ago

what do you mean by increased saturation please?

and what about third effect?

BradLarson commented 12 years ago

Color saturation can be adjusted using the GPUImageSaturationFilter. By increasing the input value above 1.0, you can oversaturate the colors of an image.

What third effect? You only link to two images.

ayman-melhem commented 12 years ago

hello ,

thanks a lot for your reply, and this is the third link i told you about

https://docs.google.com/open?id=0Bxjx-OJ_OAWDa1drTS1iMmJyeWs

BradLarson commented 12 years ago

That last one can be done with the GPUImageToonFilter or GPUImageSmoothToonFilter. You just have to play with the parameters.

ayman-melhem commented 12 years ago

thx a lot for your help

ayman-melhem commented 12 years ago

Hello,

I used the filters you suggest for the three effects, and i tried all possible values of the filters parameter, and the result is that i didn't get exact output, i attached a document explain what i did, and this is the document link:

https://docs.google.com/document/d/1_A23DwXSnxPccUYlkPfDLWuBuDahNDVB1CC2UjJ8Bxc/edit

Did I forget some thing, or i need another filter to get the desired output? What do you think? please help

BradLarson commented 12 years ago

Please post the images here, rather than requiring us to go to a Google Docs document. That said, the first and third images look very close to what you want. I can't even see a difference in the third, and the first seems to need just a little more denoising or smoothing.

The second might require a different filter than any that I have here. You're welcome to contribute one to do this.

chiragpipaliya commented 7 years ago

can you show me how you got that cartoon type of effects ?