Webcam fire Flash effect - actionscript-3

Is there any source code available in ActionScript3 that does something like this: http://gskinner.com/blog/archives/2005/11/flash_8_webcam_1.html

http://blog.soulwire.co.uk/code/actionscript-3/webcam-motion-detection-tracking
The link above isn't exactly what you're looking for but similar. You could probably grab the original processing.org IDE which comes with samples, one is a webcam background differencing program, you can probably copy the algorithm from there if you're having trouble coming up with something yourself. Using flash BitmapData methods and tweaking blendModes with a couple of frames can get some interesting stuff going.

Related

Emulating Photoshop color levels in AS3

I'm making an app in which I need to make some photo effects similar to Instagram's effects. I was wondering if it's possible to somehow emulate the work of Photoshop's color levels in AS3.
I've tried using AdjustColor, ColorMatrixFilter and ColorTransform classes but desired image is very hard to achieve using those.
So does anyone have a solution easier than that? or maybe someone knows a library that I couldn't find on Google?
You should have a look at Joa's image processing library.
Have a look on this library:
http://peternitsch.net/bitmapdata.js/
This is actually implemented in Javascript, but it's based on the Flash API. All You need is there. Or i can recommend Foundation ActionScript 3.0 Image Effects by Todd Yard.
Flash API reference is another good resource for inspiration.
There is another good resource for pixel manipulation found here: http://evanw.github.com/webgl-filter/. This is done in WebGL but if your target API is still Flash, then you can easily transposed the GLSL language into Pixelbender and inject the shader
into the Flash by making reference to the pbj file.
Check Grant Skinner's TweenMax plugins, especially ColorMatrixFilter.

Depth map (2d+z) algorithm or software

I'm searching for Depth map algorithm for action scrip 3 (or some other language).
My goal is to generate depth map for static image on run time.
I have fount this example http://kode80.com/2009/06/29/papervision-zbuffer-and-dof/, i didn't have the time to investigate it's code but i have the filling its working only with 3d models.
Worst viable option is server side technology that does the work.
Extended description:
I have a task to develop flash application where 3d rotation of a head is simulated by a 2d image uploaded by the user.
There are some japan guys that have managed to do that (http://hairtry.jp/), but the technology that they are using is server side. It generates swf fail with precisely coped eyes and image for the depth map of the uploaded picture. I can't find out what is the sever side technology that they are using so I'm searching for any posible workarounds.
Thanks in advance.
Cheers,
Chavdar Slavov
your easiest solution would be to use a 3d engine, Paper vision seems to be getting out dated, theres a lot of documents on how to use, and tutorials but again not much has been happening with them lately. i suggest Away3d "www.away3d.com" they seem up to date.
for what your asking it is possible to do this 100% in flash but to create a 3d head at runtime and fill the face with hieght maps this is possible, you would need to look at bitmap manipulation.i dont think this is an easy task, what you should learn first is how to add an image to a spheric surface dynamically than look into height mapping by converting certain coulours from the image into different levels of depth i must say im sure this is advanced stuff, i manged to animate a globe that was this same method it looks dodgy but it gives you some source code in the FLA
http://www.ffiles.com/flash/animations/globe_animation_3496.html
The above link will allow you to download my source files, the animation it self is a scrolling image but i used Actionscript to give the globe depth and a sheric look

Html5 Canvas animations

I am looking to get into learning how to use the html5 canvas to do animations as well as other things. I have an excellent knowledge of javascript and programming in general (mostly php but can adapt to anything). However, I have not had the opportunity to do much with graphics in the past. I have created nice smooth animations using javascript/jquery but the canvas object seems to be alot more than just that. The hardest part I am finding as I have been playing with it is that you have no reference to an object on the stage unless you store the reference. For example if I create a div on the page I have that reference to the object. However, with the canvas object if you create something within it, it draws that element on the stage giving you no reference to it. So you have to manually store the details of that object as I understand it and I could be wrong (if I am please correct me).
Anyways the whole point of this post is to see if anyone can point me to some really good articles/help about working with the canvas object. Not just drawing graphics to it cause I have been able to accomplish that very easily. But I would like to articles/help on managing the objects on the canvas. I want to make sure that I am doing this correctly/efficiently for the future of the technology. Also I am willing to purchase a book on working with html5 canvas/graphics/animations but most of them that I have seen go over the whole scope of html5 and leave out alot of the details of actually working with the canvas. So if you know any good books with my requirements please recommend them here.
Any help is appreciated.
There are nice libraries to do very basic to complex graphics using HTML5/WebGL
This may not actually teach you how the animations work. But if you are interested, check Three.js
https://github.com/mrdoob/three.js/
Read article "Creating a Framework For Canvas: Objects and Mouse". Not animation, but you can find there something interestring.
Read source code of any big framework, e.h. three.js, or LibCanvas
Read "HTML5 Canvas - Native Interactivity and Animation for the Web"

Any known solutions for Image Differencing in Actionscript?

I'm working with a few programming 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

simple music or tunes via HTML?

I'm looking for a simple way to put up musical "tunes" on a website.
So here's an analogy to explain my question:
Let's say I want to put up a couple of big triangles as a picture on my web page. I can either draw a bitmap and save as GIF/JPG/PNG, put it up somewhere on the internet, and link to it with an element. That works but the larger the picture the more space my image file takes up.
Alternatively, I can use SVG (even though Internet Explorer support is lacking, grr) and use vector graphics which uses very little bandwidth regardless of image size.
In the music world, I can use WAV or MP3 files. Works great -- but if I just want to publish a 1-minute song of simple notes, by knowing the durations & pitches, & don't care that it sounds 100% exactly like a piano or accordion, is there a way to (a) create a file with the song, and (b) put it online in a format that is space-efficient? 1 minute of MP3 usually takes up hundreds of kilobytes.
You could use a MIDI file, this stores durations/pitches etc. as you suggest. You should be able to easily find software to create this type of file. However you will probably find the results sound terrible, as it is very dependent on the synthesiser hardware/software that is available on the end-user's machine.
For what you need this might be reasonable though.
Look into playing music files on websites using Flash.
You can control the Flash through JavaScript calls.
This is currently the "recommended" way to play small audio clips in a website.
For larger media files, look into streaming FLV files using a Flash player.
Hope this helps :)
Check out the MIDI format for instruments.
http://en.wikipedia.org/wiki/MIDI