live from Bangkok!! lol. It’s songkram here, if you don’t want to get wet stay inside and write on your blog.
So I have to detect the location of an item on images for one of my project, I thought of using the LineArt filter to detect high contrast areas, enabling me to pinpoint the exact space on the image (in this case transparent png’s), because they are sometimes not centered.
The code from the LineArt filter comes for a very good book called “Kickass Java Programming” published in 1998. I simply ported to AS3, which was trivial.
First the sample
Secondly, the code for the filter
It is a bit slow right now, taking about .5 seconds to do a 560 x 375 image on my laptop, if somebody knows how to optimize this, I would be soooo grateful!
«Full Source Code»
[…] See the original post here: 04.12AS3 – LineArt Filter – Experiments […]
If you could require FP 10, you could look into using the Pixel Bender stuff. From the Adobe website:
Create high-performance, real-time effects for cinematic experiences that quickly engage users. With new Adobe Pixel Bender™, the same technology behind many filters and effects in Adobe After Effects® software, these dynamic and interactive effects can be used both in production with After Effects CS4 and live with Flash Player 10. The Pixel Bender just-in- time (JIT) compiler can also be used to process other types of data, such as sound or mathematical functions, asynchronously in a separate thread.