开发者

Applying a sketch or brush stroke effect to an image

开发者 https://www.devze.com 2023-04-06 05:43 出处:网络
I already offer a Sepia Effect for images uploaded to a site using something like this: Dim SepiaMatrix As New ColorMatrix(New Single()() {

I already offer a Sepia Effect for images uploaded to a site using something like this:

    Dim SepiaMatrix As New ColorMatrix(New Single()() {
     New Single() {0.493F, 0.349F, 0.272F, 0, 0},
     New Single() {0.769F, 0.686F, 0.534F, 0, 0},
     New Single() {0.289F, 0.168F, 0.131F, 0, 0},
     New Single() {0, 0, 0, 1, 0},
     New Single() {0, 0, 0, 0, 0}})
    ...
    Attributes.SetColorMatrix(SepiaMatrix)
    ...
    Gfx.DrawImage(Image, New Rectangle(0, 0, Image.Width, Image.Height), 0, 0, Image.Width, Image.Height, GraphicsUnit.Pixel, Attributes)

I'd also like to offer a brush and sketch effects [Edit: That is to say that when a photo is uploaded, my app applies filters to the photo in such a way it looks like either brush strokes or crosshatching and "drawn" lines - Exactly like an artists sketch. ]

I've seen This Question but it's not very clear what the solution is and I'd prefer not to have to install a Java IDE and go crawling through the very advanced/flexible Java library mentioned.开发者_如何转开发

Can someone provide a link to a good tutorial (.Net 3.5+ by preference but any language at all will do) or provide me with a basic list of steps I need to apply in order to achieve my goals.

I once found a Wiki with detailed step-by-step image manipulation in PHP but haven't been able to find it since. If anyone knows of it, I believe it had an example of a sketch effect. The site used a predominantly blue image of a planet in space as the test case.

Many thanks for your help.


The aForge project is an open source set of libraries that does imaging filters (alongside many other things). They have a filter for Oil Paint (not exactly what you asked for, but it will be instructive: http://code.google.com/p/aforge/source/browse/trunk/Sources/Imaging/Filters/Other/OilPainting.cs . As well someone has created a PencilSketch filter based on the aForge library, and you can see it's source code here: http://blendfilter.codeplex.com/SourceControl/changeset/view/67619#1218773 .

0

精彩评论

暂无评论...
验证码 换一张
取 消