Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: How to convert a photo into a pencil drawing

I was wondering what the steps would be to convert a photo into a pencil drawing. People usually suggest to:

  1. invert the image (make negative)
  2. apply Gaussian Blur
  3. blend the above images by linear dodge or color dodge.

See here: Convert Image to Pencil Sketch

Are there other methods? I'd be particularly interested in methods which emphasise the stroke of the pencil, like this iPhone App: Snap and Sketch

I'd be very grateful for any suggestions of how to get started.

like image 342
n.evermind Avatar asked Oct 11 '22 04:10

n.evermind


1 Answers

I think you will have to iterate through all the pixels in the image and implement the algorithm you mentioned in the question itself. There is no default image filtering library in iphone (CoreImage is there but only for Mac). I think your options are

  1. A third party library named imageMagic is there, and these people seems to have ported it successfully to iphone. Something to ponder over.
  2. Another simple image filtering library (especially for iphone) does some basic image filtering. Gaussian blur is one of them.
  3. Implement your own methods by going through each pixel in image..This thread is very useful for image filtering seekers in iphone. They are implementing some filters. At least you will get information about how to go through every pixels of an image.

EDIT: Core Image now present in iphone. I did not get a chance to play with it yet. This is the documentation

like image 84
Krishnabhadra Avatar answered Nov 23 '22 00:11

Krishnabhadra