Using webcam detection to trigger motor

Hello. I don't know if Im on the right section since I've just joined today. However I was wondering if there was any way to use live video feed shot from a webcam to trigger a micro servo motor but at a specific set of coordinates on that video feed where it'll be triggered.

If anyone can also answer if you can add a delay on that too

What Arduino are you going to use?
An Arduino Uno or any ATmega based Arduino is not powerful enough and has not enough memory to handle a video input.

That sort of thing is best done on a Raspberry Pi.

Delays are easy, it is the rest of your problem that is difficult.

What do you mean by:

If you had a pushbutton to "trigger" the servo, and you were looking at the webcam feed, when would you press the button?

A cam can be used to trigger an event upon motion detection.

Downsizing the image say taking every 5th pixel, saving the down sized image, take the next image, downsize it, and compare it to the previous image pixel by pixel for a percentage of allowable deviation. If the pixel value is outside the allowable deviation score the deviation. If the deviation score exceeds an allowable scoring deviation, then movement has occurred. Works really well.

Oh I know how to add delays I'm just saying if there's some special sort of way I'm supposed to add a delay or is it just add it where you want and be done with it.

Also isn't it possible to use the computer to post process the images. I just need the UNO board to trigger it.

I'm trying to have the servo move when something is in the center of the screen

There is always SOMETHING in the center of the screen. I assume you mean some SPECIFIC thing that you don't want to name for some reason.

Not on a Uno. It only has 2K of memory so you don't get many pixels available in that. If that has to be got from a live video source then it either has to be a very small image size or preprocessed to make it smaller before you can transfer it into the UNO.

Most video is sent at 25 to 30 frames per second, and let's say a 650 by 450 resolution. Each pixel takes three bytes, so that is 640 * 450 * 3 bytes to transfer in one 25th of a second.
Work that out and you will see that even if you had that amount of memory to store the data into, you can't transfer data at that sort of rate into an Arduino Uno.

There are ways of scanning in a video stream slowly over multiple frames but that requires external hardware. I did all that in the late 80s so I know exactly what that involves.

However you do not get a very fast frame rate, what sort of response do you need from this project?

If you want to know what is involved this is the circuit you will have to make.

Are you up to making this complexity of circuit? It takes 3.5 seconds to input one frame of video, and it is in monochrome. Taking about 20K of memory to store the frame. The software was designed for the old BBC micro computer, so you would have to write your own for an Arduino. You could even write it so that it only pulled out the part of the frame you were interested in.

I had this published in May 1987 and a second describing how the software worked the month after.

If you are up to making that, then I can post the whole article, but it takes 4.8Mb per page so it won't be here. Possibly for a limited time on Drop Box.

However, I suspect that this might be beyond your current capabilities.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.