Assignment 1:
Intruder Detection based on Kinect 3D Point Clouds
...that sounds big for a first assignment
--- but: don't panic!
Overview:
As many of you might know, Microsoft came
out with a device for the XBOX to control games by human gestures. The device
is called Kinect. Kinect is a 3D camera, which means it creates a 3D view of the
environment, rather than a colored 2D picture (which a normal web cam creates).
Kinect represents its environment as a 3D point cloud, which is a set of 3D
(x,y,z) points representing sample points on the surfaces of the environment.
It looks like this:
What you see here is a chair and a shelve
in an office space. Every single dot you see is has depth information, i.e. the
computer knows how far away it is.
With such a camera, intruder detection is
simple: if something comes close to the camera, ring the alarm. We will design
our system a bit more robust. What we will do is to compute the average
distance of all the data points. If that average is below a certain value, ring
the alarm. Again: don't panic yet. A lot of help will be given to you.
First: the data. I will give you a file
that contains a series of 3D images. Look at this MOVIE (CLICK HERE) to see what the
data looks like. You see, an intruder is entering the office space (it's me).
What we want to create is shown in the
second MOVIE (CLICK HERE) : when
the intruder is in the office, show the background in an alarming red.
Second: the help. You will be given the
entire framework of the project, i.e. the routines to load and display the
data, even the code to put it all together. Only one thing is missing: the
routine to compute the average distance.
Your Task:
Compute the average distance between a
point-set to the camera.
That sounds easier than programming the
entire project, I hope. The point set will be given as a 2D array, storing each
point as x,y,z. For example, if the array is named DATA, then the third point
would have the coordinates
x = DATA[2][0], y = DATA[2][1], z = DATA[2][2]
.
The Euclidean distance to a point x,y,z is
defined by Math.sqrt(x*x+y*y+z*z).
The average of all distances is the sum of
all distances divided by the number of points.
Your Task in Detail:
Get the netbeans project here. It has all
source code, and the data. Unzip it, and run the project. You should see a
frame showing the same as the first movie.
The main file to look at is the class
"Assignment01". Its main loop reads the data, analyzes it and
displays it. That's the framework, you don't need to change anything there.
The method to change is the method "
public double computeAverageDistance(int[][] data)". Its
current implementation always returns 10000, which is plain stupid.
Implement your code
in this method's body! In short: program
the average distance formula in this method, return the result.
A hint for testing: the average distances
of the different images are in the range between about 1800 and 3500. As you
can see in the main loop, I set the background to red when the average distance
is below 2500.0 .
What should you
learn in this assignment?
·
Not to panic when
it comes to projects that sound overwhelming at first.
·
To break down the
task into the necessary steps: install netbeans, get acquainted with netbeans,
download the project, run it and see, look at the code, change it, done.
·
To work with
netbeans
·
To see that JAVA
can do a lot more than printing lines of text
·
To deal with 2D
arrays
·
To ask the TA and
me for help.
Ok, here's
the netbeans project. Now:
·
Download it.
·
Unzip it.
·
Open Netbeans.
·
In netbeans: open
the unzipped project
·
Make this project
the main project (right click, make main project)
·
Run it. You should
see the frame.
·
Change the
average... method in class Assignment01.
·
Enjoy!
·
And don't panic.