To Convert Image to Cartoon in ios
Solution 1
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.
Solution 2
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
Solution 3
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.
Balan Prabhu
I'm an IOS Application and Game Developer.Developing 2D games using Cocos2D Framework and Apps using Apple's native Objective C.
Updated on December 27, 2020Comments
-
Balan Prabhu over 3 years
Is there any filters available in ios to convert a image to cartoonistic image like exactly in the above picture?
-
Balan Prabhu about 12 yearsThanks 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: cartoon.pho.to
-
Balan Prabhu about 12 yearsThanks samson ..Ill try and let you know!
-
Balan Prabhu about 12 yearsBrad Larson wow.....Great job man.After implementation ill let u know how it is!thanks u so much dude..:)
-
Balan Prabhu about 12 yearsBrad Larson Please check the image in the url, lumansupra.files.wordpress.com/2010/05/ori_vs_vec.jpg .can i change like this image using your framework?Please help me dude.
-
Brad Larson about 12 years@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.
-
Balan Prabhu about 12 yearsBrad Larson Thanks dude for your help.
-
Balan Prabhu about 12 yearsBrad 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?
-
Brad Larson about 12 years@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. -
Lim Thye Chean over 9 yearsDoes 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.
-
Brad Larson over 9 years@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.
-
Unheilig over 9 years@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.
-
Brad Larson over 9 years@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): sunsetlakesoftware.com/sites/default/files/CCShaderTalk.zip
-
Unheilig over 9 years@BradLarson Thanks so much + Happy holidays.
-
Divyesh Dobariya almost 9 yearsGPUImageSmoothToonFilter & 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..stackoverflow.com/questions/31153805/…
-
Brad Larson almost 9 years@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.
-
Divyesh Dobariya almost 9 years@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.