473,408 Members | 1,960 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,408 software developers and data experts.

Detecting motion in a video

I'm writing a program that tracks a moving objects in a mpeg file. I'm using AForge.net. I'm new to c# and programming. I cannot get to play the video. For right now I want to play the video in a picture box and cature new and old video frame to compare the movements. Here is my code so far that does not work.
Expand|Select|Wrap|Line Numbers
  1. private void pictureBox1_Paint(object sender, PaintEventArgs e)
  2. {
  3. How do I get to play the video in the picture box?? }
  4.  
  5. private void button1_Click(object sender, EventArgs e)
  6. {
  7. videoSource = new FileVideoSource(videoFile);
  8. //videoSource.
  9. //videoSource.NewFrame += new AForge.Video.NewFrameEventHandler(video_NewFrame);
  10. videoSource.Start();
  11.  
  12.  
  13. }
  14.  
  15. private void video_NewFrame(object sender, AForge.Video.NewFrameEventArgs eventArgs)
  16. {
  17. Bitmap bitmap = eventArgs.Frame;
  18. }
  19. private void openToolStripMenuItem_Click(object sender, EventArgs e)
  20. {
  21.  
  22. openFileDialog.Filter = "Video (.mpeg)|*.mpeg|(.avi)|*.avi|ALL Files (*.*)|*.*";
  23.  
  24. if (openFileDialog.ShowDialog() == DialogResult.OK)
  25. {
  26. videoFile = openFileDialog.FileName;
  27.  
  28. }
  29.  
  30. }
  31. Help anyone please:kathsunil 
  32.  
Posts: 1
Joined: Wed Feb 18, 2009 11:56 am
Private message
Feb 22 '09 #1
3 5430
tlhintoq
3,525 Expert 2GB
Keep in mind that a video is a series of still frames. You don't drop a video control onto your dialog and walk away. You have to handle each frame as it comes in. Each time you get a still frame, put that frame in the your picture box. You don't have do override the picturebox's Paint event. Try replacing line 17 with this.

Expand|Select|Wrap|Line Numbers
  1.  pictureBox1.Image = eventArgs.Frame;
Feb 23 '09 #2
Thanks you
you have been very helpful to me. I had invested a lot of time trying to solve that.
Thank you again.
Feb 23 '09 #3
tlhintoq
3,525 Expert 2GB
Glad that worked for you.
Feb 23 '09 #4

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

Similar topics

1
by: untitled | last post by:
i wrote an application in c++ that capture a motion from a bmp sequence and outputs a 3DS max secript file contains the motions keys. i have two points here need to be fixed: 1- it is an offline...
1
by: elribatejano | last post by:
Hi everyone, i'm new at java language. But i've to built a software in java to my final project that can detect motion in live video with ip cameras. Now my questions are, what can i do to...
7
by: David McDivitt | last post by:
On my page I have a div appear, positioned next to the cursor, after dragging and dropping. The div contains radio buttons for what action is to be performed. A person selects which radio button...
2
by: eljainc | last post by:
Hello, I'm looking for some examples of utilities or .NET programming libraries that will allow me to detection motion in a video sequence. I would rather have results that will take AVI files...
8
by: David24 | last post by:
source code: <link removed> comcast wont allow .rar (because they suck) so you have to right-click save page as and rename to .rar. i tested this twice and it works fine. this motion detector has...
4
by: David24 | last post by:
It's on YouTube and the video id is aNTH_8IA0XQ or you can just search for "Motion Tracking Auto Turret" Check it out and let me know what you think.. The Video demonstrates how the Turret will...
1
by: valy | last post by:
hi guys, do y'all have any idea about writing a function to calculate the amount of white pixels on a difference image, and if the white amount is >= the threshold value then the image is count as...
0
by: endy_tj | last post by:
Hi all, I have a window that displays video. The video is shown by using a wrapper provided by the kind folks at http://www.mentalis.org/. The way the wrapper work is by calling MCI API...
1
joedeene
by: joedeene | last post by:
Hello all, I am using Macromedia Flash Professional 8 in this example of a simple way to use motion tweens. Ok here goes... Directions: A. Preparation 1.) Start the Flash program. Once...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.