├── .classpath ├── .gitignore ├── .project ├── .settings └── org.eclipse.jdt.core.prefs ├── MANIFEST.MF ├── README.md ├── Run_AugmentedRealityDemo.bat ├── Run_ImageAvatarDemo.bat ├── Run_KinectViewerDemo.bat ├── Run_MultipleKinectDemo.bat ├── Run_SimpleDemo.bat ├── Run_VideoViewerDemo.bat ├── Run_XEDConvertDemo.bat ├── box.png ├── data ├── avatars │ ├── obama │ │ ├── avatar.xml │ │ ├── left_arm.png │ │ ├── left_forearm.png │ │ ├── leg.png │ │ ├── right_arm.png │ │ ├── right_forearm.png │ │ ├── thigh.png │ │ └── torso.png │ └── romney │ │ ├── avatar.xml │ │ ├── left_arm.png │ │ ├── left_forearm.png │ │ ├── leg.png │ │ ├── right_arm.png │ │ ├── right_forearm.png │ │ ├── thigh.png │ │ └── torso.png ├── box.png └── xray.png ├── j4k-examples.jar ├── j4k-examples.zip ├── lib ├── gluegen-rt-natives-windows-amd64.jar ├── gluegen-rt-natives-windows-i586.jar ├── gluegen-rt.jar ├── j4k-natives-windows-amd64.jar ├── j4k-natives-windows-i586.jar ├── j4k2-natives-windows-amd64.jar ├── j4k2-natives-windows-i586.jar ├── jogl-all-natives-windows-amd64.jar ├── jogl-all-natives-windows-i586.jar ├── jogl-all.jar └── ufdw.jar ├── src └── j4kdemo │ ├── augmentedrealityapp │ ├── AugmentedRealityApp.java │ ├── AugmentedRealityApplet.java │ ├── Kinect.java │ └── ViewerPanel3D.java │ ├── imageavatarapp │ ├── CardboardAvatar.java │ ├── ImageAvatarApp.java │ ├── ImageAvatarApplet.java │ ├── Kinect.java │ └── ViewerPanel3D.java │ ├── kinectviewerapp │ ├── Kinect.java │ ├── KinectViewerApp.java │ ├── KinectViewerApplet.java │ └── ViewerPanel3D.java │ ├── multiplekinectapp │ ├── Kinect.java │ ├── MultipleKinectApp.java │ └── MultipleKinectApplet.java │ ├── simpleexample │ └── SimpleExample.java │ ├── videoviewerapp │ ├── Kinect.java │ ├── VideoPanel.java │ ├── VideoViewerApp.java │ └── VideoViewerApplet.java │ └── xedconvertapp │ ├── FileCompressor.java │ ├── KinectFileWriter.java │ ├── KinectRecorder.java │ ├── VideoData.java │ ├── XEDConvertApp.java │ └── XEDConvertApplet.java ├── ufdw_j4k2_32bit.dll ├── ufdw_j4k2_64bit.dll ├── ufdw_j4k_32bit.dll └── ufdw_j4k_64bit.dll /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | bin -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | j4kDemo 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Sun Sep 26 15:04:25 EDT 2010 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.6 13 | -------------------------------------------------------------------------------- /MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Permissions: all-permissions 3 | Class-Path: lib/ufdw.jar lib/jogl-all.jar lib/gluegen-rt.jar 4 | Main-Class: j4kdemo.kinectviewerapp.KinectViewerApp 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | java-for-kinect 2 | =============== 3 | 4 | The J4K library is an open source Java library that implements a Java binding (wrapper) 5 | for the Microsoft's Kinect SDK. You can use it to create your own Java applications that 6 | handle the video, depth, and skeleton streams of the Kinect sensor. Furthermore, the 7 | J4K library contains several Java classes that convert the packed depth frames, skeleton 8 | frames, and video frames received by a Kinect sensor into easy-to-use Java objects. There 9 | are also convenient methods to save the data in open file formats such as VRML. 10 | 11 | When this program is used for academic or research purposes, 12 | please cite the following article that introduced this Java library: 13 | 14 | A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 15 | and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 16 | October 2013, Vol. 43(5), Pages: 1347-1356. 17 | Link 1: [https://doi.org/10.1109/TCYB.2013.2276430](https://doi.org/10.1109/TCYB.2013.2276430) 18 | Link 2: [https://abarmpou.github.io/angelos/publications.html](https://abarmpou.github.io/angelos/publications.html) 19 | 20 | ---------------------------------------------------- 21 | The web-site of this project: 22 | [http://abarmpou.github.io/ufdw/j4k/](https://abarmpou.github.io/ufdw/j4k/) 23 | 24 | Source code examples: 25 | [http://abarmpou.github.io/ufdw/j4k/examples.html](https://abarmpou.github.io/ufdw/j4k/examples.html) 26 | 27 | How to write a Java-Kinect project in less than 10 lines of Java code: 28 | [http://abarmpou.github.io/ufdw/j4k/examples.html#how](https://abarmpou.github.io/ufdw/j4k/examples.html#how) 29 | 30 | How to develop Kinect applications in Java / OpenGL / Eclipse: 31 | http://www.youtube.com/watch?v=q0K4Y4g-hj0 32 | 33 | How to install this project in Eclipse: 34 | [http://abarmpou.github.io/ufdw/j4k/eclipse.html](https://abarmpou.github.io/ufdw/j4k/eclipse.html) 35 | 36 | 37 | ---------------------------------------------------- 38 | Copyright 2011, Digital Worlds Institute, University of Florida, Angelos Barmpoutis. 39 | All rights reserved. 40 | 41 | Redistribution and use in source and binary forms, with or without 42 | modification, are permitted provided that the following conditions are 43 | met: 44 | * Redistributions of source code must retain this copyright 45 | notice, this list of conditions and the following disclaimer. 46 | * Redistributions in binary form must reproduce this 47 | copyright notice, this list of conditions and the following disclaimer 48 | in the documentation and/or other materials provided with the 49 | distribution. 50 | * When this program is used for academic or research purposes, 51 | please cite the following article that introduced this Java library: 52 | A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 53 | and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 54 | October 2013, Vol. 43(5), Pages: 1347-1356. 55 | 56 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 57 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 58 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 59 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 60 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 61 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 62 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 63 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 64 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 65 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 66 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 67 | -------------------------------------------------------------------------------- /Run_AugmentedRealityDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.augmentedrealityapp.AugmentedRealityApp -------------------------------------------------------------------------------- /Run_ImageAvatarDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.imageavatarapp.ImageAvatarApp -------------------------------------------------------------------------------- /Run_KinectViewerDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.kinectviewerapp.KinectViewerApp -------------------------------------------------------------------------------- /Run_MultipleKinectDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.multiplekinectapp.MultipleKinectApp -------------------------------------------------------------------------------- /Run_SimpleDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.simpleexample.SimpleExample -------------------------------------------------------------------------------- /Run_VideoViewerDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.videoviewerapp.VideoViewerApp -------------------------------------------------------------------------------- /Run_XEDConvertDemo.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | java -cp j4k-examples.jar j4kdemo.xedconvertapp.XEDConvertApp -------------------------------------------------------------------------------- /box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/box.png -------------------------------------------------------------------------------- /data/avatars/obama/avatar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -1.1649844644523455E-8 4 | 0.17038945853710175 5 | -1.4050725383185636E-7 6 | 0.17150671780109406 7 | 0.1695677638053894 8 | 5.059100089965796E-7 9 | -0.17150674760341644 10 | 0.1712111532688141 11 | -7.869245450820017E-7 12 | 1.1649844644523455E-8 13 | -0.17038945853710175 14 | 1.4050725383185636E-7 15 | 0.07375872880220413 16 | -0.2504594624042511 17 | -0.0010226547019556165 18 | -0.0792931541800499 19 | -0.24472740292549133 20 | -0.012209468521177769 21 | 0.6709562 22 | 0.29762086 23 | 0.26884565 24 | 0.28274325 25 | 0.26318 26 | 0.50691843 27 | 0.37688586 28 | 0.50082505 29 | 0.38099045 30 | torso.png 31 | 0.8 32 | left_arm.png 33 | 0.5 34 | left_forearm.png 35 | 0.6 36 | right_arm.png 37 | 0.5 38 | right_forearm.png 39 | 0.6 40 | thigh.png 41 | 0.5 42 | leg.png 43 | 0.6 44 | thigh.png 45 | 0.5 46 | leg.png 47 | 0.6 48 | 49 | -------------------------------------------------------------------------------- /data/avatars/obama/left_arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/left_arm.png -------------------------------------------------------------------------------- /data/avatars/obama/left_forearm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/left_forearm.png -------------------------------------------------------------------------------- /data/avatars/obama/leg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/leg.png -------------------------------------------------------------------------------- /data/avatars/obama/right_arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/right_arm.png -------------------------------------------------------------------------------- /data/avatars/obama/right_forearm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/right_forearm.png -------------------------------------------------------------------------------- /data/avatars/obama/thigh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/thigh.png -------------------------------------------------------------------------------- /data/avatars/obama/torso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/obama/torso.png -------------------------------------------------------------------------------- /data/avatars/romney/avatar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -1.1649844644523455E-8 4 | 0.17038945853710175 5 | -1.4050725383185636E-7 6 | 0.17150671780109406 7 | 0.1695677638053894 8 | 5.059100089965796E-7 9 | -0.17150674760341644 10 | 0.1712111532688141 11 | -7.869245450820017E-7 12 | 1.1649844644523455E-8 13 | -0.17038945853710175 14 | 1.4050725383185636E-7 15 | 0.07375872880220413 16 | -0.2504594624042511 17 | -0.0010226547019556165 18 | -0.0792931541800499 19 | -0.24472740292549133 20 | -0.012209468521177769 21 | 0.6709562 22 | 0.29762086 23 | 0.26884565 24 | 0.28274325 25 | 0.26318 26 | 0.50691843 27 | 0.37688586 28 | 0.50082505 29 | 0.38099045 30 | torso.png 31 | 0.8 32 | left_arm.png 33 | 0.5 34 | left_forearm.png 35 | 0.6 36 | right_arm.png 37 | 0.5 38 | right_forearm.png 39 | 0.6 40 | thigh.png 41 | 0.5 42 | leg.png 43 | 0.6 44 | thigh.png 45 | 0.5 46 | leg.png 47 | 0.6 48 | 49 | -------------------------------------------------------------------------------- /data/avatars/romney/left_arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/left_arm.png -------------------------------------------------------------------------------- /data/avatars/romney/left_forearm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/left_forearm.png -------------------------------------------------------------------------------- /data/avatars/romney/leg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/leg.png -------------------------------------------------------------------------------- /data/avatars/romney/right_arm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/right_arm.png -------------------------------------------------------------------------------- /data/avatars/romney/right_forearm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/right_forearm.png -------------------------------------------------------------------------------- /data/avatars/romney/thigh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/thigh.png -------------------------------------------------------------------------------- /data/avatars/romney/torso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/avatars/romney/torso.png -------------------------------------------------------------------------------- /data/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/box.png -------------------------------------------------------------------------------- /data/xray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/data/xray.png -------------------------------------------------------------------------------- /j4k-examples.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/j4k-examples.jar -------------------------------------------------------------------------------- /j4k-examples.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/j4k-examples.zip -------------------------------------------------------------------------------- /lib/gluegen-rt-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/gluegen-rt-natives-windows-amd64.jar -------------------------------------------------------------------------------- /lib/gluegen-rt-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/gluegen-rt-natives-windows-i586.jar -------------------------------------------------------------------------------- /lib/gluegen-rt.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/gluegen-rt.jar -------------------------------------------------------------------------------- /lib/j4k-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/j4k-natives-windows-amd64.jar -------------------------------------------------------------------------------- /lib/j4k-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/j4k-natives-windows-i586.jar -------------------------------------------------------------------------------- /lib/j4k2-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/j4k2-natives-windows-amd64.jar -------------------------------------------------------------------------------- /lib/j4k2-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/j4k2-natives-windows-i586.jar -------------------------------------------------------------------------------- /lib/jogl-all-natives-windows-amd64.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/jogl-all-natives-windows-amd64.jar -------------------------------------------------------------------------------- /lib/jogl-all-natives-windows-i586.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/jogl-all-natives-windows-i586.jar -------------------------------------------------------------------------------- /lib/jogl-all.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/jogl-all.jar -------------------------------------------------------------------------------- /lib/ufdw.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/lib/ufdw.jar -------------------------------------------------------------------------------- /src/j4kdemo/augmentedrealityapp/AugmentedRealityApp.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.augmentedrealityapp; 2 | import java.awt.BorderLayout; 3 | import java.awt.event.ActionEvent; 4 | 5 | import javax.swing.JPanel; 6 | 7 | import edu.ufl.digitalworlds.gui.DWApp; 8 | import edu.ufl.digitalworlds.j4k.J4KSDK; 9 | 10 | /* 11 | * Copyright 2011-2014, Digital Worlds Institute, University of 12 | * Florida, Angelos Barmpoutis. 13 | * All rights reserved. 14 | * 15 | * When this program is used for academic or research purposes, 16 | * please cite the following article that introduced this Java library: 17 | * 18 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 19 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 20 | * October 2013, Vol. 43(5), Pages: 1347-1356. 21 | * 22 | * Redistribution and use in source and binary forms, with or without 23 | * modification, are permitted provided that the following conditions are 24 | * met: 25 | * * Redistributions of source code must retain this copyright 26 | * notice, this list of conditions and the following disclaimer. 27 | * * Redistributions in binary form must reproduce this 28 | * copyright notice, this list of conditions and the following disclaimer 29 | * in the documentation and/or other materials provided with the 30 | * distribution. 31 | * 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 33 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 34 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 35 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 36 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 37 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 38 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 39 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 40 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 41 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 42 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 43 | */ 44 | @SuppressWarnings("serial") 45 | public class AugmentedRealityApp extends DWApp 46 | { 47 | 48 | Kinect myKinect; 49 | ViewerPanel3D main_panel; 50 | 51 | public void GUIsetup(JPanel p_root) { 52 | 53 | if(System.getProperty("os.arch").toLowerCase().indexOf("64")<0) 54 | { 55 | if(DWApp.showConfirmDialog("Performance Warning", "

