|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionWhen I did another project, I got this stupid method to implement motion detection. I tried some other way to do this motion detection. And I got frustrated when I use them. Because I don t really need any advanced algorithms to do this one. I was in thinking and got a nice idea to do it. And U also can do it now. Just about 5 lines in Visual C++ .NET code and few lines in Flash Action Script.
Background + PrerequisitesYou should be pre installed the .NET version 1.1 and Flash player 6 or higher for testing this code. They are freely available here. Download .NET 1.1 redistributable package from here. and Flash player http://www.adobe.com/products/flashplayer/ Using the codeThe first message is coming when the application starts. And the others are coming when it detects motion. The camera preview part and the motion detecting part are being actually done by the flash scripts. And finally the Visual C++ .NET application gets the motion via VC COM interface fscommand(); //get the real camera & set the motion level + quality camera = Camera.get(); camera.setMotionLevel(25, 2); camera.setQuality(0,5); //embedded video object myVideoObject.hide(); //get the preview myVideoObject.attachVideo(camera); //call when camera detects a motion camera.onActivity = function(mode) { if (mode) { trace("Kawru hari awa. Camerawa langata."); //get into the Visual C++ fscommand("MOTION_DETECTED", "OK"); } };
when activity happened it gives the feed into the VC++. private: AxInterop::ShockwaveFlashObjects::AxShockwaveFlash* axShockwaveFlash1; String* sFlashPath = System::Environment::CurrentDirectory; String* sCurrentDir = sFlashPath; //set the path of GUI file = new String("\\detector.swf"); sFlashPath = String::Concat(sFlashPath, file); iStartApp = 0; //load Main detector GUI axShockwaveFlash1->LoadMovie(0, sFlashPath); In Visual C++.NET just use the axShockwaveFlash COM interface to load the
Main Flash GUI. Then use Additional Resources
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||