package
{
import flash.display.Sprite;
import flash.media.Camera;
import flash.media.Video;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.utils.ByteArray;
import flash.events.Event;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class VideoProcessing extends Sprite
{
// Camera
private var camera:Camera;
// My Video
private var videoOut:Video;
// My Bitmapdata
private var bmpd:BitmapData;
// Bitmap
private var bmp:Bitmap;
private var timer:Timer;
public function VideoProcessing()
{
trace("Starting");
// Setup the camera
camera = Camera.getCamera();
// Video components
videoOut = new Video();
// Set positions
videoOut.x = 0;
videoOut.y = 0;
// Attach camera to our video
videoOut.attachCamera(camera);
addChild(videoOut);
// Create the bitmapdata object
bmpd = new BitmapData(320,240);
// Create the bitmap image
bmp = new Bitmap(bmpd);
// Add it to the stage
bmp.x = 0;
bmp.y = 240;
addChild(bmp);
// Create timer
timer = new Timer(10,0);
timer.addEventListener(TimerEvent.TIMER, grabFrame);
timer.start();
trace("done starting");
}
private function grabFrame(e:TimerEvent):void
{
//trace("timer");
// Save the frame to the bitmapdata object
bmpd.draw(videoOut);
// Modify the bmpd
//http://itp.nyu.edu/~dbo3/cgi-bin/ClassWiki.cgi?ICMVideo#removeStillBg
for (var row:int=0; row<bmpd.height; row=row+1) { //for each row
for(var col:int=0; col<bmpd.width; col=col+1) { //for each column
//get the color of this pixels
var pix:uint = bmpd.getPixel(col,row);
var red:int = pix >> 16;
var green:int = pix >> 8 & 0xff;
var blue:int = pix & 0xff
if (red > 50 && green > 50 && blue > 50)
{
bmpd.setPixel(col,row,0);
}
}
}
}
}
}
Search
Projects
delicious bookmarks- funf | Open Sensing Framework
- Issue 979 - processing - NullPointerException in AndroidBuild.writeLocalProps(AndroidBuild.java:458) - An open source programming language and environment for creating images, animation, and interactions - Google Project Hosting
- Processing/Android Forum
- IMAP 'server rejected password' error...: Apple Support Communities
- apwidgets - Enables some of Androids widgets for use Android Processing - Google Project Hosting
- Technology and democracy: The future of video protest | The Economist
- NoNoo Ramen: A resounding ‘yes’ - Blog - Buffalo.com
- Oregon Scientific unveils ATC Beats WiFi sports cam and ATC Chaméléon dual-lens camera -- Engadget
- New York University - Faculty Profile: Chris Bregler
- I have been conducting R&D; on non-verbal message transmission by telecom systems. If you are interested in this topic, would you please share your idea and knowledge with me? | LinkedIn
Shared News- Secure me and my video
- What everyone should know about the human eye
- Aquapulse heart rate monitor finally ships, misses out on Michael Phelps fervor
- Happy Birthday NYCwiki
- App Developers Withdraw From U.S. As Patent Fears Reach 'Tipping Point'
- Shaw Cable's Netflix competitor bypasses bandwidth caps on its way to the TV
- software patents as farce
- Mobile Application Checks Brain Waves for Health Control. Really?
- Senators Ask Spy Chief: Are You Tracking Us Through Our iPhones?
- Apps for NYC
Bitcoin Plus Website Miner
What's this?Bitcoin Plus