How feasible is it to use a fixed camera (static image) to track people motion in my home? Next, I will convert this information into x10 events to turn lights on and off. This would allow me to leave the lights on in a room even when there is no motion (with overrides of course; we have to sleep at some point). I want to know the area of the motion so I can make a rough assumption: dog, kid, adult ...
I am a programmer, so I should be able to make something smart enough to learn: when a certain motion happens followed by a manual x10 event, the x10 event should start happening automatically. This should eliminate the need to hook up a computer and draw the room boundaries and tell the computer what is a dog, kid, or adult.
I like this approach because 1 camera can cover a lot of area and would do away with the need for many distance or motion sensors (over entry ways) and piggy back into as a security system. Also, I spend a great deal of time chasing lights in my home. The camera is the low hanging fruit. Later ultrasonic over door ways may cover each room. I can probably calculate which way the object is headed when a door way sensor is triggered.
I have considered carrying a very small disposable (it will get lost) transmitter. That does not seem too feasible as for the cost and difficulty in finding learning material for this. It is tempting, it would be so simple and may cover everything within range (assuming the home has a single floor). In my opinion, the act of keeping up with the transmitter is self-rewarding and still more convent than chasing lights around.
If you believe the camera to be the best approach, maybe there is a still-frame motion project already for this. I see many that are more fancy. I believe I need only an array of objects in motion with an total area calculation. The image processing needs only to keep an average pixel intensity (black and white) and compare new frames to detect sudden changes. An efficient algorithm is needed to group, with a tolerance, the altered pixels into objects.
That sounds very complicated and not remotely Arduino-like.
Have you tried using PIR sensors? In my experience they are very good at detecting people moving within rooms, without any complex image processing needed.
PIR sounds good, but how to I know when the last person left the room? Here is someone who had some success using two PIRs in opposite directions (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1294507270). They had timing problems though. I don't see any way to access the raw PIR levels (though I'm sure your thinking that is complicated - I agree).
The camera has appeal in that some homes (like mine) have a good view of the living room, kitchen, and dining room all with one camera. The complexity falls in the software but make it so simple to install.
It sounds like you might be a programmer, but not a MICROCONTROLLER programmer.
When you make something LEARN, it has to have experience. Experience means a sample set. Lots of experience means a large sample set, and a large sample set means a whole chunka more memory than an Arduino has. You can get sneaky with SD cards, and all sorts of other things, but this still sounds like a job for a more powerful micro or a micro connected to a beefier machine like a server.
Use a computer running openCV to do the video processing. It wouldn't need to be anything special, just a microATX motherboard/CPU combo. You could have multiple tuners with a CCTV-like setup to view each room. Connect the arduino to the computer, and use it to interface with the home automation hardware (to turn lights off an on).
With OpenCV you can set boundries. For instance, you can have it set so anything that is shorter than 3 feet (pets) wont make the lights turn on.
Why do you need to know when someone entered or exited the room? Just detect motion. If someone walks in, there's motion, turn the light on. Once they leave the room, there won't be any motion in the room. Set a timeout in your program that kills the light after a preset time, say 60 seconds. Have a simple override toggle switch for when said person goes to sleep. Change the sensitivity of the sensor so it doesn't pick up pets. Why must it be so complicated (detecting the direction of movement through a doorway)?
brucethehoon - funny, your called it, I program PCs.. I see where your going with the SD card, but that may not be needed (see below).
KirAsh4 - Just detect motion -- I recall something about having to wave ones hand around every so often to keep the lights on. Maybe I'll live with the dog setting off the light and get something with sensitivity. Some false alarms are acceptable. I doubt that it could pick up someone reading a book, or typing away on the keyboard or watching TV. Anyone know about this? Detecting direction through the all entry and exits allows one to keep track of how many people are in the room and therefore know to keep the lights on.
wizdum - I'll keep openCV in mind. I'm still hoping to find something in hardware though to connect to the camera. Maybe it is feasible. For example, the logic could compare two video frames and use summary values about the consecutive pixels that changed (height, highest pixel location). That can go into a table... Maybe I don't need a fancy algorithm. I understand that I will need more than 2K to compare frames. Maybe I should get my proof of concept code going on the PC and wait until the Mega card has a video shield.
jcalfee:
KirAsh4 - Just detect motion -- I recall something about having to wave ones hand around every so often to keep the lights on. Maybe I'll live with the dog setting off the light and get something with sensitivity. Some false alarms are acceptable. I doubt that it could pick up someone reading a book, or typing away on the keyboard or watching TV. Anyone know about this? Detecting direction through the all entry and exits allows one to keep track of how many people are in the room and therefore know to keep the lights on.
Yeah, this is how many buildings are rigged. If everyone is sitting still, the lights go off after a pre-determined timeout (usually something like 5 or 10 minutes.) It keeps things simple, and it works. It doesn't cost you to have someone wave their hand. My office is like that and I rarely have the lights go out while I'm sitting at my desk and working on the computer. There is enough body movement to keep it on.
If you're reading a book, technically you should have movement because you'll be flipping a page every so often, unless you're pressing a button on an e-reader to advance to the next page. Same for sitting and typing, while it might not be able to pick up the finger movements, it could certainly pick up the body movements of that person, unless you sit incredibly still while typing (I don't.) Watching TV gets tricky because yeah, you're not doing anything but being a couch potato ... and potatoes don't move by themselves.
I read this and remembered this Dilbert comic strip from years ago:
Personally I think my wife would be a bit upset if I installed something like this. "Hey, the lounge lights keep going off when I am watching the TV." "Yes dear, you just have to move around a bit."