Posts Tagged ‘Flash’

Old fashion Flash trick

Thursday, March 4th, 2010

Illusion of motion

Flash menu examples

Thursday, March 4th, 2010

Menu 1

Menu 2

Menu 3

Flash mouse statistics

Thursday, March 4th, 2010

Collect mouse movement statistics

Flash Mouse Testing

Thursday, March 4th, 2010

Mouse testing 1

Mouse testing 2

Mouse testing 3

Mouse testing 4

Mouse testing 5

Mouse drawing 1

Mouse drawing 2

Flash ActionScript with ARToolKit

Monday, January 12th, 2009

People everywhere are talking about this one using an ActionScript version of ARToolKit with Papervision3D.

You can check out the live version from http://09.aid-dcc.com/.

Open Source Flash Book

Wednesday, July 9th, 2008

There will be a new book on using open source libraries with Flash CS3, The Essential Guide to Open Source Flash Development by Friends of ED.

Flash 8.5 Sound Spectrum Features

Sunday, June 11th, 2006

The Flash 8.5 (ActionScript 3.0 I guess) can have the FFT feature to extract the audio frequency spectrum. It can finally catch up with the asFFT for Director and the Sonia for Processing. A piece of sample code can be found in this http://www.richapps.de/?p=23.

Comparison of image processing tools – 4

Wednesday, May 31st, 2006

The next test is to access each pixel in a bitmap and implement a very simple inverse filter. The image has three channels, red, green and blue and each has a resolution of 8 bits.

Test 1
Flash 8

import flash.display.BitmapData;
var bm:BitmapData = new BitmapData(Stage.width,
   Stage.height, false, 0xFF000000);
var mc1:MovieClip = this.createEmptyMovieClip("mc1",
   this.getNextHighestDepth());
var mc2:MovieClip = this.createEmptyMovieClip("mc2",
   this.getNextHighestDepth());
var ld:MovieClipLoader = new MovieClipLoader();

ld.addListener(this);
ld.loadClip("bear02.jpg", mc1);

function onLoadInit() {
	bm.draw(mc1);
	mc1.removeMovieClip();
	mc2.attachBitmap(bm, 1);
	playColour();
}

function onLoadError() {
	mc1.removeMovieClip();
	trace("load error");
}

function playColour() {
	for (var row:Number = 0; row<bm .height; row++) {
		for (var col:Number = 0; col<bm.width; col++) {
			var c:Number = bm.getPixel32(col, row);
			var r:Number = (c >> 16)& 0xFF;
			var g:Number = (c >> 8)& 0xFF;
			var b:Number = c & 0xFF;
			r = 255-r;
			g = 255-g;
			b = 255-b;
			c = (0xFF << 24)+(r << 16)+(g << 8)+b;
			bm.setPixel32(col, row, c);
		}
	}
}

Test 2
Processing

PImage img;

void setup() {
  size(200, 200);
  background(0);
  img = loadImage("bear02.jpg");
  noLoop();
}

void draw() {
  playColour();
  image(img,0,0);
}

void playColour() {
  for (int row=0; row<height ; row++) {
    for (int col=0; col<width; col++) {
      int n = row*width+col;
      color c = img.pixels[n];
      img.pixels[n] = color(255-red(c),255-green(c),255-blue(c));
    }
  }
  img.updatePixels();
}

Test 3
OpenCV

#include <cv.h>
#include <highgui.h>

int main(int argc, char** argv) {
   IplImage* bm = 0;
   int width, height, step, channel;
	bm = cvLoadImage("bear02.jpg");
	if (!bm) {
		exit(0);
	}
	width = bm->width;
	height = bm->height;
	step = bm->widthStep;
	channel = bm->nChannels;
	cvNamedWindow("win1", CV_WINDOW_AUTOSIZE);
	for (int row=0; row<height ; row++) {
		for (int col=0; col<width; col++) {
			uchar* tmp = &((uchar*)
                          (bm->imageData + row*step))[col*channel];
			tmp[0] = 255 - tmp[0]; // blue
			tmp[1] = 255 - tmp[1]; // green
			tmp[2] = 255 - tmp[2]; // red
		}
	}
	cvShowImage("win1", bm);
	cvWaitKey(0);
	cvReleaseImage(&bm);
	return 0;
}