WARNING: You are running a 32bit version of Java.
This may reduce significantly the performance of this application.
It is strongly adviced to exit this program and install a 64bit version of Java.

Do you want to exit now?
")) 56 | System.exit(0); 57 | } 58 | 59 | setLoadingProgress("Intitializing Kinect...",20); 60 | myKinect=new Kinect(); 61 | 62 | 63 | if(!myKinect.start(J4KSDK.DEPTH|J4KSDK.SKELETON|J4KSDK.COLOR|J4KSDK.XYZ|J4KSDK.UV|J4KSDK.PLAYER_INDEX)) 64 | { 65 | DWApp.showErrorDialog("ERROR", "

ERROR: The Kinect device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 66 | //System.exit(0); 67 | } 68 | 69 | 70 | setLoadingProgress("Intitializing OpenGL...",60); 71 | main_panel=new ViewerPanel3D(); 72 | myKinect.setViewer(main_panel); 73 | 74 | p_root.add(main_panel, BorderLayout.CENTER); 75 | 76 | } 77 | 78 | public void GUIclosing() 79 | { 80 | myKinect.stop(); 81 | } 82 | 83 | 84 | 85 | public static void main(String args[]) { 86 | 87 | createMainFrame("Augmented Reality App"); 88 | app=new AugmentedRealityApp(); 89 | setFrameSize(730,570,null); 90 | } 91 | 92 | @Override 93 | public void GUIactionPerformed(ActionEvent e) 94 | { 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/j4kdemo/augmentedrealityapp/AugmentedRealityApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.augmentedrealityapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class AugmentedRealityApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("Augmented Reality App"); 45 | AugmentedRealityApp.app=new AugmentedRealityApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/j4kdemo/augmentedrealityapp/Kinect.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.augmentedrealityapp; 2 | 3 | import edu.ufl.digitalworlds.j4k.DepthMap; 4 | import edu.ufl.digitalworlds.j4k.J4KSDK; 5 | import edu.ufl.digitalworlds.j4k.Skeleton; 6 | 7 | 8 | /* 9 | * Copyright 2011-2014, Digital Worlds Institute, University of 10 | * Florida, Angelos Barmpoutis. 11 | * All rights reserved. 12 | * 13 | * When this program is used for academic or research purposes, 14 | * please cite the following article that introduced this Java library: 15 | * 16 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 17 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 18 | * October 2013, Vol. 43(5), Pages: 1347-1356. 19 | * 20 | * Redistribution and use in source and binary forms, with or without 21 | * modification, are permitted provided that the following conditions are 22 | * met: 23 | * * Redistributions of source code must retain this copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * * Redistributions in binary form must reproduce this 26 | * copyright notice, this list of conditions and the following disclaimer 27 | * in the documentation and/or other materials provided with the 28 | * distribution. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | */ 42 | public class Kinect extends J4KSDK{ 43 | 44 | ViewerPanel3D viewer=null; 45 | 46 | public Kinect() 47 | { 48 | super(); 49 | } 50 | 51 | 52 | public void setViewer(ViewerPanel3D viewer){this.viewer=viewer;} 53 | 54 | 55 | @Override 56 | public void onDepthFrameEvent(short[] depth, byte[] player_index, float[] XYZ, float[] UV) { 57 | if(viewer==null)return; 58 | DepthMap map=new DepthMap(getDepthWidth(),getDepthHeight(),XYZ); 59 | map.setPlayerIndex(depth, player_index); 60 | if(UV!=null) map.setUV(UV); 61 | map.setMaximumAllowedDeltaZ(5); 62 | viewer.current_map=map; 63 | } 64 | 65 | @Override 66 | public void onSkeletonFrameEvent(boolean[] flags, float[] positions, float[] orientations, byte[] joint_status) { 67 | if(viewer==null || viewer.skeletons==null)return; 68 | for(int i=0;i5)mode=0; 295 | 296 | } 297 | else if(e.getKeyCode()==34)//page down 298 | { 299 | mode-=1; 300 | if(mode<0) mode=5; 301 | } 302 | 303 | } 304 | 305 | } 306 | -------------------------------------------------------------------------------- /src/j4kdemo/imageavatarapp/CardboardAvatar.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.imageavatarapp; 2 | 3 | import java.io.FileNotFoundException; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | 7 | import javax.xml.parsers.DocumentBuilder; 8 | import javax.xml.parsers.DocumentBuilderFactory; 9 | import javax.xml.parsers.ParserConfigurationException; 10 | 11 | import org.w3c.dom.Document; 12 | import org.w3c.dom.Element; 13 | import org.w3c.dom.Node; 14 | import org.w3c.dom.NodeList; 15 | import org.xml.sax.SAXException; 16 | 17 | import edu.ufl.digitalworlds.files.FileUtils; 18 | import edu.ufl.digitalworlds.j4k.ImageAvatar; 19 | /* 20 | * Copyright 2011-2014, Digital Worlds Institute, University of 21 | * Florida, Angelos Barmpoutis. 22 | * All rights reserved. 23 | * 24 | * When this program is used for academic or research purposes, 25 | * please cite the following article that introduced this Java library: 26 | * 27 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 28 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 29 | * October 2013, Vol. 43(5), Pages: 1347-1356. 30 | * 31 | * Redistribution and use in source and binary forms, with or without 32 | * modification, are permitted provided that the following conditions are 33 | * met: 34 | * * Redistributions of source code must retain this copyright 35 | * notice, this list of conditions and the following disclaimer. 36 | * * Redistributions in binary form must reproduce this 37 | * copyright notice, this list of conditions and the following disclaimer 38 | * in the documentation and/or other materials provided with the 39 | * distribution. 40 | * 41 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 42 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 43 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 44 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 45 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 46 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 47 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 48 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 49 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 50 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 51 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 52 | */ 53 | 54 | public class CardboardAvatar extends ImageAvatar{ 55 | 56 | public CardboardAvatar(String foldername) 57 | { 58 | super(); 59 | loadFromXML(foldername,null); 60 | } 61 | 62 | public CardboardAvatar(String foldername, Object inJar) 63 | { 64 | super(); 65 | loadFromXML(foldername,inJar); 66 | } 67 | 68 | private void loadFromXML(String foldername, Object inJar) 69 | { 70 | InputStream is; 71 | try { 72 | is = FileUtils.open(foldername+"/avatar.xml",inJar); 73 | if(is==null) return; 74 | Document doc=null; 75 | DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); 76 | DocumentBuilder dBuilder; 77 | dBuilder = dbFactory.newDocumentBuilder(); 78 | doc = dBuilder.parse(is); 79 | if(doc==null)return; 80 | doc.getDocumentElement().normalize(); 81 | NodeList nList = doc.getElementsByTagName("AVATAR"); 82 | 83 | boolean done=false; 84 | String s; 85 | for (int temp = 0; temp < nList.getLength() && !done; temp++) 86 | { 87 | Node nNode = nList.item(temp); 88 | if (nNode.getNodeType() == Node.ELEMENT_NODE) 89 | { 90 | Element eElement = (Element) nNode; 91 | 92 | 93 | double v[]=new double[4];v[3]=1; 94 | 95 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_SHOULDER_X", eElement)); 96 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_SHOULDER_Y", eElement)); 97 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_SHOULDER_Z", eElement)); 98 | setTorsoPoint(SHOULDER_CENTER,v); 99 | 100 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_SHOULDER_X", eElement)); 101 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_SHOULDER_Y", eElement)); 102 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_SHOULDER_Z", eElement)); 103 | setTorsoPoint(SHOULDER_LEFT,v); 104 | 105 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_SHOULDER_X", eElement)); 106 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_SHOULDER_Y", eElement)); 107 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_SHOULDER_Z", eElement)); 108 | setTorsoPoint(SHOULDER_RIGHT,v); 109 | 110 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_HIP_X", eElement)); 111 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_HIP_Y", eElement)); 112 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("CENTER_HIP_Z", eElement)); 113 | setTorsoPoint(HIP_CENTER,v); 114 | 115 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_HIP_X", eElement)); 116 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_HIP_Y", eElement)); 117 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_HIP_Z", eElement)); 118 | setTorsoPoint(HIP_LEFT,v); 119 | 120 | v[0]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_HIP_X", eElement)); 121 | v[1]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_HIP_Y", eElement)); 122 | v[2]=FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_HIP_Z", eElement)); 123 | setTorsoPoint(HIP_RIGHT,v); 124 | 125 | setSegmentLength(HEAD,FileUtils.parseFloat(FileUtils.getXMLTagValue("HEAD_LENGTH", eElement))); 126 | setSegmentLength(TORSO,FileUtils.parseFloat(FileUtils.getXMLTagValue("TORSO_LENGTH", eElement))); 127 | setSegmentLength(ARM_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_ARM_LENGTH", eElement))); 128 | setSegmentLength(FOREARM_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_FOREARM_LENGTH", eElement))); 129 | setSegmentLength(ARM_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_ARM_LENGTH", eElement))); 130 | setSegmentLength(FOREARM_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_FOREARM_LENGTH", eElement))); 131 | setSegmentLength(THIGH_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_THIGH_LENGTH", eElement))); 132 | setSegmentLength(LEG_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_LEG_LENGTH", eElement))); 133 | setSegmentLength(THIGH_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_THIGH_LENGTH", eElement))); 134 | setSegmentLength(LEG_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_LEG_LENGTH", eElement))); 135 | 136 | //setImageAspectRatio(HEAD,FileUtils.parseFloat(FileUtils.getXMLTagValue("HEAD_TEXTURE_ASPECT_RATIO", eElement))); 137 | setImageAspectRatio(TORSO,FileUtils.parseFloat(FileUtils.getXMLTagValue("TORSO_TEXTURE_ASPECT_RATIO", eElement))); 138 | setImageAspectRatio(ARM_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_ARM_TEXTURE_ASPECT_RATIO", eElement))); 139 | setImageAspectRatio(FOREARM_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_FOREARM_TEXTURE_ASPECT_RATIO", eElement))); 140 | setImageAspectRatio(ARM_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_ARM_TEXTURE_ASPECT_RATIO", eElement))); 141 | setImageAspectRatio(FOREARM_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_FOREARM_TEXTURE_ASPECT_RATIO", eElement))); 142 | setImageAspectRatio(THIGH_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_THIGH_TEXTURE_ASPECT_RATIO", eElement))); 143 | setImageAspectRatio(LEG_LEFT,FileUtils.parseFloat(FileUtils.getXMLTagValue("LEFT_LEG_TEXTURE_ASPECT_RATIO", eElement))); 144 | setImageAspectRatio(THIGH_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_THIGH_TEXTURE_ASPECT_RATIO", eElement))); 145 | setImageAspectRatio(LEG_RIGHT,FileUtils.parseFloat(FileUtils.getXMLTagValue("RIGHT_LEG_TEXTURE_ASPECT_RATIO", eElement))); 146 | 147 | 148 | //s=foldername+"/"+FileUtils.getXMLTagValue("HEAD_TEXTURE", eElement); 149 | //textures[HEAD].loadImage(ResourceRetriever.getResourceAsStream(s),true); 150 | 151 | s=foldername+"/"+FileUtils.getXMLTagValue("TORSO_TEXTURE", eElement); 152 | setImage(TORSO,FileUtils.open(s,inJar)); 153 | 154 | s=foldername+"/"+FileUtils.getXMLTagValue("LEFT_ARM_TEXTURE", eElement); 155 | setImage(ARM_LEFT,FileUtils.open(s,inJar)); 156 | 157 | s=foldername+"/"+FileUtils.getXMLTagValue("LEFT_FOREARM_TEXTURE", eElement); 158 | setImage(FOREARM_LEFT,FileUtils.open(s,inJar)); 159 | 160 | s=foldername+"/"+FileUtils.getXMLTagValue("RIGHT_ARM_TEXTURE", eElement); 161 | setImage(ARM_RIGHT,FileUtils.open(s,inJar)); 162 | 163 | s=foldername+"/"+FileUtils.getXMLTagValue("RIGHT_FOREARM_TEXTURE", eElement); 164 | setImage(FOREARM_RIGHT,FileUtils.open(s,inJar)); 165 | 166 | s=foldername+"/"+FileUtils.getXMLTagValue("LEFT_THIGH_TEXTURE", eElement); 167 | setImage(THIGH_LEFT,FileUtils.open(s,inJar)); 168 | 169 | s=foldername+"/"+FileUtils.getXMLTagValue("LEFT_LEG_TEXTURE", eElement); 170 | setImage(LEG_LEFT,FileUtils.open(s,inJar)); 171 | 172 | s=foldername+"/"+FileUtils.getXMLTagValue("RIGHT_THIGH_TEXTURE", eElement); 173 | setImage(THIGH_RIGHT,FileUtils.open(s,inJar)); 174 | 175 | s=foldername+"/"+FileUtils.getXMLTagValue("RIGHT_LEG_TEXTURE", eElement); 176 | setImage(LEG_RIGHT,FileUtils.open(s,inJar)); 177 | 178 | 179 | 180 | done=true; 181 | } 182 | } 183 | 184 | is.close(); 185 | 186 | } catch (FileNotFoundException e) { 187 | e.printStackTrace(); 188 | } catch (IOException e) { 189 | e.printStackTrace(); 190 | } catch (ParserConfigurationException e) { 191 | e.printStackTrace(); 192 | } catch (SAXException e) { 193 | e.printStackTrace(); 194 | } 195 | 196 | } 197 | 198 | 199 | } 200 | -------------------------------------------------------------------------------- /src/j4kdemo/imageavatarapp/ImageAvatarApp.java: -------------------------------------------------------------------------------- 1 | 2 | package j4kdemo.imageavatarapp; 3 | import java.awt.BorderLayout; 4 | import java.awt.GridLayout; 5 | import java.awt.event.ActionEvent; 6 | import java.io.File; 7 | 8 | import javax.swing.JButton; 9 | import javax.swing.JFileChooser; 10 | import javax.swing.JPanel; 11 | 12 | import edu.ufl.digitalworlds.gui.DWApp; 13 | import edu.ufl.digitalworlds.j4k.J4KSDK; 14 | import edu.ufl.digitalworlds.j4k.SkeletonStreamSimulator; 15 | import edu.ufl.digitalworlds.opengl.OpenGLImageComposition; 16 | 17 | /* 18 | * Copyright 2011-2014, Digital Worlds Institute, University of 19 | * Florida, Angelos Barmpoutis. 20 | * All rights reserved. 21 | * 22 | * When this program is used for academic or research purposes, 23 | * please cite the following article that introduced this Java library: 24 | * 25 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 26 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 27 | * October 2013, Vol. 43(5), Pages: 1347-1356. 28 | * 29 | * Redistribution and use in source and binary forms, with or without 30 | * modification, are permitted provided that the following conditions are 31 | * met: 32 | * * Redistributions of source code must retain this copyright 33 | * notice, this list of conditions and the following disclaimer. 34 | * * Redistributions in binary form must reproduce this 35 | * copyright notice, this list of conditions and the following disclaimer 36 | * in the documentation and/or other materials provided with the 37 | * distribution. 38 | * 39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 40 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 41 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 42 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 43 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 44 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 45 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 46 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 47 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 48 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 49 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 50 | */ 51 | @SuppressWarnings("serial") 52 | public class ImageAvatarApp extends DWApp 53 | { 54 | 55 | JButton browse_room; 56 | JButton browse_avatar1; 57 | JButton browse_avatar2; 58 | JButton swap_avatars; 59 | 60 | Kinect myKinect; 61 | SkeletonStreamSimulator stream; 62 | ViewerPanel3D main_panel; 63 | public void GUIsetup(JPanel p_root) { 64 | 65 | if(System.getProperty("os.arch").toLowerCase().indexOf("64")<0) 66 | { 67 | if(DWApp.showConfirmDialog("Performance Warning", "

