Motion detection is the process of detecting a change in the position of an object relative to its surroundings or a change in the surroundings relative to an object. Motion detection can be achieved by either mechanical or electronic methods. When motion detection is accomplished by natural organisms, it is called motion perception.
Motion can be detected by:
- Infrared (passive and active sensors)
- Optics (video and camera systems)
- Radio Frequency Energy (radar, microwave and tomographic motion detection)
- Sound (microphones and acoustic sensors)
- Vibration (triboelectric, seismic, and inertia-switch sensors)
- Magnetism (magnetic sensors and magnetometers)
The most basic form of mechanical motion detection is in the form of a switch or trigger. For example, the keys of a typewriter employ a mechanical method of detecting motion. Each key is a manual switch that is either off or on. Each letter that appears is a result of motion on that corresponding key and the switch being turned on.
The principal methods by which motion can be electronically identified are optical detection and acoustic detection. Infrared light or laser technology may be used for optical detection. Motion detection devices, such as PIR motion detectors, have a sensor that detects a disturbance in the infrared spectrum. Once detected, a signal can activate an alarm or a camera that can capture an image or video of the motioner.
The chief applications for such detection are detection of unauthorized entry, detection of cessation of occupancy of an area to extinguish lighting, and detection of a moving object which triggers a camera to record subsequent events.
A simple algorithm for motion detection by a fixed camera compares the current image with a reference image and simply counts the number of different pixels. Since images will naturally differ due to factors such as varying lighting, camera flicker, and CCD dark currents, pre-processing is useful to reduce the number of false positive alarms.
More complex algorithms are necessary to detect motion when the camera itself is moving, or when the motion of a specific object must be detected in a field containing other movement which can be ignored. An example might be a painting surrounded by visitors in an art gallery. For the case of a moving camera, models based on optical flow are used to distinguish between apparent background motion caused by the camera movement and that of independent objects moving in the scene. 
Occupancy sensors for lighting control
Motion sensors are often used in indoor spaces to control electric lighting. If no motion is detected, it is assumed that the space is empty, and thus does not need to be lit. Turning off the lights in such circumstances can save substantial amounts of energy. In lighting practice occupancy sensors are sometime also called "presence sensors" or "vacancy sensors". Some occupancy sensors (e.g. LSG's Pixelview, Philips Lumimotion, Ecoamicatechs Sirius etc.) also classify the number of occupants, their direction of motion, etc., through image processing. Pixelview is a camera-based occupancy sensor, using a camera that is built into each light fixture.
System design and components
Occupancy sensors for lighting control typically use infrared (IR), ultrasonic, tomographic motion detection, microwave sensors, or camera-based sensors (image processing). The field of view of the sensor must be carefully selected/adjusted so that it responds only to motion in the space served by the controlled lighting. For example, an occupancy sensor controlling lights in an office should not detect motion in the corridor outside the office. Tomographic motion detection systems have the unique benefit of detecting motion through walls and obstructions, yet do not trigger as easily from motion on the outside of the detection area like traditional microwave sensors.
Sensors and their placement are never perfect, therefore most systems incorporate a delay time before switching. This delay time is often user-selectable, but a typical default value is 15 minutes. This means that the sensor must detect no motion for the entire delay time before the lights are switched. Most systems switch lights off at the end of the delay time, but more sophisticated systems with dimming technology reduce lighting slowly to a minimum level (or zero) over several minutes, to minimize the potential disruption in adjacent spaces. If lights are off and an occupant re-enters a space, most current systems switch lights back on when motion is detected. However, systems designed to switch lights off automatically with no occupancy, and that require the occupant to switch lights on when they re-enter are gaining in popularity due to their potential for increased energy savings. These savings accrue because in a spaces with access to daylight the occupant may decide on their return that they no longer require supplemental electric light.
Motion detecting devices include:
- Sony Computer Entertainment's PlayStation Move or PlayStation Eye for PS3 and PlayStation Camera for PS4
- Microsoft Corporation's Kinect for Xbox 360, Windows 7, 8, 8.1 or Xbox One
- Nintendo's Wii Remote
- ASUS Eee Stick
- HP's Swing
- "motion detection". Retrieved 26 January 2015.
- Video motion detection (VMD)
- Mechanisms of visual motion
- Bewley, A., Guizilini, V., Ramos, F., & Upcroft, B. (2014). Online Self-Supervised Multi-Instance Segmentation of Dynamic Objects. In International Conference on Robotics and Automation (pp. 1296–1303). Hong Kong, China: IEEE. http://doi.org/10.1109/ICRA.2014.6907020 
- "Technology comparison of Occupancy sensors". Retrieved 19 July 2014.
- Did It Move? Detecting Motion with PIR + Arduino