Is there any filters available in ios to convert a image to cartoonistic image like exactly in the above picture?

- 16,196
- 193
- 68
- 98

- 557
- 1
- 7
- 21
3 Answers
For a much faster solution than ImageMagick, you could use the GPUImageToonFilter from my GPUImage framework:
It combines Sobel edge detection with posterization of the image to give a good cartoon-like feel. As implemented in this framework, it's fast enough to run on realtime video from the iPhone's camera, and is probably at least an order of magnitude faster than something similar in ImageMagick. My framework's also a little easier to integrate with an iOS project than ImageMagick.
If you want more of an abstract look to the image, the GPUImageKuwaharaFilter converts images into an oil painting style, as I show in this answer.

- 1
- 1

- 170,088
- 45
- 397
- 571
-
Brad Larson wow.....Great job man.After implementation ill let u know how it is!thanks u so much dude..:) – Balan Prabhu Apr 06 '12 at 15:06
-
Brad Larson Please check the image in the url, http://lumansupra.files.wordpress.com/2010/05/ori_vs_vec.jpg .can i change like this image using your framework?Please help me dude. – Balan Prabhu Apr 06 '12 at 15:14
-
@BalanPrabhu - What that's doing is converting a raster image into a vector one. That's not an easy effect to produce. The closest I come is the Kuwahara filter, but perhaps one of the posterization filters could be modified to provide cleaner steps between colors. The code is available for all of these filters, and it's easy to write your own custom filters to produce specific effects. – Brad Larson Apr 06 '12 at 20:27
-
Brad Larson Thanks dude for your help. – Balan Prabhu Apr 07 '12 at 10:05
-
Brad Larson I couldnt import GPUImage.h in my project.If i tried to import GPUImage.h ,build failed with the errorcode "GPUimage No such File or Directory"...any idea dude? – Balan Prabhu Apr 07 '12 at 10:41
-
1@BalanPrabhu - Make sure you follow the setup instructions on the main project page. If you're unable to find the GPUImage header, make sure you've set the Header Search Paths to the relative path from your application to the `framework/` subdirectory within the GPUImage source directory, and checked the box to the left of that path to make the header search recursive. Any typos in this path can cause Xcode to not find this header file. – Brad Larson Apr 07 '12 at 15:26
-
Does this only works well for non-human? I tried using CIColorPosterize + CIConvolution3X3 with Sobel edge matrix and the result isn't good. I didn't get the thick line edges that make it cartoon-like. – Lim Thye Chean Aug 20 '14 at 02:36
-
@LimThyeChean - The posterization is done in the same shader program as the edge detection, not in a sequential operation. If you posterize before applying edge detection, you get a mess. You need to edge detect on the original image, which is what my shader above does, and then posterize non-edge pixels. My approach in GPUImage works just as well on humans. – Brad Larson Aug 20 '14 at 04:17
-
@BradLarson It's nice that you contributed this library for everyone who would like to use it. I would like to learn how to do this and understand the process / math behind. Would you please suggest me some reading or the techniques that might be of interests as far as educational purpose is concerned? If you're using C and/or openGL (only a guess here), which methods in these languages could one benefit from by studying them? Thanks in advance. – Unheilig Dec 24 '14 at 22:23
-
1@Unheilig - A great starting point is to examine the shaders and code shipping with the framework for the various operations, and to tinker with those in the context of the framework. The shader code ranges from simple to complex and illustrates various techniques. The rest of the framework aims to abstract away the common busywork of the OpenGL scaffolding required to render a frame to the screen, allowing you to focus on the shaders themselves and the operations they perform. I gave a talk on this all once (Keynote): http://www.sunsetlakesoftware.com/sites/default/files/CCShaderTalk.zip – Brad Larson Dec 24 '14 at 22:33
-
GPUImageSmoothToonFilter & GPUImageToonFilter does not work.(that does not create the above type image).If any other filter than please suggest me..I want to create this type of Image..http://stackoverflow.com/questions/31153805/make-uiimage-to-cartoon-ios – Divyesh Dobariya Jul 06 '15 at 11:53
-
@DivyeshDobariya - It does indeed work (that's exactly how I created the above image). You can see this in the FilterShowcase sample application. If you mean that it does not produce the image you desire, perhaps you could examine how it works and modify it to your specific needs. – Brad Larson Jul 06 '15 at 14:09
-
@BradLarson- Thank you for giving me reply.But if you know what are the filters to be applied for the same image..then please tell me.I am new in iOS development. – Divyesh Dobariya Jul 07 '15 at 06:41
Try to use imagemagick for iOS http://www.imagemagick.org/download/iOS/ Of course you need some serval hours how to use imagemagick for iOS. But then you should also look at: http://www.fmwconcepts.com/imagemagick/cartoon/index.php
and maybe also on: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=11140&start=0&st=0&sk=t&sd=a

- 9,965
- 3
- 48
- 60
-
1Thanks Jonas Schnelli ...Its nice to look but i need more than this.....It would change the image to absolute cartoon,like in some website eg: http://cartoon.pho.to/ – Balan Prabhu Apr 06 '12 at 12:25
This Core Image filter section in the iOS dev library, possibly combined with the script referenced by Jonas and a little luck, might get you where you're going. Not sure, having never used either of these technologies.

- 1,152
- 11
- 23