3 Replies Latest reply on Feb 22, 2007 12:41 PM by funonmars

    Find Edges Filter in Flash AS 3?

    funonmars Level 1
      I've been scrubbing though google trying to get up to speed with AS3, and with a particular job/problem to solve. I need to take a dynamic image, desaturate it, and create the Photoshop effect of the Find Edges filter. Does this seem even vaguely possible? I've got the desaturate part working... no thanks to my own brains.
        • 1. Re: Find Edges Filter in Flash AS 3?
          kglad Adobe Community Professional & MVP
          it's doable in a.s. 2 using the bitmap class.
          • 2. Re: Find Edges Filter in Flash AS 3?
            Level 7
            Since it's possible in AS2 it's certainly possible in 3. Here's a little
            sample that will do vertical edge enhancement... All you need is to import
            a bitmap into the library then give it a linkage id to feed to the
            loadBitmap method. Hopefully, this is enough to get you started.

            If you want to do it the hard way it's easy to write a convolution kernel,
            it just won't be as fast. Google 'Sobel' which is the edge detection
            algorithm used by Photoshop.

            import flash.filters.ConvolutionFilter;
            import flash.display.BitmapData;
            var filter:ConvolutionFilter = new ConvolutionFilter(3, 3,
            var bit:BitmapData = BitmapData.loadBitmap("bitmapLinkageID");
            var mc:MovieClip = this.createEmptyMovieClip("mc",
            bit.applyFilter(bit, bit.rectangle, new Point(0,0), filter);
            mc.attachBitmap(bit, this.getNextHighestDepth());

            Dave -
            Head Developer
            Adobe Community Expert

            • 3. Re: Find Edges Filter in Flash AS 3?
              funonmars Level 1
              Awesome advice, a treat. Thank you very much.

              I put this together, and it strips color, finds edges, and inverts. The only thing I'd still like to know on this is how to make it more high contrast once I've gone through the three filters.

              These filters are so powerful and marvelous! I know the variables on the saturation section aren't needed, but I kept them as I found them.