WARNING: You are running a 32bit version of Java.
This may reduce significantly the performance of this application.
It is strongly adviced to exit this program and install a 64bit version of Java.

Do you want to exit now?
")) 68 | System.exit(0); 69 | } 70 | 71 | setLoadingProgress("Intitializing Kinect...",20); 72 | myKinect=new Kinect(); 73 | if(!myKinect.start(J4KSDK.DEPTH|J4KSDK.SKELETON)) 74 | { 75 | DWApp.showInformationDialog("Information", "

There was no Kinect sensor detected in your system.
"); 76 | } 77 | 78 | 79 | 80 | JPanel controls=new JPanel(new GridLayout(0,4)); 81 | browse_room=new JButton("Open a different room"); 82 | browse_room.addActionListener(this); 83 | controls.add(browse_room); 84 | 85 | browse_avatar1=new JButton("Open a different avatar 1"); 86 | browse_avatar1.addActionListener(this); 87 | controls.add(browse_avatar1); 88 | 89 | browse_avatar2=new JButton("Open a different avatar 2"); 90 | browse_avatar2.addActionListener(this); 91 | controls.add(browse_avatar2); 92 | 93 | swap_avatars=new JButton("Swap avatars"); 94 | swap_avatars.addActionListener(this); 95 | controls.add(swap_avatars); 96 | 97 | setLoadingProgress("Intitializing OpenGL...",60); 98 | main_panel=new ViewerPanel3D(); 99 | 100 | setLoadingProgress("Loading data...",80); 101 | main_panel.setAvatar1(new CardboardAvatar("http://www.digitalworlds.ufl.edu/angelos/lab/ufdw/j4k/avatars/demo1")); 102 | main_panel.setAvatar2(new CardboardAvatar("http://www.digitalworlds.ufl.edu/angelos/lab/ufdw/j4k/avatars/demo2")); 103 | OpenGLImageComposition room=new OpenGLImageComposition(); 104 | room.loadParallel("http://www.digitalworlds.ufl.edu/angelos/lab/ufdw/j4k/rooms/demo"); 105 | main_panel.setRoom(room); 106 | 107 | myKinect.setViewer(main_panel); 108 | 109 | p_root.add(main_panel, BorderLayout.CENTER); 110 | p_root.add(controls, BorderLayout.SOUTH); 111 | 112 | } 113 | 114 | public void GUIclosing() 115 | { 116 | myKinect.stop(); 117 | } 118 | 119 | 120 | public static void main(String args[]) { 121 | 122 | createMainFrame("Image Avatar App"); 123 | app=new ImageAvatarApp(); 124 | setFrameSize(730,570,null); 125 | } 126 | 127 | @Override 128 | public void GUIactionPerformed(ActionEvent e) 129 | { 130 | if(e.getSource()==browse_room) 131 | { 132 | main_panel.room.showOpenDialog(); 133 | } 134 | else if(e.getSource()==swap_avatars) 135 | { 136 | main_panel.swapAvatars(); 137 | } 138 | else 139 | { 140 | JFileChooser chooser = new JFileChooser(); 141 | chooser.setFileHidingEnabled(false); 142 | chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 143 | chooser.setMultiSelectionEnabled(false); 144 | chooser.setDialogType(JFileChooser.OPEN_DIALOG); 145 | if(getMostRecentPath().length()>0) 146 | chooser.setCurrentDirectory(new File(getMostRecentPath())); 147 | chooser.setDialogTitle("Open Cardboard Avatar"); 148 | chooser.setApproveButtonText("Open"); 149 | if (chooser.showOpenDialog(this)== JFileChooser.APPROVE_OPTION) 150 | { 151 | setMostRecentPath(chooser.getCurrentDirectory().getAbsolutePath()); 152 | if(e.getSource()==browse_avatar1) 153 | main_panel.setAvatar1(new CardboardAvatar(chooser.getSelectedFile().getAbsolutePath())); 154 | else if(e.getSource()==browse_avatar2) 155 | main_panel.setAvatar2(new CardboardAvatar(chooser.getSelectedFile().getAbsolutePath())); 156 | } 157 | } 158 | } 159 | 160 | } 161 | -------------------------------------------------------------------------------- /src/j4kdemo/imageavatarapp/ImageAvatarApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.imageavatarapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class ImageAvatarApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("Image Avatar Applet"); 45 | ImageAvatarApp.app=new ImageAvatarApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/j4kdemo/imageavatarapp/Kinect.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.imageavatarapp; 2 | 3 | import edu.ufl.digitalworlds.j4k.J4KSDK; 4 | import edu.ufl.digitalworlds.j4k.Skeleton; 5 | 6 | 7 | /* 8 | * Copyright 2011-2014, Digital Worlds Institute, University of 9 | * Florida, Angelos Barmpoutis. 10 | * All rights reserved. 11 | * 12 | * When this program is used for academic or research purposes, 13 | * please cite the following article that introduced this Java library: 14 | * 15 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 16 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 17 | * October 2013, Vol. 43(5), Pages: 1347-1356. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions are 21 | * met: 22 | * * Redistributions of source code must retain this copyright 23 | * notice, this list of conditions and the following disclaimer. 24 | * * Redistributions in binary form must reproduce this 25 | * copyright notice, this list of conditions and the following disclaimer 26 | * in the documentation and/or other materials provided with the 27 | * distribution. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | */ 41 | public class Kinect extends J4KSDK{ 42 | 43 | ViewerPanel3D viewer=null; 44 | 45 | 46 | public void setViewer(ViewerPanel3D viewer){this.viewer=viewer;} 47 | 48 | @Override 49 | public void onSkeletonFrameEvent(boolean[] skeleton_tracked, float[] positions,float[] orientations, byte[] joint_status) { 50 | if(viewer==null || viewer.skeletons==null)return; 51 | for(int i=0;i= 0 ? sv : 0x10000 + sv; 121 | bv=(byte)( (iv & 0xfff8)>>6); 122 | bgra[idx]=bv;idx++; 123 | bgra[idx]=bv;idx++; 124 | bgra[idx]=bv;idx++; 125 | bgra[idx]=0;idx++; 126 | } 127 | 128 | viewer.videoTexture.update(getInfraredWidth(), getInfraredHeight(), bgra); 129 | } 130 | 131 | } 132 | -------------------------------------------------------------------------------- /src/j4kdemo/kinectviewerapp/KinectViewerApp.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.kinectviewerapp; 2 | import java.awt.BorderLayout; 3 | import java.awt.GridLayout; 4 | import java.awt.event.ActionEvent; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JCheckBox; 8 | import javax.swing.JComboBox; 9 | import javax.swing.JLabel; 10 | import javax.swing.JPanel; 11 | import javax.swing.JSlider; 12 | import javax.swing.event.ChangeEvent; 13 | import javax.swing.event.ChangeListener; 14 | 15 | import edu.ufl.digitalworlds.gui.DWApp; 16 | import edu.ufl.digitalworlds.j4k.J4K1; 17 | import edu.ufl.digitalworlds.j4k.J4K2; 18 | import edu.ufl.digitalworlds.j4k.J4KSDK; 19 | 20 | /* 21 | * Copyright 2011-2014, Digital Worlds Institute, University of 22 | * Florida, Angelos Barmpoutis. 23 | * All rights reserved. 24 | * 25 | * When this program is used for academic or research purposes, 26 | * please cite the following article that introduced this Java library: 27 | * 28 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 29 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 30 | * October 2013, Vol. 43(5), Pages: 1347-1356. 31 | * 32 | * Redistribution and use in source and binary forms, with or without 33 | * modification, are permitted provided that the following conditions are 34 | * met: 35 | * * Redistributions of source code must retain this copyright 36 | * notice, this list of conditions and the following disclaimer. 37 | * * Redistributions in binary form must reproduce this 38 | * copyright notice, this list of conditions and the following disclaimer 39 | * in the documentation and/or other materials provided with the 40 | * distribution. 41 | * 42 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 | */ 54 | @SuppressWarnings("serial") 55 | public class KinectViewerApp extends DWApp implements ChangeListener 56 | { 57 | 58 | Kinect myKinect; 59 | ViewerPanel3D main_panel; 60 | JSlider elevation_angle; 61 | JCheckBox near_mode; 62 | JCheckBox seated_skeleton; 63 | JCheckBox show_infrared; 64 | JButton turn_off; 65 | JComboBox depth_resolution; 66 | JComboBox video_resolution; 67 | JCheckBox show_video; 68 | JCheckBox mask_players; 69 | JLabel accelerometer; 70 | 71 | public void GUIsetup(JPanel p_root) { 72 | 73 | 74 | if(System.getProperty("os.arch").toLowerCase().indexOf("64")<0) 75 | { 76 | if(DWApp.showConfirmDialog("Performance Warning", "

