https://github.com/phishman3579/android-motion-detection
Android code to detection motion by comparing two images.
https://github.com/phishman3579/android-motion-detection
android java motion-detection
Last synced: 6 months ago
JSON representation
Android code to detection motion by comparing two images.
- Host: GitHub
- URL: https://github.com/phishman3579/android-motion-detection
- Owner: phishman3579
- License: apache-2.0
- Created: 2013-11-20T02:58:49.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-12-09T15:05:10.000Z (almost 10 years ago)
- Last Synced: 2025-03-28T22:25:32.614Z (6 months ago)
- Topics: android, java, motion-detection
- Language: HTML
- Size: 124 KB
- Stars: 101
- Watchers: 15
- Forks: 46
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
android-motion-detection
========================Android code to detection motion from by comparing two pictures.
## Introduction
Android code to detection motion from by comparing two pictures. It comes with an Activity that initializes a camera and grabs two pictures and compares them.
* Created by Justin Wetherell
* For questions use: http://groups.google.com/forum/#!forum/android-motion-detection
* Google: http://code.google.com/p/android-motion-detection
* Github: http://github.com/phishman3579/android-motion-detection
* LinkedIn: http://www.linkedin.com/in/phishman3579
* E-mail: phishman3579@gmail.com
* Twitter: http://twitter.com/phishman3579## Support me with a donation
## Details
You essentially have to override an onPreviewFrame(byte[] data, Camera cam) method and convert from the default YUV to RGB:
int[] rgb = ImageProcessing.decodeYUV420SPtoRGB(data, width, height);
Create an object which you'll use for motion detection code:
IMotionDetection detector = new RgbMotionDetection();
Call the detect() method passing in the parameters obtained above.
boolean detected = detector.detect(rgb, width, height)
If the boolean "detected" variable is true then it has detected motion.
The RGB detection code is located in RgbMotionDetection.java class. The image processing code is located in ImageProcessing.java static class. The Activity to tie it all together is in MotionDetectionActivity.java.
I have created a MotionDetection class that detects motion comparing RGB values called RgbMotionDetection.java, a class that detects motion comparing Luminance values called LumaMotionDetection.java, and a class that detects motion comparing avergae Luminance values in regions called AggregateLumaMotionDetection.java.