开发者

Any known solutions for Image Differencing in Actionscript?

开发者 https://www.devze.com 2023-01-27 21:53 出处:网络
I\'m working with a few progra开发者_如何转开发mming buddies to create an AS interface to the kinect and one problem we\'re running into is image differencing.We need to be able to throw out image dat

I'm working with a few progra开发者_如何转开发mming buddies to create an AS interface to the kinect and one problem we're running into is image differencing. We need to be able to throw out image data that doesn't change from image to image so we can pin-point only things that are moving(i.e. people).

Anyone have any experience with this or a direction we can go?


I would consider creating a pixel bender shader to find the difference and also do any other math or tracking. Pixel bender gets its own thread outside of the normal flash player so you can get some more horse power for your setup. Pixel Bender shaders can be applied to bitmaps, vectors, or video so I think it is perfect for this project. Good Luck!

http://www.adobe.com/devnet/flash/articles/pixel_bender_basics.html

And is is a full collection of shaders including difference


Take a look at the threshold method on BitmapData. It'll allow you to do this stuff. Their docs have a simple example so check that out.


It might be a long shot, and this is just me rambling, but in sound theory (strange how I'm relating it to image cancellation, but here goes...) the concept of cancellation is when you take a wave sample and add its inverse. It's how you make acapellas from instrumentals + originals or instrumentals from acapellas + originals.

Perhaps you can invert the new image and "normalize" the two to get your offsets? I.e. the first image is 'black on white' and the second image is 'white on black', and then detect the differences for the bitmap data. I know I did a similar method of finding collisions with AS3 a few years back. This would, in theory, cancel out any 'repeating' pixels and leave you with just the changes from the last frame.

With BitmapData your values are going to be from 0 to 255, so if you can implement a cancellation (because a lot of parts of the image are going to stay the same from frame t frame) then you can easily find the changes from the previous frame.

Just a thought! Whatever your solution is it's going to have to be quick in order to beat the flash runtimes' slow speeds. Your Kinect read FPS rate will be greatly hindered with bad code.


Here is some frame differencing code I wrote awhile back. It uses bitmapData: http://actionsnippet.com/?p=2820

I also used this to capture moving colors in a video feed: http://actionsnippet.com/?p=2736

0

精彩评论

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