Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jkwiecien committed Apr 17, 2015
1 parent 49fa8b4 commit 5535bd2
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,49 @@
# android-motion-detection
This is Gradle version of original android-motion-detection library by Justin Wetherell

It's used to detect motion 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
* 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
* Miggrated to Gradle by Jacek Kwiecień


## 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.

#Setup
```
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.jkwiecien:android-motion-detection:1.0.1'
}
```

0 comments on commit 5535bd2

Please sign in to comment.