Skip to content

Commit

Permalink
Merge pull request #14 from jubby/kirk-fix-rawdepthstream
Browse files Browse the repository at this point in the history
Kirk fix rawdepthstream
  • Loading branch information
ThomasLengeling committed Apr 20, 2015
2 parents 002cad2 + 2949b18 commit aa31ee6
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 9 deletions.
16 changes: 16 additions & 0 deletions KinectPV2/Kinect4PV2.jardesc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
<jardesc>
<jar path="Kinect4PV2/library/KinectPV2.jar"/>
<options buildIfNeeded="true" compress="true" descriptionLocation="/Kinect4PV2/Kinect4PV2.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
<selectedProjects/>
<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
<sealing sealJar="false">
<packagesToSeal/>
<packagesToUnSeal/>
</sealing>
</manifest>
<selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
<javaElement handleIdentifier="=Kinect4PV2/src"/>
</selectedElements>
</jardesc>
Binary file modified KinectPV2/library/KinectPV2.dll
Binary file not shown.
Binary file modified KinectPV2/library/KinectPV2.exp
Binary file not shown.
Binary file modified KinectPV2/library/KinectPV2.jar
Binary file not shown.
Binary file modified KinectPV2/library/KinectPV2.lib
Binary file not shown.
Binary file modified KinectPV2/library/KinectPV2.pdb
Binary file not shown.
File renamed without changes.
31 changes: 25 additions & 6 deletions KinectPV2/src/Device.java → KinectPV2/src/KinectPV2/Device.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Device implements Constants, FaceProperties, SkeletonProperties, Ru

private Image colorImg;
private Image depthImg;
private short[] depthDataRaw;
private Image infraredImg;
private Image longExposureImg;
private Image bodyTrackImg;
Expand All @@ -72,14 +73,23 @@ public class Device implements Constants, FaceProperties, SkeletonProperties, Ru
FloatBuffer pointCloudColorPos;
FloatBuffer colorChannelBuffer;

protected boolean runningKinect;
private boolean runningKinect;
public boolean isRunningKinect() {
return runningKinect;
}

protected void setRunningKinect(boolean runningKinect) {
this.runningKinect = runningKinect;
}


private PApplet parent;
private long ptr;

private boolean startSensor;



/**
* Start device
* @param _p PApplet
Expand All @@ -89,6 +99,8 @@ public Device(PApplet _p){
colorImg = new Image(parent, WIDTHColor, HEIGHTColor, PImage.ARGB);
coordinateRGBDepthImg = new Image(parent, WIDTHColor, HEIGHTColor, PImage.ARGB);
depthImg = new Image(parent, WIDTHDepth, HEIGHTDepth, PImage.ALPHA);
depthDataRaw = new short[WIDTHDepth*HEIGHTDepth];

infraredImg = new Image(parent, WIDTHDepth, HEIGHTDepth, PImage.ALPHA);

bodyTrackImg = new Image(parent, WIDTHDepth, HEIGHTDepth, PImage.RGB);
Expand Down Expand Up @@ -141,7 +153,7 @@ protected void initDevice(){
}

if(startSensor){
runningKinect = true;
setRunningKinect(true);
(new Thread(this)).start();
}

Expand Down Expand Up @@ -174,6 +186,13 @@ private void copyDepthImg(int [] rawData){
PApplet.arrayCopy(rawData, 0, depthImg.rawIntData, 0, depthImg.getImgSize());
}

private void copyDepthRawData(short [] rawData){
PApplet.arrayCopy(rawData, 0, depthDataRaw, 0, depthImg.getImgSize());
// depthImg.updatePixels();
// if(depthImg.isProcessRawData())
// PApplet.arrayCopy(rawData, 0, depthImg.rawIntData, 0, depthImg.getImgSize());
}

private void copyDepthMaskImg(int [] rawData){
PApplet.arrayCopy(rawData, 0, depthMaskImg.pixels(), 0, depthMaskImg.getImgSize());
depthMaskImg.updatePixels();
Expand Down Expand Up @@ -413,10 +432,10 @@ public PImage getPointCloudDepthImage() {
/**
* Get Raw Depth Data
* 512 x 424
* @return int []
* @return short []
*/
public int [] getRawDepth(){
return depthImg.rawIntData;
public short [] getRawDepth(){
return depthDataRaw;
}

/**
Expand Down Expand Up @@ -827,7 +846,7 @@ protected void stopDevice(){

public void run() {
//int fr = PApplet.round(1000.0f / parent.frameRate);
while (runningKinect) {
while (isRunningKinect()) {
boolean result = updateDevice();
if(!result){
System.out.println("Error updating Kinect EXIT");
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal

/**
* Commun Face Properties
* @author Thomas Sanchez Lengeling
* @author Thomas Sanchez Lengelinghttp://marketplace.eclipse.org/marketplace-client-intro?mpc_install=27025
*
*/
public interface FaceProperties extends Constants {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public KinectPV2(PApplet _p) {

public void init(){
initDevice();
runningKinect = true;
setRunningKinect(true);
}

public void dispose() {
System.out.println("EXIT");
runningKinect = false;
setRunningKinect(false);
stopDevice();
}

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit aa31ee6

Please sign in to comment.