473,322 Members | 1,562 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

need full code for webcam alert motion detector

i have webcam i need to make project when this webcam detect any motion in his spot give me alert ,,,

**** Please Help me in C# code ***
Mar 12 '13 #1
4 5148
r035198x
13,262 8TB
Don't ask for code. Do some research and ask for help with your code.
Mar 12 '13 #2
Expand|Select|Wrap|Line Numbers
  1. private WebCam camera;
  2.  
  3.         private UnmanagedImage x;
  4.  
  5.         public Form1()
  6.         {
  7.             InitializeComponent();
  8.             camera = new WebCam();
  9.         }
  10.  
  11.  
  12.  
  13.         private void pictureBox1_Click(object sender, EventArgs e)
  14.         {
  15.  
  16.         }
  17.  
  18.         private void button1_Click(object sender, EventArgs e)
  19.         {
  20.             if (!camera.IsConnected())
  21.             {
  22.                 camera.Connect();
  23.                 button1.Text = "&Disconnect";
  24.                 backgroundWorker1.RunWorkerAsync();
  25.             }
  26.             else
  27.             {
  28.  
  29.                 backgroundWorker1.CancelAsync();
  30.             }
  31.         }
  32.  
  33.         private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  34.         {
  35.  
  36.             while (!backgroundWorker1.CancellationPending)
  37.             {
  38.  
  39.  
  40.                 camera.Update();
  41.  
  42.  
  43.                 pictureBox1.Image = camera.CalcBitmap();
  44.  
  45.                 pictureBox1.Image = EventArgs.fream;
  46.  
  47.                 //MotionDetector detector = new MotionDetector(
  48.                 //new SimpleBackgroundModelingDetector( ),
  49.                 //new MotionAreaHighlighting( ) );
  50.                 MotionDetector detector = new MotionDetector(new SimpleBackgroundModelingDetector(), new MotionAreaHighlighting());
  51.  
  52.  
  53.  
  54.                 if (detector.ProcessFrame(x) >0.02)
  55.                 {
  56.                     MessageBox.Show("have motion");
  57.                 }
  58.  
  59.  
  60.  
  61.  
  62.             }
  63.         }
  64.  
  65.  
  66.         private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
  67.         {
  68.             camera.Disconnect();
  69.             button1.Text = "&Connect";
  70.         }
  71.  
this my code but i don't know where and how make comper of
currant picture and new picture (thats when camera get motion)

*** sry my English is bad ***
Mar 12 '13 #3
balice
1
I aslo need do this project, can you share code for reference
Sep 21 '13 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ali | last post by:
I am in great need of code that will make a dome. I would like the inputs to be similar to that of the sphere. ie: pos=(x0, y0, z0) radius = R color = (r,g,b) etc. I am using VPython of...
1
by: Cibulya Dmitriy | last post by:
Hi All, I want to catch the next MSSQL error in my SQL code with following continue calculations Server: Msg 17, Level 16, State 1, Line 1 SQL Server does not exist or access denied.
34
by: Mark Kamoski | last post by:
Hi-- Please help. I need a code sample for bubble sort. Thank you. --Mark
2
by: Mark Kamoski | last post by:
Hi Everyone-- Please help. I need a code sample for exchange sort. Thank you. --Mark
0
by: jOs | last post by:
C#B - SHARED SOURCE PROJECT FOR A C# Browser Let's sort this stuff out once and for ALL. =============================================================== Anyone who's having problems in...
1
by: Angus Lepper | last post by:
I'm writing a stock ticker for a stock market simulation, and can load the data into the xmlreader in the first place, but can't figure out how to refresh/update the data in it. Any ideas? Code:...
0
by: saptharishi123 | last post by:
please help me and anyone send vb code to control robot(back, front, right, left) using vb.and also to insert a video window to view video from tv tuner card,and if possible to show the status of...
1
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric...
5
by: raagadeepthi | last post by:
I need to throw an alert saying "Enetered special characters " alert when i click on submit button in javascript. Need code for this Please help!!!!!
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.