WARNING: You are running a 32bit version of Java.
This may reduce significantly the performance of this application.
It is strongly adviced to exit this program and install a 64bit version of Java.

Do you want to exit now?
")) 77 | System.exit(0); 78 | } 79 | 80 | setLoadingProgress("Intitializing Kinect...",20); 81 | myKinect=new Kinect(); 82 | 83 | 84 | if(!myKinect.start(Kinect.DEPTH| Kinect.COLOR |Kinect.SKELETON |Kinect.XYZ|Kinect.PLAYER_INDEX)) 85 | { 86 | DWApp.showErrorDialog("ERROR", "

ERROR: The Kinect device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 87 | //System.exit(0); 88 | } 89 | 90 | //System.out.println(((J4K2)myKinect.getJ4KClass()).getIndex()); 91 | //myKinect.computeUV(true); 92 | //myKinect.setNearMode(true); 93 | 94 | near_mode=new JCheckBox("Near mode"); 95 | near_mode.setSelected(false); 96 | near_mode.addActionListener(this); 97 | if(myKinect.getDeviceType()!=J4KSDK.MICROSOFT_KINECT_1) near_mode.setEnabled(false); 98 | 99 | seated_skeleton=new JCheckBox("Seated skeleton"); 100 | seated_skeleton.addActionListener(this); 101 | if(myKinect.getDeviceType()!=J4KSDK.MICROSOFT_KINECT_1) seated_skeleton.setEnabled(false); 102 | 103 | elevation_angle=new JSlider(); 104 | elevation_angle.setMinimum(-27); 105 | elevation_angle.setMaximum(27); 106 | elevation_angle.setValue((int)myKinect.getElevationAngle()); 107 | elevation_angle.setToolTipText("Elevation Angle ("+elevation_angle.getValue()+" degrees)"); 108 | elevation_angle.addChangeListener(this); 109 | 110 | turn_off=new JButton("Turn off"); 111 | turn_off.addActionListener(this); 112 | 113 | depth_resolution=new JComboBox(); 114 | if(myKinect.getDeviceType()==J4KSDK.MICROSOFT_KINECT_1) 115 | { 116 | depth_resolution.addItem("80x60"); 117 | depth_resolution.addItem("320x240"); 118 | depth_resolution.addItem("640x480"); 119 | depth_resolution.setSelectedIndex(1); 120 | } 121 | else if(myKinect.getDeviceType()==J4KSDK.MICROSOFT_KINECT_2) 122 | { 123 | depth_resolution.addItem("512x424"); 124 | depth_resolution.setSelectedIndex(0); 125 | } 126 | depth_resolution.addActionListener(this); 127 | 128 | video_resolution=new JComboBox(); 129 | if(myKinect.getDeviceType()==J4KSDK.MICROSOFT_KINECT_1) 130 | { 131 | video_resolution.addItem("640x480"); 132 | video_resolution.addItem("1280x960"); 133 | video_resolution.setSelectedIndex(0); 134 | } 135 | else if(myKinect.getDeviceType()==J4KSDK.MICROSOFT_KINECT_2) 136 | { 137 | video_resolution.addItem("1920x1080"); 138 | video_resolution.setSelectedIndex(0); 139 | } 140 | 141 | 142 | video_resolution.addActionListener(this); 143 | 144 | show_infrared=new JCheckBox("Infrared"); 145 | show_infrared.setSelected(false); 146 | show_infrared.addActionListener(this); 147 | 148 | show_video=new JCheckBox("Show texture"); 149 | show_video.setSelected(false); 150 | show_video.addActionListener(this); 151 | 152 | mask_players=new JCheckBox("Mask Players"); 153 | mask_players.setSelected(false); 154 | mask_players.addActionListener(this); 155 | 156 | JPanel controls=new JPanel(new GridLayout(0,6)); 157 | controls.add(new JLabel("Depth Stream:")); 158 | controls.add(depth_resolution); 159 | controls.add(mask_players); 160 | controls.add(near_mode); 161 | controls.add(seated_skeleton); 162 | accelerometer=new JLabel("0,0,0"); 163 | controls.add(accelerometer); 164 | 165 | 166 | controls.add(new JLabel("Texture Stream:")); 167 | controls.add(video_resolution); 168 | controls.add(show_infrared); 169 | 170 | controls.add(show_video); 171 | controls.add(elevation_angle); 172 | 173 | controls.add(turn_off); 174 | 175 | 176 | 177 | setLoadingProgress("Intitializing OpenGL...",60); 178 | main_panel=new ViewerPanel3D(); 179 | main_panel.setShowVideo(false); 180 | myKinect.setViewer(main_panel); 181 | myKinect.setLabel(accelerometer); 182 | 183 | p_root.add(main_panel, BorderLayout.CENTER); 184 | p_root.add(controls, BorderLayout.SOUTH); 185 | 186 | } 187 | 188 | public void GUIclosing() 189 | { 190 | myKinect.stop(); 191 | } 192 | 193 | private void resetKinect() 194 | { 195 | if(turn_off.getText().compareTo("Turn on")==0) return; 196 | 197 | myKinect.stop(); 198 | int depth_res=J4K1.NUI_IMAGE_RESOLUTION_INVALID; 199 | if(depth_resolution.getSelectedIndex()==0) myKinect.setDepthResolution(80, 60);// depth_res=J4K1.NUI_IMAGE_RESOLUTION_80x60; 200 | else if(depth_resolution.getSelectedIndex()==1) myKinect.setDepthResolution(320, 240);//depth_res=J4K1.NUI_IMAGE_RESOLUTION_320x240; 201 | else if(depth_resolution.getSelectedIndex()==2) myKinect.setDepthResolution(640, 480);//depth_res=J4K1.NUI_IMAGE_RESOLUTION_640x480; 202 | 203 | int video_res=J4K1.NUI_IMAGE_RESOLUTION_INVALID; 204 | if(video_resolution.getSelectedIndex()==0) myKinect.setColorResolution(640, 480);//video_res=J4K1.NUI_IMAGE_RESOLUTION_640x480; 205 | else if(video_resolution.getSelectedIndex()==1) myKinect.setDepthResolution(1280, 960);//video_res=J4K1.NUI_IMAGE_RESOLUTION_1280x960; 206 | 207 | int flags=Kinect.SKELETON; 208 | flags=flags|Kinect.COLOR; 209 | flags=flags|Kinect.DEPTH; 210 | flags=flags|Kinect.XYZ; 211 | if(show_infrared.isSelected()) {flags=flags|Kinect.INFRARED; myKinect.updateTextureUsingInfrared(true);} 212 | else myKinect.updateTextureUsingInfrared(false); 213 | 214 | myKinect.start(flags); 215 | if(show_video.isSelected())myKinect.computeUV(true); 216 | else myKinect.computeUV(false); 217 | if(seated_skeleton.isSelected())myKinect.setSeatedSkeletonTracking(true); 218 | if(near_mode.isSelected()) myKinect.setNearMode(true); 219 | } 220 | 221 | public static void main(String args[]) { 222 | 223 | createMainFrame("Kinect Viewer App"); 224 | app=new KinectViewerApp(); 225 | setFrameSize(730,570,null); 226 | } 227 | 228 | @Override 229 | public void GUIactionPerformed(ActionEvent e) 230 | { 231 | if(e.getSource()==near_mode) 232 | { 233 | if(near_mode.isSelected()) myKinect.setNearMode(true); 234 | else myKinect.setNearMode(false); 235 | } 236 | else if(e.getSource()==seated_skeleton) 237 | { 238 | if(seated_skeleton.isSelected()) myKinect.setSeatedSkeletonTracking(true); 239 | else myKinect.setSeatedSkeletonTracking(false); 240 | } 241 | else if(e.getSource()==show_infrared) 242 | { 243 | resetKinect(); 244 | } 245 | else if(e.getSource()==turn_off) 246 | { 247 | if(turn_off.getText().compareTo("Turn off")==0) 248 | { 249 | myKinect.stop(); 250 | turn_off.setText("Turn on"); 251 | } 252 | else 253 | { 254 | turn_off.setText("Turn off"); 255 | resetKinect(); 256 | } 257 | } 258 | else if(e.getSource()==depth_resolution) 259 | { 260 | resetKinect(); 261 | } 262 | else if(e.getSource()==video_resolution) 263 | { 264 | resetKinect(); 265 | } 266 | else if(e.getSource()==show_video) 267 | { 268 | main_panel.setShowVideo(show_video.isSelected()); 269 | if(show_video.isSelected()) myKinect.computeUV(true); 270 | else myKinect.computeUV(false); 271 | } 272 | else if(e.getSource()==mask_players) 273 | { 274 | myKinect.maskPlayers(mask_players.isSelected()); 275 | } 276 | } 277 | 278 | @Override 279 | public void stateChanged(ChangeEvent e) { 280 | if(e.getSource()==elevation_angle) 281 | { 282 | if(!elevation_angle.getValueIsAdjusting()) 283 | { 284 | myKinect.setElevationAngle(elevation_angle.getValue()); 285 | elevation_angle.setToolTipText("Elevation Angle ("+elevation_angle.getValue()+" degrees)"); 286 | } 287 | } 288 | } 289 | 290 | } 291 | -------------------------------------------------------------------------------- /src/j4kdemo/kinectviewerapp/KinectViewerApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.kinectviewerapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class KinectViewerApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("Kinect Viewer Applet"); 45 | KinectViewerApp.app=new KinectViewerApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/j4kdemo/kinectviewerapp/ViewerPanel3D.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.kinectviewerapp; 2 | 3 | import java.awt.Dimension; 4 | import java.awt.event.MouseEvent; 5 | 6 | import javax.media.opengl.GL2; 7 | 8 | import edu.ufl.digitalworlds.opengl.OpenGLPanel; 9 | import edu.ufl.digitalworlds.j4k.DepthMap; 10 | import edu.ufl.digitalworlds.j4k.Skeleton; 11 | import edu.ufl.digitalworlds.j4k.VideoFrame; 12 | 13 | /* 14 | * Copyright 2011-2014, Digital Worlds Institute, University of 15 | * Florida, Angelos Barmpoutis. 16 | * All rights reserved. 17 | * 18 | * When this program is used for academic or research purposes, 19 | * please cite the following article that introduced this Java library: 20 | * 21 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 22 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 23 | * October 2013, Vol. 43(5), Pages: 1347-1356. 24 | * 25 | * Redistribution and use in source and binary forms, with or without 26 | * modification, are permitted provided that the following conditions are 27 | * met: 28 | * * Redistributions of source code must retain this copyright 29 | * notice, this list of conditions and the following disclaimer. 30 | * * Redistributions in binary form must reproduce this 31 | * copyright notice, this list of conditions and the following disclaimer 32 | * in the documentation and/or other materials provided with the 33 | * distribution. 34 | * 35 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | */ 47 | @SuppressWarnings("serial") 48 | public class ViewerPanel3D extends OpenGLPanel 49 | { 50 | private float view_rotx = 0.0f, view_roty = 0.0f, view_rotz = 0.0f; 51 | private int prevMouseX, prevMouseY; 52 | 53 | DepthMap map=null; 54 | boolean is_playing=false; 55 | boolean show_video=false; 56 | 57 | public void setShowVideo(boolean flag){show_video=flag;} 58 | 59 | VideoFrame videoTexture; 60 | 61 | Skeleton skeletons[]; 62 | 63 | public void setup() 64 | { 65 | 66 | //OPENGL SPECIFIC INITIALIZATION (OPTIONAL) 67 | GL2 gl=getGL2(); 68 | gl.glEnable(GL2.GL_CULL_FACE); 69 | float light_model_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 70 | float light0_diffuse[] = {0.9f, 0.9f, 0.9f, 0.9f}; 71 | float light0_direction[] = {0.0f, -0.4f, 1.0f, 0.0f}; 72 | gl.glEnable(GL2.GL_NORMALIZE); 73 | gl.glShadeModel(GL2.GL_SMOOTH); 74 | 75 | gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL2.GL_FALSE); 76 | gl.glLightModeli(GL2.GL_LIGHT_MODEL_TWO_SIDE, GL2.GL_FALSE); 77 | gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, light_model_ambient,0); 78 | gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, light0_diffuse,0); 79 | gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, light0_direction,0); 80 | gl.glEnable(GL2.GL_LIGHT0); 81 | 82 | gl.glEnable(GL2.GL_COLOR_MATERIAL); 83 | gl.glEnable(GL2.GL_LIGHTING); 84 | gl.glColor3f(0.9f,0.9f,0.9f); 85 | 86 | 87 | skeletons=new Skeleton[6]; 88 | 89 | videoTexture=new VideoFrame(); 90 | 91 | background(0, 0, 0); 92 | } 93 | 94 | 95 | public void draw() { 96 | 97 | GL2 gl=getGL2(); 98 | 99 | 100 | pushMatrix(); 101 | 102 | translate(0,0,-2); 103 | rotate(view_rotx, 1.0, 0.0, 0.0); 104 | rotate(view_roty, 0.0, 1.0, 0.0); 105 | rotate(view_rotz, 0.0, 0.0, 1.0); 106 | translate(0,0,2); 107 | 108 | 109 | 110 | if(map!=null) 111 | { 112 | if(show_video) 113 | { 114 | gl.glDisable(GL2.GL_LIGHTING); 115 | gl.glEnable(GL2.GL_TEXTURE_2D); 116 | gl.glColor3f(1f,1f,1f); 117 | videoTexture.use(gl); 118 | map.drawTexture(gl); 119 | gl.glDisable(GL2.GL_TEXTURE_2D); 120 | } 121 | else 122 | { 123 | gl.glEnable(GL2.GL_LIGHTING); 124 | gl.glDisable(GL2.GL_TEXTURE_2D); 125 | gl.glColor3f(0.9f,0.9f,0.9f); 126 | map.drawNormals(gl); 127 | } 128 | } 129 | 130 | gl.glClear(GL2.GL_DEPTH_BUFFER_BIT); 131 | 132 | gl.glDisable(GL2.GL_LIGHTING); 133 | gl.glLineWidth(2); 134 | gl.glColor3f(1f,0f,0f); 135 | for(int i=0;i

