问题
I'm creating an application for which I need to convert color images to pencil sketches, for example see this.
answer at Implementing Modified Sketch generation in Java gives similar effect but not quite what I want(as shown in the example above). Can someone tell me how to get the desired sketch effect in java?
Also, are there any cookbook type resources/blogs/books/open-source-library which show the java(or any other language) code for various kind of fun looking effects to images?
回答1:
In last couple of days I researched this and was able to get the desired sketch effect using java. I've posted it on my blog.
Pseudocode looks like following..
s = Read-File-Into-Image("/path/to/image")
g = Convert-To-Gray-Scale(s)
i = Invert-Colors(g)
b = Apply-Gaussian-Blur(i)
result = Color-Dodge-Blend-Merge(b,g)
I found following open source code useful...
JH Labs image filters
Processing Programming Language (http://code.google.com/p/processing/)(couldn't make this a hyperlink, it seems I don't have enough reputation to post more than 2 hyperlinks :) )
回答2:
The Java Advanced Imaging library has some demos which shows some basic effects on images.
来源:https://stackoverflow.com/questions/5807539/java-code-to-give-an-image-sketch-effect-and-other-interesting-fun-effects