AForge Motion Detection from PictureBox?
-
Is it possible to detect motion from a picture box? I was looking at AForge for the motion detection class, but because the picture box is not exactly a video source, and currently what I have draws an image when a timer ticks every say 100ms to the box. Could it be possible to detect motion from the picture box? Or convert the realtime images drawn in a picture box to a video source for Realtime processing of motion?
-
Is it possible to detect motion from a picture box? I was looking at AForge for the motion detection class, but because the picture box is not exactly a video source, and currently what I have draws an image when a timer ticks every say 100ms to the box. Could it be possible to detect motion from the picture box? Or convert the realtime images drawn in a picture box to a video source for Realtime processing of motion?
-
"Motion" is when the previous frame (picture) is not the same as the current frame.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
Correct, so in theory it could work since the picturebox is being replaced with a new layer/frame ever second that timer draws a new bitmap image? I have a picture box that draws the recording of my desktop
private void tmrImageUpdate_Tick(object sender, EventArgs e)
{var img = new Bitmap(this.Height, this.Width); var grph = Graphics.FromImage(img); grph.CopyFromScreen((Cursor.Position.X-(pbImageRelay.Height/2)),(Cursor.Position.Y-(pbImageRelay.Width / 2)), 0, 0, img.Size); pbImageRelay.Image = img; } private void Form1\_Load(object sender, EventArgs e) { Rectangle resolution = Screen.PrimaryScreen.Bounds; tmrImageUpdate.Tick += tmrImageUpdate\_Tick; tmrImageUpdate.Enabled = true; tmrImageUpdate.Start(); }
I am trying to detect the motion in say a video player from the desktop, but within the picture box that is viewing on my desktop. Like a picture in a picture on a TV screen, except on PC.
-
Correct, so in theory it could work since the picturebox is being replaced with a new layer/frame ever second that timer draws a new bitmap image? I have a picture box that draws the recording of my desktop
private void tmrImageUpdate_Tick(object sender, EventArgs e)
{var img = new Bitmap(this.Height, this.Width); var grph = Graphics.FromImage(img); grph.CopyFromScreen((Cursor.Position.X-(pbImageRelay.Height/2)),(Cursor.Position.Y-(pbImageRelay.Width / 2)), 0, 0, img.Size); pbImageRelay.Image = img; } private void Form1\_Load(object sender, EventArgs e) { Rectangle resolution = Screen.PrimaryScreen.Bounds; tmrImageUpdate.Tick += tmrImageUpdate\_Tick; tmrImageUpdate.Enabled = true; tmrImageUpdate.Start(); }
I am trying to detect the motion in say a video player from the desktop, but within the picture box that is viewing on my desktop. Like a picture in a picture on a TV screen, except on PC.
Basically, you want "screen copy" the image you just loaded and check that for motion. Something you could accomplish by just focusing on the original images. Okaaay.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
Basically, you want "screen copy" the image you just loaded and check that for motion. Something you could accomplish by just focusing on the original images. Okaaay.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
"Okaaay" like you understand my request? Or "Okaaay" like you're being a pompous-dick right now? I mean, I'll understand if you don't know the answer to the question, it's OK to not know everything. But, if you don't know, save me the ridicule and move on, your forum-troll level of insecurity is not required in this thread. Not everyone who comes in here is on your level, in fact majority of the people that come in here are have some level of knowledge in IT that doesn't equate to your standard of knowledge. That is why I am here, either help or don't help. Had you in fact read the thread, you would know that nothing of a 'still image' was mentioned, after all Videos are just layered images. Since my picturebox is technically showing a video of my desktop, rather than using Video File Writer is it possible to put these layers into a MemoryStream read it from there?
-
"Okaaay" like you understand my request? Or "Okaaay" like you're being a pompous-dick right now? I mean, I'll understand if you don't know the answer to the question, it's OK to not know everything. But, if you don't know, save me the ridicule and move on, your forum-troll level of insecurity is not required in this thread. Not everyone who comes in here is on your level, in fact majority of the people that come in here are have some level of knowledge in IT that doesn't equate to your standard of knowledge. That is why I am here, either help or don't help. Had you in fact read the thread, you would know that nothing of a 'still image' was mentioned, after all Videos are just layered images. Since my picturebox is technically showing a video of my desktop, rather than using Video File Writer is it possible to put these layers into a MemoryStream read it from there?
The "picture box" shows an "image"; i.e. a "still". The "media element" can show "videos"; a series of frames (i.e. more than one "still"). Your picture box is not "technically" showing a video, since by definition, one image does not a video make. Taking screen captures, still amounts to a bunch of "stills". With varying "frame rates".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
-
The "picture box" shows an "image"; i.e. a "still". The "media element" can show "videos"; a series of frames (i.e. more than one "still"). Your picture box is not "technically" showing a video, since by definition, one image does not a video make. Taking screen captures, still amounts to a bunch of "stills". With varying "frame rates".
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
I've found a potential solution in replicating what I am looking for by using Accord VideoFileWrite to write the sequence of frames that bitmap creates, using the PictureBox as a "previewer" to show the height/width of what is being recorded. Is it possible to write VideoFileWrite into a memorystream and use AForges motion detection to read the memorystream or a buffer within the specific moment , rather than the read a file thats been written to the computer. Example Illustration
-
I've found a potential solution in replicating what I am looking for by using Accord VideoFileWrite to write the sequence of frames that bitmap creates, using the PictureBox as a "previewer" to show the height/width of what is being recorded. Is it possible to write VideoFileWrite into a memorystream and use AForges motion detection to read the memorystream or a buffer within the specific moment , rather than the read a file thats been written to the computer. Example Illustration
You would need multiple threads: 1) one to capture and "buffer" 2) another to handle the "stills" (picture box ui thread) from a concurrent queue 3) another to handle the recording (async file writes) A "movie" is about 30 frames per seconds (fps); virtual reality needs to run at least at 90 fps or it causes "motion sickness"; "best" is 120 fps.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food