ERROR: The Kinect #1 device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 71 | //System.exit(0); 72 | } 73 | 74 | 75 | kinect2=new Kinect(); 76 | if(!kinect2.start(J4KSDK.COLOR|J4KSDK.DEPTH|J4KSDK.UV|J4KSDK.XYZ|J4KSDK.SKELETON)) 77 | { 78 | DWApp.showErrorDialog("ERROR", "

ERROR: The Kinect #2 device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 79 | //System.exit(0); 80 | } 81 | 82 | 83 | } 84 | 85 | public void GUIclosing() 86 | { 87 | kinect1.stop(); 88 | kinect2.stop(); 89 | } 90 | 91 | 92 | public static void main(String args[]) { 93 | 94 | createMainFrame("Two Kinects App"); 95 | app=new MultipleKinectApp(); 96 | setFrameSize(730,270,null); 97 | } 98 | 99 | @Override 100 | public void GUIactionPerformed(ActionEvent e) 101 | { 102 | if(e.getSource()==button1) 103 | kinect1.showViewerDialog(false); 104 | else if(e.getSource()==button2) 105 | kinect2.showViewerDialog(false); 106 | } 107 | 108 | 109 | } 110 | -------------------------------------------------------------------------------- /src/j4kdemo/multiplekinectapp/MultipleKinectApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.multiplekinectapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class MultipleKinectApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("Two Kinects Applet"); 45 | MultipleKinectApp.app=new MultipleKinectApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/j4kdemo/simpleexample/SimpleExample.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.simpleexample; 2 | 3 | import java.util.Date; 4 | 5 | import edu.ufl.digitalworlds.gui.DWApp; 6 | import edu.ufl.digitalworlds.j4k.J4KSDK; 7 | 8 | /* 9 | * Copyright 2011-2014, Digital Worlds Institute, University of 10 | * Florida, Angelos Barmpoutis. 11 | * All rights reserved. 12 | * 13 | * When this program is used for academic or research purposes, 14 | * please cite the following article that introduced this Java library: 15 | * 16 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 17 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 18 | * October 2013, Vol. 43(5), Pages: 1347-1356. 19 | * 20 | * Redistribution and use in source and binary forms, with or without 21 | * modification, are permitted provided that the following conditions are 22 | * met: 23 | * * Redistributions of source code must retain this copyright 24 | * notice, this list of conditions and the following disclaimer. 25 | * * Redistributions in binary form must reproduce this 26 | * copyright notice, this list of conditions and the following disclaimer 27 | * in the documentation and/or other materials provided with the 28 | * distribution. 29 | * 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 31 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 32 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 33 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 34 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 35 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 36 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 37 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 38 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 40 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 41 | */ 42 | public class SimpleExample extends J4KSDK { 43 | 44 | int counter=0; 45 | long time=0; 46 | 47 | @Override 48 | public void onSkeletonFrameEvent(boolean[] skeleton_tracked, float[] positions, float[] orientations, byte[] joint_status) { 49 | System.out.println("A new skeleton frame was received."); 50 | } 51 | 52 | @Override 53 | public void onColorFrameEvent(byte[] color_frame) { 54 | System.out.println("A new color frame was received."); 55 | } 56 | 57 | @Override 58 | public void onDepthFrameEvent(short[] depth_frame, byte[] body_index, float[] xyz, float[] uv) { 59 | System.out.println("A new depth frame was received."); 60 | 61 | if(counter==0) 62 | time=new Date().getTime(); 63 | counter+=1; 64 | } 65 | 66 | public static void main(String[] args) 67 | { 68 | 69 | if(System.getProperty("os.arch").toLowerCase().indexOf("64")<0) 70 | { 71 | System.out.println("WARNING: You are running a 32bit version of Java."); 72 | System.out.println("This may reduce significantly the performance of this application."); 73 | System.out.println("It is strongly adviced to exit this program and install a 64bit version of Java.\n"); 74 | } 75 | 76 | System.out.println("This program will run for about 20 seconds."); 77 | SimpleExample kinect=new SimpleExample(); 78 | kinect.start(J4KSDK.COLOR|J4KSDK.DEPTH|J4KSDK.SKELETON); 79 | 80 | 81 | //Sleep for 20 seconds. 82 | try {Thread.sleep(20000);} catch (InterruptedException e) {} 83 | 84 | 85 | kinect.stop(); 86 | System.out.println("FPS: "+kinect.counter*1000.0/(new Date().getTime()-kinect.time)); 87 | } 88 | 89 | 90 | } 91 | -------------------------------------------------------------------------------- /src/j4kdemo/videoviewerapp/Kinect.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.videoviewerapp; 2 | 3 | import edu.ufl.digitalworlds.j4k.J4KSDK; 4 | 5 | 6 | /* 7 | * Copyright 2011-2014, Digital Worlds Institute, University of 8 | * Florida, Angelos Barmpoutis. 9 | * All rights reserved. 10 | * 11 | * When this program is used for academic or research purposes, 12 | * please cite the following article that introduced this Java library: 13 | * 14 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 15 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 16 | * October 2013, Vol. 43(5), Pages: 1347-1356. 17 | * 18 | * Redistribution and use in source and binary forms, with or without 19 | * modification, are permitted provided that the following conditions are 20 | * met: 21 | * * Redistributions of source code must retain this copyright 22 | * notice, this list of conditions and the following disclaimer. 23 | * * Redistributions in binary form must reproduce this 24 | * copyright notice, this list of conditions and the following disclaimer 25 | * in the documentation and/or other materials provided with the 26 | * distribution. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 29 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 30 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 31 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 32 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 33 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 34 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 35 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 36 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 37 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 38 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 39 | */ 40 | public class Kinect extends J4KSDK{ 41 | 42 | VideoPanel viewer=null; 43 | 44 | public void setViewer(VideoPanel viewer){this.viewer=viewer;} 45 | 46 | 47 | 48 | @Override 49 | public void onDepthFrameEvent(short[] depth_frame, byte[] body_index, float[] xyz, float[] uv) {} 50 | 51 | @Override 52 | public void onSkeletonFrameEvent(boolean[] skeleton_tracked, float[] positions,float[] orientations, byte[] joint_status) {} 53 | 54 | @Override 55 | public void onColorFrameEvent(byte[] color_frame) { 56 | if(viewer==null || viewer.videoTexture==null) return; 57 | viewer.videoTexture.update(getColorWidth(), getColorHeight(), color_frame); 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/j4kdemo/videoviewerapp/VideoPanel.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.videoviewerapp; 2 | 3 | import javax.media.opengl.GL2; 4 | import edu.ufl.digitalworlds.opengl.OpenGLPanel; 5 | import edu.ufl.digitalworlds.j4k.VideoFrame; 6 | 7 | /* 8 | * Copyright 2011-2014, Digital Worlds Institute, University of 9 | * Florida, Angelos Barmpoutis. 10 | * All rights reserved. 11 | * 12 | * When this program is used for academic or research purposes, 13 | * please cite the following article that introduced this Java library: 14 | * 15 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 16 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 17 | * October 2013, Vol. 43(5), Pages: 1347-1356. 18 | * 19 | * Redistribution and use in source and binary forms, with or without 20 | * modification, are permitted provided that the following conditions are 21 | * met: 22 | * * Redistributions of source code must retain this copyright 23 | * notice, this list of conditions and the following disclaimer. 24 | * * Redistributions in binary form must reproduce this 25 | * copyright notice, this list of conditions and the following disclaimer 26 | * in the documentation and/or other materials provided with the 27 | * distribution. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 32 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 33 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 34 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 35 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 36 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 39 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 | */ 41 | @SuppressWarnings("serial") 42 | public class VideoPanel extends OpenGLPanel 43 | { 44 | 45 | VideoFrame videoTexture; 46 | 47 | public void setup() 48 | { 49 | 50 | //OPENGL SPECIFIC INITIALIZATION (OPTIONAL) 51 | GL2 gl=getGL2(); 52 | gl.glEnable(GL2.GL_CULL_FACE); 53 | float light_model_ambient[] = {0.3f, 0.3f, 0.3f, 1.0f}; 54 | float light0_diffuse[] = {0.9f, 0.9f, 0.9f, 0.9f}; 55 | float light0_direction[] = {0.0f, -0.4f, 1.0f, 0.0f}; 56 | gl.glEnable(GL2.GL_NORMALIZE); 57 | gl.glShadeModel(GL2.GL_SMOOTH); 58 | 59 | gl.glLightModeli(GL2.GL_LIGHT_MODEL_LOCAL_VIEWER, GL2.GL_FALSE); 60 | gl.glLightModeli(GL2.GL_LIGHT_MODEL_TWO_SIDE, GL2.GL_FALSE); 61 | gl.glLightModelfv(GL2.GL_LIGHT_MODEL_AMBIENT, light_model_ambient,0); 62 | gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_DIFFUSE, light0_diffuse,0); 63 | gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, light0_direction,0); 64 | gl.glEnable(GL2.GL_LIGHT0); 65 | 66 | gl.glEnable(GL2.GL_COLOR_MATERIAL); 67 | gl.glEnable(GL2.GL_LIGHTING); 68 | gl.glColor3f(0.9f,0.9f,0.9f); 69 | 70 | 71 | videoTexture=new VideoFrame(); 72 | 73 | background(0, 0, 0); 74 | } 75 | 76 | 77 | public void draw() { 78 | 79 | GL2 gl=getGL2(); 80 | 81 | 82 | pushMatrix(); 83 | 84 | 85 | gl.glDisable(GL2.GL_LIGHTING); 86 | gl.glEnable(GL2.GL_TEXTURE_2D); 87 | gl.glColor3f(1f,1f,1f); 88 | videoTexture.use(gl); 89 | translate(0,0,-2.2); 90 | rotateZ(180); 91 | image(8.0/3.0,2); 92 | 93 | popMatrix(); 94 | } 95 | 96 | 97 | } 98 | -------------------------------------------------------------------------------- /src/j4kdemo/videoviewerapp/VideoViewerApp.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.videoviewerapp; 2 | import java.awt.BorderLayout; 3 | 4 | import javax.swing.JPanel; 5 | 6 | import edu.ufl.digitalworlds.gui.DWApp; 7 | import edu.ufl.digitalworlds.j4k.J4KSDK; 8 | 9 | /* 10 | * Copyright 2011-2014, Digital Worlds Institute, University of 11 | * Florida, Angelos Barmpoutis. 12 | * All rights reserved. 13 | * 14 | * When this program is used for academic or research purposes, 15 | * please cite the following article that introduced this Java library: 16 | * 17 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 18 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 19 | * October 2013, Vol. 43(5), Pages: 1347-1356. 20 | * 21 | * Redistribution and use in source and binary forms, with or without 22 | * modification, are permitted provided that the following conditions are 23 | * met: 24 | * * Redistributions of source code must retain this copyright 25 | * notice, this list of conditions and the following disclaimer. 26 | * * Redistributions in binary form must reproduce this 27 | * copyright notice, this list of conditions and the following disclaimer 28 | * in the documentation and/or other materials provided with the 29 | * distribution. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 36 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 38 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 39 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | */ 43 | @SuppressWarnings("serial") 44 | public class VideoViewerApp extends DWApp 45 | { 46 | 47 | Kinect myKinect; 48 | VideoPanel main_panel; 49 | 50 | public void GUIsetup(JPanel p_root) { 51 | 52 | if(System.getProperty("os.arch").toLowerCase().indexOf("64")<0) 53 | { 54 | if(DWApp.showConfirmDialog("Performance Warning", "

