Skip to content

Commit

Permalink
Signed-off-by: thomas <diewald@student.tugraz.at>
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas committed Mar 31, 2012
1 parent c8caf0c commit fc001ae
Show file tree
Hide file tree
Showing 91 changed files with 1,054 additions and 243 deletions.
4 changes: 2 additions & 2 deletions README
Expand Up @@ -4,7 +4,7 @@
AUTHOR: Thomas Diewald

Date: 23.04.2011
last edited: 20.10.2011
last edited: 31.03.2012

author: www.thomasdiewald.com
library: http://www.thomasdiewald.com/processing/libraries/dLibs_freenect/
Expand All @@ -23,7 +23,7 @@ PROCESSING / JAVA - Kinect Library - dLibs.freenect
- this library is based on the libfreenect-software (http://openkinect.org)
- it only works on windows Machines (winXP, win7, ... x86, x64)
- i tested it with the following processing versions:
"processing 1.07" to "processing 1.5"
processing 1.07, processing 1.5, processing 2.0a5


--------------------------------------------------------------------------------
Expand Down
Expand Up @@ -2,7 +2,7 @@
//---------------------------------------------
//
// author: thomas diewald
// date: 21.04.2011
// date: 31.03.2012
//
// desc: basic example to get a simple pointcloud from kinect
//
Expand Down
@@ -0,0 +1,107 @@
//---------------------------------------------
//
// author: thomas diewald
// date: 30.03.2012
//
// desc: basic example to get video/depth from a kinect
// modified example, to generate a custom depth map
//---------------------------------------------

import dLibs.freenect.toolbox.*;
import dLibs.freenect.constants.*;
import dLibs.freenect.interfaces.*;
import dLibs.freenect.*;

//-------------------------------------------------------------------
Kinect kinect_;
KinectFrameVideo kinect_video_;
KinectFrameDepth kinect_depth_;

int kinectFrame_size_x = VIDEO_FORMAT._RGB_.getWidth();
int kinectFrame_size_y = VIDEO_FORMAT._RGB_.getHeight();

PImage video_frame_, depth_frame_; // images

// raw depth values of the kinect depth camera ( copy by reference or deep copy)
int[] raw_depth;

//-------------------------------------------------------------------
void setup(){
size(kinectFrame_size_x, kinectFrame_size_y*2);

kinect_ = new Kinect(0);

kinect_video_ = new KinectFrameVideo(VIDEO_FORMAT._RGB_ );
kinect_depth_ = new KinectFrameDepth(DEPTH_FORMAT._11BIT_);
kinect_depth_.setColorMode(2); // no generation of depth-map by default

kinect_video_.setFrameRate(30);
kinect_depth_.setFrameRate(30);

kinect_video_.connect(kinect_);
kinect_depth_.connect(kinect_);

// create a PImage for video/depth
video_frame_ = createImage(VIDEO_FORMAT._RGB_ .getWidth(), VIDEO_FORMAT._RGB_ .getHeight(), RGB);
depth_frame_ = createImage(DEPTH_FORMAT._11BIT_.getWidth(), DEPTH_FORMAT._11BIT_.getHeight(), RGB);

// hint: allocate the arraysize, if the values should be copied for every frame (deep copy)
//raw_depth = new int[depth_frame_.pixels.length];
}




//-------------------------------------------------------------------
void draw(){
println(frameRate);


//---------------------------------------
// DEPTH VALUES
//---------------------------------------
// hint: use System.arraycopy(), if a deep-copy is
// needed! ... uncomment array allocation in setup
// System.arraycopy(kinect_depth_.getRawDepth(), 0, raw_depth, 0, raw_depth.length);
raw_depth = kinect_depth_.getRawDepth(); // just copy by reference

// custom mapping from raw-depth values, to a gray depthmap
depth_frame_.loadPixels();
for (int i = 0; i < raw_depth.length; i++){
// 2047 is the depth-value-"code" for kinect-shadows
if( raw_depth[i] == 2047) {
// set blue color for shadows, ... or any other color
depth_frame_.pixels[i] = 0xFF0000AA;
} else { // valid depth values
// raw depth values have a range of ~330 to ~1150
// and are mapped to a gray-values from 255 to 0
// TODO: custom mapping values
int gray = ((int) map(raw_depth[i], 330, 1150, 255, 0)) & 0xFF ;
depth_frame_.pixels[i] = 0xFF000000 | gray<<16 | gray<<8 | gray<<0 ;
}
}
depth_frame_.updatePixels();



//---------------------------------------
// VIDEO VALUES
//---------------------------------------
// copy rgb-video-pixels to image (by reference!!)
video_frame_.loadPixels();
video_frame_.pixels = kinect_video_.getPixels();
video_frame_.updatePixels();



// display images
image(video_frame_, 0, 0);
image(depth_frame_, 0, DEPTH_FORMAT._11BIT_.getHeight());
}



void dispose(){
Kinect.shutDown();
super.dispose();
}
46 changes: 46 additions & 0 deletions dLibs_freenect/library.properties
@@ -0,0 +1,46 @@
# More on this file here: http://code.google.com/p/processing/wiki/LibraryBasics
# UTF-8 supported.

# The name of your library as you want it formatted
name = dLibs_freenect

# List of authors. Links can be provided using the syntax [author name](url)
authorList = [Thomas Diewald](http://www.thomasdiewald.com)

# A web page for your library, NOT a direct link to where to download it
url = http://thomasdiewald.com/processing/libraries/dLibs_freenect/

# The category of your library, must be one (or many) of the following:
# "3D" "Animation" "Compilations" "Data"
# "Fabrication" "Geometry" "GUI" "Hardware"
# "I/O" "Language" "Math" "Simulation"
# "Sound" "Utilities" "Typography" "Video & Vision"
#
# If a value other than those listed is used, your library will listed as "Other."
category = Video & Vision

# A short sentence (or fragment) to summarize the library's function. This will be
# shown from inside the PDE when the library is being installed. Avoid repeating
# the name of your library here. Also, avoid saying anything redundant like
# mentioning that its a library. This should start with a capitalized letter, and
# end with a period.
sentence = a kinect library based on the libfreenect-software.

# Additional information suitable for the Processing website. The value of
# 'sentence' always will be prepended, so you should start by writing the
# second sentence here. If your library only works on certain operating systems,
# mention it here.
paragraph =

# Links in the 'sentence' and 'paragraph' attributes can be inserted using the
# same syntax as for authors. That is, [here is a link to Processing](http://processing.org/)


# A version number that increments once with each release. This
# is used to compare different versions of the same library, and
# check if an update is available. You should think of it as a
# counter, counting the total number of releases you've had.
version = 12 # This must be parsable as an int

# The version as the user will see it. If blank, the version attribute will be used here
prettyVersion = 2.95 # This is treated as a String
Binary file modified dLibs_freenect/library/dLibs_freenect.jar
Binary file not shown.
Binary file modified dLibs_freenect/library/windows32/freenect.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions dLibs_freenect/reference/allclasses-frame.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:05 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:45 CEST 2012 -->
<TITLE>
All Classes (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
4 changes: 2 additions & 2 deletions dLibs_freenect/reference/allclasses-noframe.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:05 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:45 CEST 2012 -->
<TITLE>
All Classes (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down
6 changes: 3 additions & 3 deletions dLibs_freenect/reference/constant-values.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:05 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:45 CEST 2012 -->
<TITLE>
Constant Field Values (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -139,6 +139,6 @@ <H1>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
6 changes: 3 additions & 3 deletions dLibs_freenect/reference/dLibs/freenect/Kinect.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:04 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
Kinect (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -561,6 +561,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
6 changes: 3 additions & 3 deletions dLibs_freenect/reference/dLibs/freenect/Kinect3D.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:04 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
Kinect3D (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -632,6 +632,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
13 changes: 7 additions & 6 deletions dLibs_freenect/reference/dLibs/freenect/KinectFrameDepth.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:04 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
KinectFrameDepth (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -226,7 +226,7 @@ <H2>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;define the colormode of the depth-frame
0 ... gray depth-map
0 ... gray depth-map<br>
1 ...</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
Expand Down Expand Up @@ -307,8 +307,9 @@ <H2>
public final void <B>setColorMode</B>(int&nbsp;color_mode)</PRE>
<DL>
<DD>define the colormode of the depth-frame
0 ... gray depth-map
1 ... HSB depth-map (chosen by default)
0 ... gray depth-map<br>
1 ... HSB depth-map (chosen by default)<br>
>= 2 ... just the raw depth depth is generated (it's up to the user to make a custom depth-map)
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>color_mode</CODE> - </DL>
Expand Down Expand Up @@ -581,6 +582,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
6 changes: 3 additions & 3 deletions dLibs_freenect/reference/dLibs/freenect/KinectFrameVideo.html
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:04 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
KinectFrameVideo (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -537,6 +537,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:05 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
KinectLed.LedSequence.Iterator (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -305,6 +305,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>
Expand Up @@ -2,12 +2,12 @@
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Wed Oct 19 21:43:05 CEST 2011 -->
<!-- Generated by javadoc (build 1.6.0_24) on Sat Mar 31 13:58:44 CEST 2012 -->
<TITLE>
KinectLed.LedSequence (Javadocs: dLibs_freenect)
</TITLE>

<META NAME="date" CONTENT="2011-10-19">
<META NAME="date" CONTENT="2012-03-31">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

Expand Down Expand Up @@ -419,6 +419,6 @@ <H2>
<!-- ======== END OF BOTTOM NAVBAR ======= -->

<HR>
processing library dLibs_freenect by Thomas Diewald. (c) 2011
Processing library dLibs_freenect by Thomas Diewald. (C) 2012
</BODY>
</HTML>

0 comments on commit fc001ae

Please sign in to comment.