Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

ios - 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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...