WARNING: You are running a 32bit version of Java.
This may reduce significantly the performance of this application.
It is strongly adviced to exit this program and install a 64bit version of Java.

Do you want to exit now?
")) 55 | System.exit(0); 56 | } 57 | 58 | setLoadingProgress("Intitializing Kinect...",20); 59 | myKinect=new Kinect(); 60 | if(!myKinect.start(J4KSDK.COLOR)) 61 | { 62 | DWApp.showErrorDialog("ERROR", "

ERROR: The Kinect device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 63 | //System.exit(0); 64 | } 65 | 66 | 67 | 68 | setLoadingProgress("Intitializing OpenGL...",60); 69 | main_panel=new VideoPanel(); 70 | myKinect.setViewer(main_panel); 71 | p_root.add(main_panel, BorderLayout.CENTER); 72 | } 73 | 74 | public void GUIclosing() 75 | { 76 | myKinect.stop(); 77 | } 78 | 79 | 80 | public static void main(String args[]) { 81 | 82 | createMainFrame("Video Viewer App"); 83 | app=new VideoViewerApp(); 84 | setFrameSize(730,570,null); 85 | } 86 | 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/j4kdemo/videoviewerapp/VideoViewerApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.videoviewerapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class VideoViewerApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("Video Viewer Applet"); 45 | VideoViewerApp.app=new VideoViewerApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/j4kdemo/xedconvertapp/FileCompressor.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.xedconvertapp; 2 | 3 | import java.io.File; 4 | import java.io.FileInputStream; 5 | import java.io.FileNotFoundException; 6 | import java.io.IOException; 7 | import edu.ufl.digitalworlds.utils.ParallelThread; 8 | 9 | /* 10 | * Copyright 2011-2014, Digital Worlds Institute, University of 11 | * Florida, Angelos Barmpoutis. 12 | * All rights reserved. 13 | * 14 | * When this program is used for academic or research purposes, 15 | * please cite the following article that introduced this Java library: 16 | * 17 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 18 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 19 | * October 2013, Vol. 43(5), Pages: 1347-1356. 20 | * 21 | * Redistribution and use in source and binary forms, with or without 22 | * modification, are permitted provided that the following conditions are 23 | * met: 24 | * * Redistributions of source code must retain this copyright 25 | * notice, this list of conditions and the following disclaimer. 26 | * * Redistributions in binary form must reproduce this 27 | * copyright notice, this list of conditions and the following disclaimer 28 | * in the documentation and/or other materials provided with the 29 | * distribution. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 36 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 37 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 38 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 39 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 42 | */ 43 | 44 | public class FileCompressor extends ParallelThread{ 45 | 46 | KinectFileWriter out; 47 | int num_of_depth_frames; 48 | 49 | public FileCompressor(KinectFileWriter file) 50 | { 51 | out=file; 52 | num_of_depth_frames=out.num_of_depth_frames; 53 | } 54 | 55 | @Override 56 | public void run() { 57 | 58 | try { 59 | File f=new File(out.filename+".temp"); 60 | FileInputStream in=new FileInputStream(f); 61 | 62 | out.openZipFile(); 63 | byte depth_array[]=new byte[16+12+2*out.depth_width*out.depth_height]; 64 | //byte video_array[]=new byte[4*out.video_width*out.video_height]; 65 | 66 | setMaxProgress(num_of_depth_frames); 67 | 68 | for(int i=0;i"); 135 | outprint.println("
"); 136 | Date date = new Date(); 137 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm"); 138 | outprint.println("\t1.0"); 139 | if(device_type==J4KSDK.MICROSOFT_KINECT_1) 140 | outprint.println("\tMICROSOFT_KINECT_1"); 141 | else if(device_type==J4KSDK.MICROSOFT_KINECT_2) 142 | outprint.println("\tMICROSOFT_KINECT_2"); 143 | else outprint.println("\tUNKNOWN"); 144 | 145 | outprint.println("\t"+sdf.format(date)+""); 146 | outprint.println("\t"+depth_width+""); 147 | outprint.println("\t"+depth_height+""); 148 | outprint.println("\t"+video_width+""); 149 | outprint.println("\t"+video_height+""); 150 | outprint.println("\t"+num_of_depth_frames+""); 151 | outprint.println("
"); 152 | outprint.flush(); 153 | f.closeEntry(); 154 | 155 | } catch (IOException e) { 156 | // TODO Auto-generated catch block 157 | e.printStackTrace(); 158 | } 159 | } 160 | 161 | public void printInfo() 162 | { 163 | System.out.println("Depth frame size: "+depth_width+" x "+depth_height); 164 | System.out.println("Number of depth frames: "+num_of_depth_frames); 165 | } 166 | 167 | private static String int2string(int i) 168 | { 169 | if(i<0) return "000000"; 170 | else if(i<10) return "00000"+i; 171 | else if(i<100) return "0000"+i; 172 | else if(i<1000) return "000"+i; 173 | else if(i<10000) return "00"+i; 174 | else if(i<100000) return "0"+i; 175 | else return ""+i; 176 | } 177 | 178 | public void writeDepthFrameZip(byte array[]) 179 | { 180 | if(f==null) return; 181 | try 182 | { 183 | ZipEntry outEntry = new ZipEntry(int2string(num_of_depth_frames)+".depth"); 184 | outEntry.setMethod(ZipEntry.DEFLATED); 185 | f.putNextEntry(outEntry); 186 | num_of_depth_frames+=1; 187 | f.write(array); 188 | f.closeEntry(); 189 | } catch (IOException e) { 190 | e.printStackTrace(); 191 | } 192 | } 193 | 194 | public void writeDepthFrameZip(short array[],float acc[],long time1, long time2) 195 | { 196 | if(f==null) return; 197 | try 198 | { 199 | ZipEntry outEntry = new ZipEntry(int2string(num_of_depth_frames)+".depth"); 200 | outEntry.setMethod(ZipEntry.DEFLATED); 201 | f.putNextEntry(outEntry); 202 | writeDepthFrame(f,array,acc,time1,time2); 203 | f.closeEntry(); 204 | } catch (IOException e) { 205 | e.printStackTrace(); 206 | } 207 | } 208 | 209 | public void writeDepthFrameTemp(short array[],float acc[],long time1,long time2) 210 | { 211 | if(temp_file==null)return; 212 | writeDepthFrame(temp_file,array,acc,time1,time2); 213 | } 214 | 215 | byte depth_buffer_acc[]; 216 | byte depth_buffer_short[]; 217 | byte time_buff[]; 218 | 219 | public void writeDepthFrame(OutputStream os, short array[],float acc[],long time1,long time2) 220 | { 221 | try 222 | { 223 | if(array.length==320*240) 224 | { 225 | depth_width=320; 226 | depth_height=240; 227 | } 228 | else if(array.length==640*480) 229 | { 230 | depth_width=640; 231 | depth_height=480; 232 | } 233 | 234 | num_of_depth_frames+=1; 235 | 236 | if(time_buff==null) time_buff=new byte[16]; 237 | LongBuffer lb=ByteBuffer.wrap(time_buff).order(ByteOrder.LITTLE_ENDIAN).asLongBuffer(); 238 | lb.put(time1); 239 | lb.put(time2); 240 | os.write(time_buff); 241 | 242 | if(depth_buffer_acc==null)depth_buffer_acc=new byte[12]; 243 | ByteBuffer.wrap(depth_buffer_acc).order(ByteOrder.LITTLE_ENDIAN).asFloatBuffer().put(acc); 244 | os.write(depth_buffer_acc); 245 | 246 | if(depth_buffer_short==null)depth_buffer_short=new byte[array.length*2]; 247 | ByteBuffer.wrap(depth_buffer_short).order(ByteOrder.LITTLE_ENDIAN).asShortBuffer().put(array); 248 | os.write(depth_buffer_short); 249 | } catch (IOException e) { 250 | e.printStackTrace(); 251 | } 252 | 253 | } 254 | 255 | public void writeVideoFrameZip(byte array[]) 256 | { 257 | if(f==null) return; 258 | try { 259 | 260 | ZipEntry outEntry = new ZipEntry(int2string(num_of_depth_frames-1)+".image"); 261 | outEntry.setMethod(ZipEntry.DEFLATED); 262 | f.putNextEntry(outEntry); 263 | writeVideoFrame(f,array); 264 | f.closeEntry(); 265 | } catch (IOException e) { 266 | e.printStackTrace(); 267 | } 268 | } 269 | 270 | public void writeVideoFrameTemp(byte array[]) 271 | { 272 | if(temp_file==null)return; 273 | writeVideoFrame(temp_file,array); 274 | } 275 | 276 | /*public void writeTimeStamp(long time) 277 | { 278 | if(temp_file==null)return; 279 | if(time_buff==null) time_buff=new byte[8]; 280 | ByteBuffer.wrap(time_buff).order(ByteOrder.LITTLE_ENDIAN).asLongBuffer().put(time); 281 | try { 282 | temp_file.write(time_buff); 283 | } catch (IOException e) { 284 | e.printStackTrace(); 285 | } 286 | }*/ 287 | 288 | public void writeVideoFrame(OutputStream os, byte array[]) 289 | { 290 | try { 291 | 292 | if(array.length==320*240*4) 293 | { 294 | video_width=320; 295 | video_height=240; 296 | } 297 | else if(array.length==640*480*4) 298 | { 299 | video_width=640; 300 | video_height=480; 301 | } 302 | os.write(array); 303 | } catch (IOException e) { 304 | e.printStackTrace(); 305 | } 306 | } 307 | 308 | public void writeVideoFramePNG(byte array[]) 309 | { 310 | if(f==null)return; 311 | try { 312 | ZipEntry outEntry = new ZipEntry(int2string(num_of_depth_frames-1)+".png"); 313 | outEntry.setMethod(ZipEntry.DEFLATED); 314 | f.putNextEntry(outEntry); 315 | 316 | if(array.length==320*240*4) 317 | { 318 | video_width=320; 319 | video_height=240; 320 | } 321 | else if(array.length==640*480*4) 322 | { 323 | video_width=640; 324 | video_height=480; 325 | } 326 | 327 | BufferedImage img=new BufferedImage(video_width,video_height,BufferedImage.TYPE_INT_RGB); 328 | int idx=0; 329 | for(int y=0;y

WARNING: You are running a 32bit version of Java.
This may reduce significantly the performance of this application.
It is strongly adviced to exit this program and install a 64bit version of Java.

Do you want to exit now?
")) 63 | System.exit(0); 64 | } 65 | 66 | setLoadingProgress("Intitializing Kinect...",20); 67 | kinect=new KinectRecorder(this); 68 | if(!kinect.start(J4KSDK.DEPTH|J4KSDK.COLOR)) 69 | { 70 | DWApp.showErrorDialog("ERROR", "

ERROR: The Kinect device could not be initialized.

1. Check if the Microsoft's Kinect SDK was succesfully installed on this computer.
2. Check if the Kinect is plugged into a power outlet.
3. Check if the Kinect is connected to a USB port of this computer.
"); 71 | } 72 | else 73 | { 74 | kinect.setNearMode(false); 75 | } 76 | 77 | setLoadingProgress("Intitializing Window...",80); 78 | button=new JButton("Start"); 79 | button.addActionListener(this); 80 | fps=new JLabel("0"); 81 | 82 | JPanel panel=new JPanel(new GridLayout(1,0)); 83 | panel.add(button); 84 | panel.add(fps); 85 | root.add(panel); 86 | 87 | } 88 | 89 | public void GUIclosing() 90 | { 91 | kinect.stop(); 92 | } 93 | 94 | 95 | public static void main(String args[]) { 96 | 97 | createMainFrame("J4K"); 98 | app=new XEDConvertApp(); 99 | setFrameSize(200,100,null); 100 | } 101 | 102 | @Override 103 | public void GUIactionPerformed(ActionEvent e) 104 | { 105 | if(e.getSource()==button) 106 | { 107 | if(button.getText().compareTo("Start")==0) 108 | { 109 | JFileChooser chooser = new JFileChooser(); 110 | chooser.setFileHidingEnabled(false); 111 | chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); 112 | chooser.setMultiSelectionEnabled(false); 113 | chooser.setDialogType(JFileChooser.SAVE_DIALOG); 114 | if(getMostRecentPath().length()>0) 115 | chooser.setCurrentDirectory(new File(getMostRecentPath())); 116 | chooser.setDialogTitle("Save Kinect Data (zip)"); 117 | chooser.setApproveButtonText("Save"); 118 | 119 | if (chooser.showSaveDialog(this)== JFileChooser.APPROVE_OPTION) 120 | { 121 | setMostRecentPath(chooser.getCurrentDirectory().getAbsolutePath()); 122 | String filename=chooser.getSelectedFile().getAbsolutePath(); 123 | kinect.startRecording(filename); 124 | button.setText("Stop"); 125 | } 126 | } 127 | else 128 | { 129 | kinect.stopRecording(); 130 | button.setEnabled(false); 131 | button.setText("Start"); 132 | } 133 | } 134 | } 135 | 136 | int max_progress=1; 137 | 138 | @Override 139 | public void setMaxProgress(int value) {max_progress=value;} 140 | 141 | @Override 142 | public void setProgress(int value) {fps.setText(""+(int)(value*100f/max_progress)+"%");if(value==max_progress)button.setEnabled(true);} 143 | } 144 | -------------------------------------------------------------------------------- /src/j4kdemo/xedconvertapp/XEDConvertApplet.java: -------------------------------------------------------------------------------- 1 | package j4kdemo.xedconvertapp; 2 | 3 | import edu.ufl.digitalworlds.gui.DWApplet; 4 | 5 | /* 6 | * Copyright 2011-2014, Digital Worlds Institute, University of 7 | * Florida, Angelos Barmpoutis. 8 | * All rights reserved. 9 | * 10 | * When this program is used for academic or research purposes, 11 | * please cite the following article that introduced this Java library: 12 | * 13 | * A. Barmpoutis. "Tensor Body: Real-time Reconstruction of the Human Body 14 | * and Avatar Synthesis from RGB-D', IEEE Transactions on Cybernetics, 15 | * October 2013, Vol. 43(5), Pages: 1347-1356. 16 | * 17 | * Redistribution and use in source and binary forms, with or without 18 | * modification, are permitted provided that the following conditions are 19 | * met: 20 | * * Redistributions of source code must retain this copyright 21 | * notice, this list of conditions and the following disclaimer. 22 | * * Redistributions in binary form must reproduce this 23 | * copyright notice, this list of conditions and the following disclaimer 24 | * in the documentation and/or other materials provided with the 25 | * distribution. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 30 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 31 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 32 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 33 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 34 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | */ 39 | @SuppressWarnings("serial") 40 | public class XEDConvertApplet extends DWApplet 41 | { 42 | public void init() 43 | { 44 | createMainFrame("J4K"); 45 | XEDConvertApp.app=new XEDConvertApp(); 46 | setFrameSize(730,570,null); 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /ufdw_j4k2_32bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/ufdw_j4k2_32bit.dll -------------------------------------------------------------------------------- /ufdw_j4k2_64bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/ufdw_j4k2_64bit.dll -------------------------------------------------------------------------------- /ufdw_j4k_32bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/ufdw_j4k_32bit.dll -------------------------------------------------------------------------------- /ufdw_j4k_64bit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalworlds/java-for-kinect/fd03446c5c7e7ae903752f9246225ede53dba59f/ufdw_j4k_64bit.dll --------------------------------------------------------------------------------