diff --git a/.gitignore b/.gitignore index 9dd4c285..88fd6a67 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,6 @@ build /papart-complete.tgz /PapARt.tgz /big-files/ +/Papart-examples-master/ +/Papart-examples/ +*.tgz diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..3bba91d3 --- /dev/null +++ b/build.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cd papart +mvn install +mvn javadoc:javadoc diff --git a/createAll.rb b/createAll.rb new file mode 100644 index 00000000..28033fd3 --- /dev/null +++ b/createAll.rb @@ -0,0 +1,23 @@ +#!/bin/ruby +# coding: utf-8 + + +# %x(sh downloadExamples.sh) + +current_branch = %x(git rev-parse --abbrev-ref HEAD).chomp + +output_names=["realsense", + "kinect", + "hardware2", + "hardware3"] + +output_names.each do |release_name| + puts "Get the version: " + release_name + %x(git checkout release-#{release_name}) + puts "Build it." + %x(sh build.sh) + puts "Create redistribuable." + %x(sh createRedist.sh #{release_name}) +end + +%x(git checkout #{current_branch}) diff --git a/createRedist-public.sh b/createRedist-public.sh deleted file mode 100755 index 8ce3b392..00000000 --- a/createRedist-public.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/bash - -SKETCHBOOK=sketches -TMP=tmp -NAME=PapARt -OUTPUT_NAME=PapARt-public - -## NAME must match -## fr.inria.papart.procam.Utils.LibraryName = "ProCam"; - - -mkdir $TMP -mkdir $TMP/$NAME -mkdir $TMP/$NAME/library -mkdir $TMP/$NAME/examples - - -echo "Cleaning previous versions" -rm -rf libraries/$NAME -echo "Create archive of depedencies" -tar -zcf libs.tgz libraries - - -echo "Cleaning sketches" -sh $SKETCHBOOK/clean.sh - -echo "Copy Library" -# Library -cp papart/target/$NAME.jar $TMP/$NAME/library/$NAME.jar - - -# echo "Copy JavaCV, OpenCV and friends" -# libs are javaCV and javaCV cppjars -# cp libs/* $NAME/library/ - -echo "Copy the deps & tests" -cp -R papart/deps $TMP/$NAME/ -cp -R papart/test $TMP/$NAME/ - -echo "Copy the JavaDoc" -cp -R papart/target/site/apidocs $TMP/$NAME/ - -echo "Copy the Data" -cp -R papart/data $TMP/$NAME/ - - -echo "Copy Examples, Calibration & Apps" -# Examples -cp -R sketches/examples $TMP/$NAME/examples/examples - -# Calibration stuff -cp -R sketches/calibration $TMP/$NAME/examples/calib - -# Apps -cp -R sketches/apps $TMP/$NAME/examples/apps - - -echo "Create the archive..." -cd $TMP - -tar -zcf $OUTPUT_NAME.tgz $NAME - -mv $OUTPUT_NAME.tgz .. -cd .. - -echo "Clean " -rm -rf $TMP - - -echo "Creation OK" diff --git a/createRedist.sh b/createRedist.sh index 6ab03597..21f8170a 100755 --- a/createRedist.sh +++ b/createRedist.sh @@ -1,34 +1,21 @@ #!/bin/bash -SKETCHBOOK=sketches TMP=tmp NAME=PapARt +VERSION=$1 ## NAME must match -## fr.inria.papart.procam.Utils.LibraryName = "ProCam"; - +## fr.inria.papart.procam.Utils.LibraryName = "PapARt" mkdir $TMP mkdir $TMP/$NAME mkdir $TMP/$NAME/library mkdir $TMP/$NAME/examples - -echo "Cleaning previous versions" -rm -rf libraries/$NAME -echo "Create archive of depedencies" -tar -zcf libs.tgz libraries - echo "Copy Library" # Library cp papart/target/$NAME.jar $TMP/$NAME/library/$NAME.jar - -# echo "Copy JavaCV, OpenCV and friends" -# libs are javaCV and javaCV cppjars -# cp libs/* $NAME/library/ - - echo "Copy the sources" # copy the source also cp -R papart/src $TMP/$NAME/ @@ -41,43 +28,18 @@ cp -R papart/target/site/apidocs $TMP/$NAME/ echo "Copy the Data" cp -R papart/data $TMP/$NAME/ - -echo "Download the examples" -wget https://github.com/potioc/Papart-examples/archive/master.zip -unzip master.zip - -mv Papart-examples-master/apps $TMP/$NAME/examples/ -mv Papart-examples-master/papart-examples $TMP/$NAME/examples/ - -echo "cleaning the examples" -rm master.zip -rm -rf Papart-examples-master - - -# Calibration stuff -# cp -R sketches/calibration $TMP/$NAME/examples/calib - -# Now working with github examples and apps. - -# echo "Copy Examples, Calibration & Apps" -# Examples -# cp -R sketches/examples $TMP/$NAME/examples/examples -# Apps -# cp -R sketches/apps $TMP/$NAME/examples/apps +echo "Copy the examples" +cp -R Papart-examples/apps $TMP/$NAME/examples/ +cp -R Papart-examples/papart-examples $TMP/$NAME/examples/ echo "Create the archive..." cd $TMP -tar -zcf $NAME.tgz $NAME +tar -zcf $NAME-$VERSION.tgz $NAME -mv $NAME.tgz .. +mv $NAME-$VERSION.tgz .. cd .. -cp -r $TMP/$NAME libraries/ - -echo "Create full archive : Papart & Deps" -tar -zcf papart-complete.tgz libraries - echo "Clean " rm -rf $TMP diff --git a/deps/.gitignore b/deps/.gitignore new file mode 100644 index 00000000..20811576 --- /dev/null +++ b/deps/.gitignore @@ -0,0 +1,2 @@ +/libraries/ +*.tgz diff --git a/deps/getLibs.sh b/deps/getLibs.sh new file mode 100644 index 00000000..23774a86 --- /dev/null +++ b/deps/getLibs.sh @@ -0,0 +1,78 @@ +#!/bin/bash + + +mkdir libraries + +echo "Get Toxiclibs" + +wget https://bitbucket.org/postspectacular/toxiclibs/downloads/toxiclibs-complete-0020.zip + +unzip toxiclibs-complete-0020.zip +mv audioutils libraries/ +mv colorutils libraries/ +mv datautils libraries/ +mv simutils libraries/ +mv toxiclibscore libraries/ +mv toxiclibs_p5 libraries/ +mv verletphysics libraries/ +mv volumeutils libraries/ + +echo "Get SVGExtended" +wget https://github.com/Rea-lity-Tech/SVGExtended/releases/download/2.3.1/SVGExtended.tgz + +tar xvzf SVGExtended.tgz +mv SVGExtended libraries/ + +echo "Get Processing Video" +#wget https://github.com/processing/processing-video/releases/download/latest/video.zip + +unzip video.zip +unzip video +mv video libraries/ + + +echo "Get Processing TUIO" +wget https://github.com/poqudrof/ProcessingTUIO/releases/download/0.5/processingTUIO.tgz + +tar xvzf processingTUIO.tgz +mv processingTUIO libraries/ + + +echo "Get OSCP5" +wget http://www.sojamo.de/libraries/oscP5/download/oscP5-0.9.8.zip + +unzip oscP5-0.9.8.zip +mv oscP5 libraries/ + +echo "Get Skatolo" +wget https://github.com/poqudrof/Skatolo/releases/download/1.0.1/skatolo.tgz + +tar xvzf skatolo.tgz +mv skatolo libraries/ + +echo "Get Gui Modes" +wget https://github.com/poqudrof/guiModes/releases/download/0.5/guiModes.tgz + +tar xvzf guiModes.tgz +mv guiModes libraries/ + +echo "get Peasycam" +wget http://mrfeinberg.com/peasycam/peasycam_202.zip +unzip peasycam_202.zip +mv peasycam libraries/ + +echo "Compile reflections" +cd reflections-build +ruby createLibs.rb +cp reflections.tgz .. +cd .. +tar xvzf reflections.tgz +mv reflections libraries/ + +echo "Compile JavaCV" +cd javacv-build +ruby createLibs.rb +mv javacv-*.tgz .. + +echo "compile all" +zip -r libraries.zip libraries diff --git a/deps/javacv-build/.gitignore b/deps/javacv-build/.gitignore new file mode 100644 index 00000000..aa1ec1ea --- /dev/null +++ b/deps/javacv-build/.gitignore @@ -0,0 +1 @@ +*.tgz diff --git a/deps/javacv-build/createLibs.rb b/deps/javacv-build/createLibs.rb new file mode 100644 index 00000000..fb7ddd17 --- /dev/null +++ b/deps/javacv-build/createLibs.rb @@ -0,0 +1,36 @@ +#!/bin/ruby + + +platforms = ["linux", "windows"] +archs = ["x86_64", "x86"] + + +def build(platform, arch) + + puts "Build " + platform + %x(cp pom-#{platform}.xml pom.xml) + + puts "Get the library" + + %x(mvn -Dplatform=#{platform}-#{arch} dependency:copy-dependencies) + + %x(rm target/dependency/*linux*) if platform.eql? "windows" + + `mv target/dependency target/library` + `mv target javacv` + `mv javacv/library/javacv-1.3.jar javacv/library/javacv.jar` + + puts "compress library" + `tar -zcf javacv-#{platform}-#{arch}.tgz javacv` + `rm -rf javacv` + + puts "done javacv-" + platform + "-" + arch + + %x(rm pom.xml) +end + +build("linux", "x86_64") +build("windows", "x86_64") +build("windows", "x86") + +# mvn -Dplatform=windows-x86_64 dependency:copy-dependencies diff --git a/deps/javacv-build/pom-linux.xml b/deps/javacv-build/pom-linux.xml new file mode 100644 index 00000000..bb03e5ef --- /dev/null +++ b/deps/javacv-build/pom-linux.xml @@ -0,0 +1,337 @@ + + 4.0.0 + fr.inria + papart-deps + 0.7-SNAPSHOT + jar + + PapARt-deps + Paper Augmented Reality Toolkit + http://papart.gforge.inria.fr + + + + clojars.org + http://clojars.org/repo + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + central + Maven Repository Switchboard + default + http://repo1.maven.org/maven2 + + true + + + + + + + GNU Lesser General Public License version 2 (LGPLv2) + https://www.gnu.org/licenses/lgpl.html + repo + + + + + + Jeremy Laviole + jeremy.laviole@inria.fr + + + + + + linux-${os.arch} + + + + + + + + org.bytedeco + javacpp + 1.3 + + + + org.bytedeco + javacv + 1.3 + + + + org.bytedeco.javacpp-presets + opencv + 3.1.0-1.3 + ${platform} + runtime + + + + org.bytedeco.javacpp-presets + opencv + 3.1.0-1.3 + compile + + + + org.bytedeco.javacpp-presets + artoolkitplus + 2.3.1-1.3 + + + + org.bytedeco.javacpp-presets + artoolkitplus + 2.3.1-1.3 + ${platform} + runtime + + + + org.bytedeco.javacpp-presets + ffmpeg + 3.2.1-1.3 + + + + org.bytedeco.javacpp-presets + ffmpeg + 3.2.1-1.3 + ${platform} + + + + org.bytedeco.javacpp-presets + flycapture + 2.9.3.43-1.3 + + + + + + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 + + + + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 + ${platform} + runtime + + + + + org.bytedeco.javacpp-presets + libfreenect2 + 0.2.0-1.3 + + + org.bytedeco.javacpp-presets + libfreenect2 + 0.2.0-1.3 + ${platform} + runtime + + + + org.bytedeco.javacpp-presets + librealsense + 1.9.6-1.3 + + + + org.bytedeco.javacpp-presets + librealsense + 1.9.6-1.3 + ${platform} + runtime + + + + + + + src + test + target/classes + + + + maven-dependency-plugin + 2.3 + + + + copy-dependencies + + + ${project.build.directory} + true + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + PapARt + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + + + + + src + + **/*.vert + **/*.frag + **/*.glsl + + + + + + + + + + + + linux + + + linux + + + + linux + + + + macosx + + + mac os x + + + + macosx + + + + windows + + + windows + + + + windows + + + + i386 + + + i386 + + + + x86 + + + + i486 + + + i486 + + + + x86 + + + + i586 + + + i586 + + + + x86 + + + + i686 + + + i686 + + + + x86 + + + + amd64 + + + amd64 + + + + x86_64 + + + + x86-64 + + + x86-64 + + + + x86_64 + + + + + + + diff --git a/deps/javacv-build/pom-windows.xml b/deps/javacv-build/pom-windows.xml new file mode 100644 index 00000000..675be854 --- /dev/null +++ b/deps/javacv-build/pom-windows.xml @@ -0,0 +1,335 @@ + + 4.0.0 + fr.inria + papart-deps + 0.7-SNAPSHOT + jar + + PapARt-deps + Paper Augmented Reality Toolkit + http://papart.gforge.inria.fr + + + + clojars.org + http://clojars.org/repo + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + central + Maven Repository Switchboard + default + http://repo1.maven.org/maven2 + + true + + + + + + + GNU Lesser General Public License version 2 (LGPLv2) + https://www.gnu.org/licenses/lgpl.html + repo + + + + + + Jeremy Laviole + jeremy.laviole@inria.fr + + + + + + windows-${os.arch} + + + + + + + org.bytedeco + javacpp + 1.3 + + + + org.bytedeco + javacv + 1.3 + + + + org.bytedeco.javacpp-presets + opencv + 3.1.0-1.3 + ${platform} + runtime + + + + org.bytedeco.javacpp-presets + opencv + 3.1.0-1.3 + compile + + + + org.bytedeco.javacpp-presets + artoolkitplus + 2.3.1-1.3 + + + + org.bytedeco.javacpp-presets + artoolkitplus + 2.3.1-1.3 + ${platform} + runtime + + + + org.bytedeco.javacpp-presets + ffmpeg + 3.2.1-1.3 + + + + org.bytedeco.javacpp-presets + ffmpeg + 3.2.1-1.3 + ${platform} + + + + org.bytedeco.javacpp-presets + flycapture + 2.9.3.43-1.3 + + + + + + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 + + + + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 + ${platform} + runtime + + + + + + + + + + + + + + + + + + + + + + + src + test + target/classes + + + + maven-dependency-plugin + 2.3 + + + + copy-dependencies + + + ${project.build.directory} + true + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + PapARt + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + + + + + src + + **/*.vert + **/*.frag + **/*.glsl + + + + + + + + + + + + linux + + + linux + + + + linux + + + + macosx + + + mac os x + + + + macosx + + + + windows + + + windows + + + + windows + + + + i386 + + + i386 + + + + x86 + + + + i486 + + + i486 + + + + x86 + + + + i586 + + + i586 + + + + x86 + + + + i686 + + + i686 + + + + x86 + + + + amd64 + + + amd64 + + + + x86_64 + + + + x86-64 + + + x86-64 + + + + x86_64 + + + + + + + diff --git a/deps/reflections-build/.gitignore b/deps/reflections-build/.gitignore new file mode 100644 index 00000000..aa1ec1ea --- /dev/null +++ b/deps/reflections-build/.gitignore @@ -0,0 +1 @@ +*.tgz diff --git a/deps/reflections-build/createLibs.rb b/deps/reflections-build/createLibs.rb new file mode 100644 index 00000000..6e0dc93f --- /dev/null +++ b/deps/reflections-build/createLibs.rb @@ -0,0 +1,20 @@ +#!/bin/ruby + +puts "Get the library" + +%x(mvn dependency:copy-dependencies) + +`mv target/dependency target/library` +`mv target reflections` + +`mv reflections/library/reflections-0.9.9.jar reflections/library/reflections.jar` + +puts "compress library" +`tar -zcf reflections.tgz reflections` + + +`rm -rf reflections` + +puts "done reflections" + +# mvn -Dplatform=windows-x86_64 dependency:copy-dependencies diff --git a/deps/reflections-build/pom.xml b/deps/reflections-build/pom.xml new file mode 100644 index 00000000..b0131ad5 --- /dev/null +++ b/deps/reflections-build/pom.xml @@ -0,0 +1,441 @@ + + 4.0.0 + fr.inria + papart-deps + 0.7-SNAPSHOT + jar + + PapARt-deps + Paper Augmented Reality Toolkit + http://papart.gforge.inria.fr + + + + clojars.org + http://clojars.org/repo + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + + central + Maven Repository Switchboard + default + http://repo1.maven.org/maven2 + + true + + + + + + + GNU Lesser General Public License version 2 (LGPLv2) + https://www.gnu.org/licenses/lgpl.html + repo + + + + + + Jeremy Laviole + jeremy.laviole@inria.fr + + + + + + linux-${os.arch} + + + + + + org.reflections + reflections + 0.9.9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + src + test + target/classes + + + + maven-dependency-plugin + 2.3 + + + + copy-dependencies + + + ${project.build.directory} + true + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.2 + + PapARt + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.8 + 1.8 + + + + + + + + src + + **/*.vert + **/*.frag + **/*.glsl + + + + + + + + + + + + linux + + + linux + + + + linux + + + + macosx + + + mac os x + + + + macosx + + + + windows + + + windows + + + + windows + + + + i386 + + + i386 + + + + x86 + + + + i486 + + + i486 + + + + x86 + + + + i586 + + + i586 + + + + x86 + + + + i686 + + + i686 + + + + x86 + + + + amd64 + + + amd64 + + + + x86_64 + + + + x86-64 + + + x86-64 + + + + x86_64 + + + + + + + diff --git a/downloadExamples.sh b/downloadExamples.sh new file mode 100644 index 00000000..cbac6c8b --- /dev/null +++ b/downloadExamples.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +BRANCH=realsense + +echo "Download the examples" +wget https://github.com/potioc/Papart-examples/archive/$BRANCH.zip +unzip $BRANCH.zip + +mv Papart-examples-$BRANCH Papart-examples + +echo "cleaning the examples" +rm $BRANCH.zip diff --git a/linkExamples.sh b/linkExamples.sh new file mode 100644 index 00000000..f7b08878 --- /dev/null +++ b/linkExamples.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +ln -s ../../../Papart-examples/papart-examples papart/src/ diff --git a/mergeCurrentToRedist.rb b/mergeCurrentToRedist.rb new file mode 100644 index 00000000..e36f8470 --- /dev/null +++ b/mergeCurrentToRedist.rb @@ -0,0 +1,20 @@ +#!/bin/ruby + + + + +current_branch = %x(git rev-parse --abbrev-ref HEAD).chomp + +output_names=["realsense", + "kinect", + "hardware2", + "hardware3"] + +output_names.each do |release_name| + puts %x(git checkout release-#{release_name}) + puts %x(git merge --commit -m "automatic merge for deployment" #{current_branch}) + + puts %x(git push github release-#{release_name}) +end + +puts %x(git checkout #{current_branch}) diff --git a/papart/SR300.txt b/papart/SR300.txt new file mode 100644 index 00000000..a52f0f50 --- /dev/null +++ b/papart/SR300.txt @@ -0,0 +1,38 @@ +## Working options + +## Not working auto range + +# Change les points 3D +F200_FILTER_OPTION +0 - 7 + +# F200_ACCURACY +1 - 3 + +# F200_CONFIDENCE_THRESHOLD +0 - 15 + +# F200_LASER_POWER +0 - 1 (more has no effect) + +# Color Options + +# COLOR_SHARPNESS +0 - 100 + +# COLOR_GAMMA +100 - 500 // 300 - mid + +# COLOR_GAIN +0 - 128 + +# COLOR_CONTRAST +0 - 100 + +# COLOR_BRIGHTNESS +-64 - 64 + + +IVCAM options preset +0 - 8 + diff --git a/papart/data/Font/CenturySchL-Bold-10.vlw b/papart/data/Font/CenturySchL-Bold-10.vlw deleted file mode 100755 index e7dbbc12..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-10.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-11.vlw b/papart/data/Font/CenturySchL-Bold-11.vlw deleted file mode 100755 index 87532607..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-11.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-12.vlw b/papart/data/Font/CenturySchL-Bold-12.vlw deleted file mode 100755 index 85c0bf85..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-12.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-13.vlw b/papart/data/Font/CenturySchL-Bold-13.vlw deleted file mode 100755 index d5ca7c10..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-13.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-14.vlw b/papart/data/Font/CenturySchL-Bold-14.vlw deleted file mode 100755 index ecf2a228..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-14.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-15.vlw b/papart/data/Font/CenturySchL-Bold-15.vlw deleted file mode 100755 index ebdc8e7c..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-15.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-16.vlw b/papart/data/Font/CenturySchL-Bold-16.vlw deleted file mode 100755 index 7fee1c4d..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-16.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-20.vlw b/papart/data/Font/CenturySchL-Bold-20.vlw deleted file mode 100755 index 2adbc86d..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-20.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-23.vlw b/papart/data/Font/CenturySchL-Bold-23.vlw deleted file mode 100755 index 6622707b..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-23.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-35.vlw b/papart/data/Font/CenturySchL-Bold-35.vlw deleted file mode 100755 index f90d4255..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-35.vlw and /dev/null differ diff --git a/papart/data/Font/CenturySchL-Bold-48.vlw b/papart/data/Font/CenturySchL-Bold-48.vlw deleted file mode 100755 index c528080d..00000000 Binary files a/papart/data/Font/CenturySchL-Bold-48.vlw and /dev/null differ diff --git a/papart/data/Font/DejaVuSerif-130.vlw b/papart/data/Font/DejaVuSerif-130.vlw deleted file mode 100644 index 4231f0d8..00000000 Binary files a/papart/data/Font/DejaVuSerif-130.vlw and /dev/null differ diff --git a/papart/data/Font/DejaVuSerif-40.vlw b/papart/data/Font/DejaVuSerif-40.vlw deleted file mode 100644 index af194f12..00000000 Binary files a/papart/data/Font/DejaVuSerif-40.vlw and /dev/null differ diff --git a/papart/data/Font/DejaVuSerifCondensed-50.vlw b/papart/data/Font/DejaVuSerifCondensed-50.vlw deleted file mode 100755 index 48aae779..00000000 Binary files a/papart/data/Font/DejaVuSerifCondensed-50.vlw and /dev/null differ diff --git a/papart/data/Font/DejaVuSerifCondensed-80.vlw b/papart/data/Font/DejaVuSerifCondensed-80.vlw deleted file mode 100755 index b8ad7178..00000000 Binary files a/papart/data/Font/DejaVuSerifCondensed-80.vlw and /dev/null differ diff --git a/papart/data/Font/FreeSans-13.vlw b/papart/data/Font/FreeSans-13.vlw deleted file mode 100755 index c522bda4..00000000 Binary files a/papart/data/Font/FreeSans-13.vlw and /dev/null differ diff --git a/papart/data/Font/FreeSans-60.vlw b/papart/data/Font/FreeSans-60.vlw deleted file mode 100644 index 7bd70546..00000000 Binary files a/papart/data/Font/FreeSans-60.vlw and /dev/null differ diff --git a/papart/data/Font/GentiumBookBasic-14.vlw b/papart/data/Font/GentiumBookBasic-14.vlw deleted file mode 100644 index 81e153ed..00000000 Binary files a/papart/data/Font/GentiumBookBasic-14.vlw and /dev/null differ diff --git a/papart/data/Font/GentiumBookBasic-48.vlw b/papart/data/Font/GentiumBookBasic-48.vlw deleted file mode 100644 index e4bc2ede..00000000 Binary files a/papart/data/Font/GentiumBookBasic-48.vlw and /dev/null differ diff --git a/papart/data/calibration/calibration-SR300-IR.yaml b/papart/data/calibration/calibration-SR300-IR.yaml new file mode 100644 index 00000000..a95d8de1 --- /dev/null +++ b/papart/data/calibration/calibration-SR300-IR.yaml @@ -0,0 +1,57 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 5.0108531316129177e+02, 0., 3.1123937785847426e+02, 0., + 5.0098158746553992e+02, 2.2758792366760716e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.9267176092789367e-02, 1.1415116817508220e-01, + -4.7560735699466936e-03, 7.1324162329464906e-04 ] + extrParams: !!opencv-matrix + rows: 6 + cols: 6 + dt: d + data: [ -2.7616393151085489e-01, 4.0493829044650781e-01, + -2.9972920623529213e+00, 1.8330924409745330e+02, + 8.4584482716149935e+01, 5.1673274829395302e+02, + -7.6224613024282600e-02, 1.4294486777997414e-01, + -3.0971407865344642e+00, 1.2294785388182116e+02, + 1.9530751459804006e+02, 4.7152663287301186e+02, + -4.1274348016859669e-01, 5.9670753980057251e-02, + -4.4319894409097532e-02, -2.1691112395714833e+02, + -1.0398322427487786e+02, 4.5226914043088146e+02, + -2.5896132099457447e-01, 2.2677976066895894e-02, + -1.5674292653338202e+00, -1.3191801607264307e+02, + 2.0840876104642425e+02, 4.6239150130365539e+02, + -2.7470112720277079e-02, 2.0402533655250372e-02, + -3.0876816059789696e+00, 1.3209886657743695e+02, + 2.1047029210777495e+02, 4.4397170029289146e+02, + -3.2396505058535377e-02, 5.4303790186440833e-02, + -3.1005852646843128e+00, 1.5719446710895525e+02, + 1.9918046885957739e+02, 4.4189906215675313e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 6 + dt: d + data: [ 3.5962951144938232e-01, 4.0430700385527379e-01, + 4.7774842849831095e-01, 4.9068333246640189e-01, + 3.8831823927167580e-01, 4.4406742945905525e-01 ] + avgReprojErr: 4.3133841633122860e-01 + maxReprojErr: 9.6511574460593097e-01 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/cameraKinectConfiguration.xml b/papart/data/calibration/depthCameraConfiguration.xml similarity index 50% rename from papart/data/calibration/cameraKinectConfiguration.xml rename to papart/data/calibration/depthCameraConfiguration.xml index 40c79d32..3d75175a 100644 --- a/papart/data/calibration/cameraKinectConfiguration.xml +++ b/papart/data/calibration/depthCameraConfiguration.xml @@ -1,4 +1,4 @@ - + diff --git a/papart/data/calibration/saved/camera-SR300-720p.yaml b/papart/data/calibration/saved/camera-SR300-720p.yaml new file mode 100644 index 00000000..3177fe71 --- /dev/null +++ b/papart/data/calibration/saved/camera-SR300-720p.yaml @@ -0,0 +1,71 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 1280 + imageHeight: 720 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 6.9476211e+02, 0., 4.662133e+02, 0., + 6.9476211e+02, 2.81446e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.2177352964304565e-01, -2.6007913105329256e-01, + -5.9578551006836851e-03, -1.4334539897586079e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -1.7607844755616370e-01, -1.2820713376722212e-01, + 1.5460774537187465e+00, 3.9691618786981451e+01, + -2.0418669774626716e+02, 6.4351403964187080e+02, + -1.7811130302287448e-01, -1.4706364694033458e-01, + 1.5843252636738345e+00, 4.5596623077623697e+01, + -2.2165788108081981e+02, 6.3827216502127044e+02, + 2.4781484476754240e-01, -6.7208474024433540e-01, + 3.0240918432584216e+00, 3.0597905812808028e+02, + 8.7979651732451387e+01, 6.0729733866327001e+02, + -1.2602515731264630e-02, 1.0104651192342044e-01, + -1.7992790663995890e+00, -1.1842522426386454e+02, + 3.2234544947681246e+02, 7.6469853273604872e+02, + 5.1147621677178085e-03, 1.7371891574406548e-01, + -1.8097693911394694e+00, -8.9179918593347736e+01, + 2.6838940269947079e+02, 7.7410825633252318e+02, + -1.1794349372064081e-01, 1.9322399324060713e-01, + -3.0305507980128330e+00, 2.1837440238945572e+02, + 3.0684021053236972e+02, 7.1485559885164059e+02, + -1.3753434037022760e-01, 1.8470375069357825e-01, + -3.1243272857107169e+00, 2.5517623452792574e+02, + 3.2064272373774821e+02, 7.0213260954811710e+02, + 1.0433239555743316e-01, -2.8159889631200224e-01, + 3.1030888317227983e+00, 2.3864305820545394e+02, + 4.8062175037148895e+00, 5.9512481887669003e+02, + 1.1115187521034058e-01, -1.7039573484898449e-01, + 3.1095106342789514e+00, 2.4488515071801882e+02, + 6.2753077906758733e+01, 5.9891939499910268e+02, + -1.1577350344439789e-01, 7.9903129906887749e-02, + -3.1169111581000437e+00, 2.4176659799043321e+02, + 1.1668424414898595e+02, 5.9571494908538386e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 4.1340083848000114e-01, 3.9111806492508300e-01, + 9.7959596925818160e-01, 5.7347563761640497e-01, + 5.0807880449963017e-01, 7.0972237707286367e-01, + 8.7904455182929297e-01, 6.3547446324029178e-01, + 5.8412414368759535e-01, 5.0332289266443064e-01 ] + avgReprojErr: 6.3779671784126868e-01 + maxReprojErr: 2.4731437660509830e+00 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/camera-SR300-960.yaml b/papart/data/calibration/saved/camera-SR300-960.yaml new file mode 100644 index 00000000..d526bf2a --- /dev/null +++ b/papart/data/calibration/saved/camera-SR300-960.yaml @@ -0,0 +1,71 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 960 + imageHeight: 540 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 6.9476211e+02, 0., 4.662133e+02, 0., + 6.9476211e+02, 2.81446e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.2177352964304565e-01, -2.6007913105329256e-01, + -5.9578551006836851e-03, -1.4334539897586079e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -1.7607844755616370e-01, -1.2820713376722212e-01, + 1.5460774537187465e+00, 3.9691618786981451e+01, + -2.0418669774626716e+02, 6.4351403964187080e+02, + -1.7811130302287448e-01, -1.4706364694033458e-01, + 1.5843252636738345e+00, 4.5596623077623697e+01, + -2.2165788108081981e+02, 6.3827216502127044e+02, + 2.4781484476754240e-01, -6.7208474024433540e-01, + 3.0240918432584216e+00, 3.0597905812808028e+02, + 8.7979651732451387e+01, 6.0729733866327001e+02, + -1.2602515731264630e-02, 1.0104651192342044e-01, + -1.7992790663995890e+00, -1.1842522426386454e+02, + 3.2234544947681246e+02, 7.6469853273604872e+02, + 5.1147621677178085e-03, 1.7371891574406548e-01, + -1.8097693911394694e+00, -8.9179918593347736e+01, + 2.6838940269947079e+02, 7.7410825633252318e+02, + -1.1794349372064081e-01, 1.9322399324060713e-01, + -3.0305507980128330e+00, 2.1837440238945572e+02, + 3.0684021053236972e+02, 7.1485559885164059e+02, + -1.3753434037022760e-01, 1.8470375069357825e-01, + -3.1243272857107169e+00, 2.5517623452792574e+02, + 3.2064272373774821e+02, 7.0213260954811710e+02, + 1.0433239555743316e-01, -2.8159889631200224e-01, + 3.1030888317227983e+00, 2.3864305820545394e+02, + 4.8062175037148895e+00, 5.9512481887669003e+02, + 1.1115187521034058e-01, -1.7039573484898449e-01, + 3.1095106342789514e+00, 2.4488515071801882e+02, + 6.2753077906758733e+01, 5.9891939499910268e+02, + -1.1577350344439789e-01, 7.9903129906887749e-02, + -3.1169111581000437e+00, 2.4176659799043321e+02, + 1.1668424414898595e+02, 5.9571494908538386e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 4.1340083848000114e-01, 3.9111806492508300e-01, + 9.7959596925818160e-01, 5.7347563761640497e-01, + 5.0807880449963017e-01, 7.0972237707286367e-01, + 8.7904455182929297e-01, 6.3547446324029178e-01, + 5.8412414368759535e-01, 5.0332289266443064e-01 ] + avgReprojErr: 6.3779671784126868e-01 + maxReprojErr: 2.4731437660509830e+00 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/camera-SR300-IR.yaml b/papart/data/calibration/saved/camera-SR300-IR.yaml new file mode 100644 index 00000000..a95d8de1 --- /dev/null +++ b/papart/data/calibration/saved/camera-SR300-IR.yaml @@ -0,0 +1,57 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 5.0108531316129177e+02, 0., 3.1123937785847426e+02, 0., + 5.0098158746553992e+02, 2.2758792366760716e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.9267176092789367e-02, 1.1415116817508220e-01, + -4.7560735699466936e-03, 7.1324162329464906e-04 ] + extrParams: !!opencv-matrix + rows: 6 + cols: 6 + dt: d + data: [ -2.7616393151085489e-01, 4.0493829044650781e-01, + -2.9972920623529213e+00, 1.8330924409745330e+02, + 8.4584482716149935e+01, 5.1673274829395302e+02, + -7.6224613024282600e-02, 1.4294486777997414e-01, + -3.0971407865344642e+00, 1.2294785388182116e+02, + 1.9530751459804006e+02, 4.7152663287301186e+02, + -4.1274348016859669e-01, 5.9670753980057251e-02, + -4.4319894409097532e-02, -2.1691112395714833e+02, + -1.0398322427487786e+02, 4.5226914043088146e+02, + -2.5896132099457447e-01, 2.2677976066895894e-02, + -1.5674292653338202e+00, -1.3191801607264307e+02, + 2.0840876104642425e+02, 4.6239150130365539e+02, + -2.7470112720277079e-02, 2.0402533655250372e-02, + -3.0876816059789696e+00, 1.3209886657743695e+02, + 2.1047029210777495e+02, 4.4397170029289146e+02, + -3.2396505058535377e-02, 5.4303790186440833e-02, + -3.1005852646843128e+00, 1.5719446710895525e+02, + 1.9918046885957739e+02, 4.4189906215675313e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 6 + dt: d + data: [ 3.5962951144938232e-01, 4.0430700385527379e-01, + 4.7774842849831095e-01, 4.9068333246640189e-01, + 3.8831823927167580e-01, 4.4406742945905525e-01 ] + avgReprojErr: 4.3133841633122860e-01 + maxReprojErr: 9.6511574460593097e-01 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/camera-SR300-depth.yaml b/papart/data/calibration/saved/camera-SR300-depth.yaml new file mode 100644 index 00000000..c9eef5ec --- /dev/null +++ b/papart/data/calibration/saved/camera-SR300-depth.yaml @@ -0,0 +1,71 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 4.761198e+02, 0., 3.1486e+02, 0., + 4.761198e+02, 2.460912e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.2177352964304565e-01, -2.6007913105329256e-01, + -5.9578551006836851e-03, -1.4334539897586079e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -1.7607844755616370e-01, -1.2820713376722212e-01, + 1.5460774537187465e+00, 3.9691618786981451e+01, + -2.0418669774626716e+02, 6.4351403964187080e+02, + -1.7811130302287448e-01, -1.4706364694033458e-01, + 1.5843252636738345e+00, 4.5596623077623697e+01, + -2.2165788108081981e+02, 6.3827216502127044e+02, + 2.4781484476754240e-01, -6.7208474024433540e-01, + 3.0240918432584216e+00, 3.0597905812808028e+02, + 8.7979651732451387e+01, 6.0729733866327001e+02, + -1.2602515731264630e-02, 1.0104651192342044e-01, + -1.7992790663995890e+00, -1.1842522426386454e+02, + 3.2234544947681246e+02, 7.6469853273604872e+02, + 5.1147621677178085e-03, 1.7371891574406548e-01, + -1.8097693911394694e+00, -8.9179918593347736e+01, + 2.6838940269947079e+02, 7.7410825633252318e+02, + -1.1794349372064081e-01, 1.9322399324060713e-01, + -3.0305507980128330e+00, 2.1837440238945572e+02, + 3.0684021053236972e+02, 7.1485559885164059e+02, + -1.3753434037022760e-01, 1.8470375069357825e-01, + -3.1243272857107169e+00, 2.5517623452792574e+02, + 3.2064272373774821e+02, 7.0213260954811710e+02, + 1.0433239555743316e-01, -2.8159889631200224e-01, + 3.1030888317227983e+00, 2.3864305820545394e+02, + 4.8062175037148895e+00, 5.9512481887669003e+02, + 1.1115187521034058e-01, -1.7039573484898449e-01, + 3.1095106342789514e+00, 2.4488515071801882e+02, + 6.2753077906758733e+01, 5.9891939499910268e+02, + -1.1577350344439789e-01, 7.9903129906887749e-02, + -3.1169111581000437e+00, 2.4176659799043321e+02, + 1.1668424414898595e+02, 5.9571494908538386e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 4.1340083848000114e-01, 3.9111806492508300e-01, + 9.7959596925818160e-01, 5.7347563761640497e-01, + 5.0807880449963017e-01, 7.0972237707286367e-01, + 8.7904455182929297e-01, 6.3547446324029178e-01, + 5.8412414368759535e-01, 5.0332289266443064e-01 ] + avgReprojErr: 6.3779671784126868e-01 + maxReprojErr: 2.4731437660509830e+00 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/camera-sr300-1080p.yaml b/papart/data/calibration/saved/camera-sr300-1080p.yaml new file mode 100644 index 00000000..5bf0636e --- /dev/null +++ b/papart/data/calibration/saved/camera-sr300-1080p.yaml @@ -0,0 +1,71 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + [] +Camera 0: + imageWidth: 1920 + imageHeight: 1080 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 6.9476211e+02, 0., 4.662133e+02, 0., + 6.9476211e+02, 2.81446e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.2177352964304565e-01, -2.6007913105329256e-01, + -5.9578551006836851e-03, -1.4334539897586079e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -1.7607844755616370e-01, -1.2820713376722212e-01, + 1.5460774537187465e+00, 3.9691618786981451e+01, + -2.0418669774626716e+02, 6.4351403964187080e+02, + -1.7811130302287448e-01, -1.4706364694033458e-01, + 1.5843252636738345e+00, 4.5596623077623697e+01, + -2.2165788108081981e+02, 6.3827216502127044e+02, + 2.4781484476754240e-01, -6.7208474024433540e-01, + 3.0240918432584216e+00, 3.0597905812808028e+02, + 8.7979651732451387e+01, 6.0729733866327001e+02, + -1.2602515731264630e-02, 1.0104651192342044e-01, + -1.7992790663995890e+00, -1.1842522426386454e+02, + 3.2234544947681246e+02, 7.6469853273604872e+02, + 5.1147621677178085e-03, 1.7371891574406548e-01, + -1.8097693911394694e+00, -8.9179918593347736e+01, + 2.6838940269947079e+02, 7.7410825633252318e+02, + -1.1794349372064081e-01, 1.9322399324060713e-01, + -3.0305507980128330e+00, 2.1837440238945572e+02, + 3.0684021053236972e+02, 7.1485559885164059e+02, + -1.3753434037022760e-01, 1.8470375069357825e-01, + -3.1243272857107169e+00, 2.5517623452792574e+02, + 3.2064272373774821e+02, 7.0213260954811710e+02, + 1.0433239555743316e-01, -2.8159889631200224e-01, + 3.1030888317227983e+00, 2.3864305820545394e+02, + 4.8062175037148895e+00, 5.9512481887669003e+02, + 1.1115187521034058e-01, -1.7039573484898449e-01, + 3.1095106342789514e+00, 2.4488515071801882e+02, + 6.2753077906758733e+01, 5.9891939499910268e+02, + -1.1577350344439789e-01, 7.9903129906887749e-02, + -3.1169111581000437e+00, 2.4176659799043321e+02, + 1.1668424414898595e+02, 5.9571494908538386e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 4.1340083848000114e-01, 3.9111806492508300e-01, + 9.7959596925818160e-01, 5.7347563761640497e-01, + 5.0807880449963017e-01, 7.0972237707286367e-01, + 8.7904455182929297e-01, 6.3547446324029178e-01, + 5.8412414368759535e-01, 5.0332289266443064e-01 ] + avgReprojErr: 6.3779671784126868e-01 + maxReprojErr: 2.4731437660509830e+00 + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/projector-P3B.xml b/papart/data/calibration/saved/projector-P3B.xml new file mode 100644 index 00000000..2a191def --- /dev/null +++ b/papart/data/calibration/saved/projector-P3B.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/papart/data/calibration/saved/projector-p3B-Facing.yaml b/papart/data/calibration/saved/projector-p3B-Facing.yaml new file mode 100644 index 00000000..0c149425 --- /dev/null +++ b/papart/data/calibration/saved/projector-p3B-Facing.yaml @@ -0,0 +1,260 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + - Projector 0 +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 5.4330694194797138e+02, 0., 3.2813246387174814e+02, 0., + 5.4391399823499341e+02, 2.2636239019263962e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ -1.0915791546794845e-01, 1.5165369264909634e-01, + 1.0733567701286893e-03, 6.4020869566235419e-04 ] + extrParams: !!opencv-matrix + rows: 20 + cols: 6 + dt: d + data: [ -8.0036463591021054e-02, -5.1752398217073781e-01, + 2.9768503337419818e+00, 3.7832286694793271e+02, + 2.2026516329066774e+02, 8.4450789500099654e+02, + -8.9218514079821370e-02, -5.5382935622292240e-01, + 2.9891463354234942e+00, 3.0416302139962892e+02, + 1.0318862964340526e+02, 7.9776161594924565e+02, + 3.7900967244023026e-01, 2.5055166025157832e-01, + -1.5842792758839130e+00, -3.5435094234466175e+02, + 3.1639535217814080e+02, 8.4008597006090065e+02, + 3.6674461337280007e-01, -5.8683935324790548e-02, + -1.2613060896947650e-01, -2.7047065457899384e+02, + -1.5146552368170833e+02, 6.5126102800520198e+02, + 3.4174885293696600e-01, -2.6444271258025720e-01, + 1.6776171376626183e+00, 3.1092825576036705e+02, + -1.5180948040185285e+02, 6.4792324403413454e+02, + 4.0217885661629404e-01, -6.3173599767317887e-02, + -1.1855994553107792e-01, -2.6528290949597169e+02, + -1.6433175030942974e+02, 6.4579213325101989e+02, + 3.7729500397104448e-01, 2.5411839785800644e-01, + -1.5920999419516968e+00, -9.1685413438351574e+01, + 2.2014421305541984e+02, 8.2397961797907317e+02, + 1.8543654196331094e-01, 4.7172455712937283e-01, + -2.9477266488815732e+00, 6.0483407120981120e+01, + 2.2036019264521576e+02, 8.1012569537519346e+02, + 3.9872116159787435e-01, -2.2595918644259921e-01, + 1.5821452242004439e+00, 2.1942353356866812e+02, + -1.5294269447300303e+02, 6.2143273701106045e+02, + 2.1762656492494975e-01, -1.7791004328661417e-01, + 3.0308592261175693e-01, -2.4388389104303178e+02, + -1.3297246896568512e+02, 6.5280185021944601e+02, + -5.8293633204356592e-02, -5.9098581210046991e-02, + -8.9530762460421812e-02, -3.2321798044797049e+02, + -1.9618498443549377e+01, 6.8277496563927434e+02, + 3.5479985545926344e-02, -3.5611413591438046e-02, + -1.3232314047767793e-01, -1.2625821191982124e+02, + -2.5618913672336170e+01, 7.0385601784256005e+02, + 3.9211464190881729e-01, 2.1549658730119634e-01, + -1.4130773420718574e+00, -8.5523550079182243e+01, + 2.2984725360266845e+02, 8.2839582713436994e+02, + -2.1486395613228168e-01, -3.7473924531076987e-02, + -1.2192808652877701e-01, -2.5656431082473205e+02, + -3.8123930453167198e+01, 6.7578066921389507e+02, + -7.6289590058333828e-02, 2.9437340489530678e-01, + -7.8882840818867728e-01, -1.8217958163924104e+02, + 1.1097414929505841e+02, 7.4697035931731625e+02, + 8.7261956598297750e-03, -2.5237562752235082e-01, + 4.0351738841864915e-01, -2.3003814892692472e+02, + -1.4085825565455085e+02, 6.4516413702574084e+02, + -1.0555940811495185e-01, -4.6016602388014177e-01, + 3.0413421435923813e+00, 1.7441295323315637e+02, + 1.8734846533607646e+02, 7.9752317516395408e+02, + -9.1039990089083159e-02, -4.7519483656498479e-01, + 3.0032666117681273e+00, 3.2194871941055681e+02, + 1.5780707108135309e+02, 8.0321966331036128e+02, + -9.9552946449581819e-02, 1.0618837568091075e-01, + 3.0712556287925636e+00, 2.6929107633919546e+02, + 1.6439659778260724e+02, 6.6777875570616368e+02, + 1.5338089670609836e-01, 2.7372008867012287e-01, + -3.0935183198006868e+00, 1.7108269571471331e+02, + 2.0605011286974738e+02, 7.6112262118424530e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 20 + dt: d + data: [ 3.5773324527368561e-01, 4.4413915970770379e-01, + 4.5170444688059863e-01, 3.8137608802180739e-01, + 4.8504427729700922e-01, 4.0836310886972477e-01, + 5.3689523918086579e-01, 4.2198860090040929e-01, + 4.0169225895790017e-01, 3.7113508446024807e-01, + 3.6899942828720822e-01, 4.6215828398327491e-01, + 5.8726361927033932e-01, 3.2707933630218655e-01, + 2.3008301964905439e-01, 3.9189981831041298e-01, + 4.9289776074319019e-01, 4.5883509180190452e-01, + 3.2354694741349549e-01, 4.6654356860922008e-01 ] + avgReprojErr: 4.2450029623819413e-01 + maxReprojErr: 1.0800357572306361e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 0., 0., 0. ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. +Projector 0: + imageWidth: 1280 + imageHeight: 800 + responseGamma: 2.2000000000000002e+00 + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1.01525e+03, 0., 6.336e+02, 0., + 1.01525e+03, 3.6e+1, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ -3.9725914252164513e-02, 1.5719194938912929e-02, + 1.2401622635113425e-03, -1.6059312696931278e-03 ] + extrParams: !!opencv-matrix + rows: 20 + cols: 6 + dt: d + data: [ -1.6565501174976432e-01, 7.6844179042392380e-03, + -9.9088261519558376e-03, -3.6368977632228655e+02, + -4.8275957463821578e+02, 7.3008924531529851e+02, + -1.8988262046868867e-01, 9.6925486362167794e-03, + 9.6038258946726483e-03, -3.0176761764663132e+02, + -3.5138605896557544e+02, 7.0773201856215189e+02, + -1.4939186918764780e-01, 1.8644971347895634e-01, + 1.6372090749144861e+00, 3.7703726325803393e+02, + -4.9800619130231672e+02, 7.4541489911049553e+02, + 1.6143781336867585e-02, 2.9449535152621459e-01, + 3.1123367778616138e+00, 2.4339756937867477e+02, + -1.3063683809320253e+01, 6.3668744375635754e+02, + -6.0893308205941091e-02, -2.3284096812199140e-01, + -1.3365799371822504e+00, -3.3476586958192604e+02, + -7.6178033792564250e+01, 6.0799900862161849e+02, + 1.4005735885903960e-02, 3.5105039187963927e-01, + 3.1125022782761307e+00, 2.3693036304879922e+02, + -2.8568142368075439e-01, 6.3394886470640097e+02, + -1.5741993921112510e-01, 1.8478387897529949e-01, + 1.6305932554102116e+00, 1.0406075200986754e+02, + -4.2788257675892862e+02, 7.3209268211894357e+02, + -1.4866186062953998e-01, 5.0660440509027509e-02, + 2.6724071345270300e-01, -4.6583844679371246e+01, + -4.4200775191882667e+02, 7.1114047883908177e+02, + -2.2237444218611055e-02, -2.9190586569261168e-01, + -1.4315121305171044e+00, -2.4288601022040885e+02, + -6.0107906630516347e+01, 5.8587667480462164e+02, + -1.3383891526480721e-01, -7.3567680347234238e-02, + -2.7119893022687500e+00, 2.1893984049240541e+02, + -3.4745132969778446e+01, 6.3460903638692776e+02, + -4.8360883487703767e-02, 3.7555613593326970e-01, + -3.0885382600450790e+00, 3.1021668918418771e+02, + -1.4279947203664204e+02, 6.4817735443900926e+02, + 1.4513043987067846e-02, -2.2256963064512844e-01, + 3.1170802497860288e+00, 1.1309297113627383e+02, + -1.6178733846103702e+02, 6.5795222209566839e+02, + -1.4380881311468280e-01, 2.0862689738926013e-01, + 1.8111838979482744e+00, 9.8806599586769153e+01, + -4.3844118798338627e+02, 7.3383986725458055e+02, + 3.0112585551035010e-02, -6.0810321767227582e-01, + 3.0803437007890562e+00, 2.4203276452222789e+02, + -1.3041657973644365e+02, 6.4059315652748614e+02, + -3.2377127658349375e-01, -3.5699426326638739e-01, + 2.3978157304076744e+00, 1.8322530323931167e+02, + -2.9698646099132424e+02, 6.8043893394560678e+02, + -2.3099316037654685e-01, 1.9230664157044738e-01, + -2.5882825467021715e+00, 2.0475842471165492e+02, + -2.7455780575134913e+01, 6.2761279522019368e+02, + -1.2263756600610767e-01, 2.1292870578208025e-02, + 4.9730197474780739e-02, -1.6313097669984086e+02, + -4.2060277859646811e+02, 7.0054840801594992e+02, + -1.3400047086022487e-01, 9.4333004637413027e-03, + 1.0288980150924642e-02, -3.1394483299575592e+02, + -4.0800556941075212e+02, 7.0208214890871852e+02, + 2.4372974097728858e-01, 3.5302527318755175e-02, + 5.3809308751254725e-02, -2.5636153627376171e+02, + -3.8427551842628026e+02, 5.7115961427673369e+02, + 3.7494708186333641e-04, 4.5800720493244511e-02, + 1.5073060962530443e-01, -1.5671032165501393e+02, + -4.3134746108165967e+02, 6.5951979239585671e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 20 + dt: d + data: [ 4.4838025484459199e-01, 4.4929580640908989e-01, + 3.9203208369363124e-01, 3.4321653025028909e-01, + 4.5930572096873618e-01, 3.7065470302226500e-01, + 4.9213644418001867e-01, 3.6477042080264094e-01, + 7.4682573138073460e-01, 4.4965469127582031e-01, + 4.5630602413518806e-01, 3.7624618412907479e-01, + 6.7498543538669153e-01, 3.7476903570750086e-01, + 3.9868166654567755e-01, 1.9790820877638307e-01, + 4.5666275430331965e-01, 4.3541246901932890e-01, + 2.5419988314055963e-01, 3.2595677631185493e-01 ] + avgReprojErr: 4.3942414533823654e-01 + maxReprojErr: 1.3265849486322991e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -9.9286711543274231e-01, 1.1570567121908509e-01, + -2.8759150543898930e-02, -1.0848472041738899e-01, + -9.7679914542462176e-01, -1.8464694672181747e-01, + -4.9456612583421052e-02, -1.8020995295895770e-01, + 9.8238404726782047e-01 ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 1.1067357202823974e+01, -7.0390837297746913e+01, + -4.3855958230614874e+01 ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -1.2764089976276507e+00, -3.0153333043273900e+01, + -7.7248704417973855e+01, 4.4090492740471824e+01, + -3.0799351631285639e+00, -9.6111350564676830e+00, + -7.1089386732617200e+01, -2.6659659806182727e+00, + -4.0679344025381603e+00 ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -1.9732341756556793e-08, -4.6562802802395681e-07, + -5.3694600107161258e-04, 6.8150829629382099e-07, + -4.7553532828009189e-08, -2.9357415552722262e-04, + -1.8547824812829414e-03, 3.0152613717838799e-04, + 9.9999999999999989e-01 ] + avgEpipolarErr: 4.5130478957733655e-01 + maxEpipolarErr: 1.6255448850683165e+00 + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/projector-p3B-default.yaml b/papart/data/calibration/saved/projector-p3B-default.yaml new file mode 100644 index 00000000..636f87a2 --- /dev/null +++ b/papart/data/calibration/saved/projector-p3B-default.yaml @@ -0,0 +1,260 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + - Projector 0 +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 5.4330694194797138e+02, 0., 3.2813246387174814e+02, 0., + 5.4391399823499341e+02, 2.2636239019263962e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ -1.0915791546794845e-01, 1.5165369264909634e-01, + 1.0733567701286893e-03, 6.4020869566235419e-04 ] + extrParams: !!opencv-matrix + rows: 20 + cols: 6 + dt: d + data: [ -8.0036463591021054e-02, -5.1752398217073781e-01, + 2.9768503337419818e+00, 3.7832286694793271e+02, + 2.2026516329066774e+02, 8.4450789500099654e+02, + -8.9218514079821370e-02, -5.5382935622292240e-01, + 2.9891463354234942e+00, 3.0416302139962892e+02, + 1.0318862964340526e+02, 7.9776161594924565e+02, + 3.7900967244023026e-01, 2.5055166025157832e-01, + -1.5842792758839130e+00, -3.5435094234466175e+02, + 3.1639535217814080e+02, 8.4008597006090065e+02, + 3.6674461337280007e-01, -5.8683935324790548e-02, + -1.2613060896947650e-01, -2.7047065457899384e+02, + -1.5146552368170833e+02, 6.5126102800520198e+02, + 3.4174885293696600e-01, -2.6444271258025720e-01, + 1.6776171376626183e+00, 3.1092825576036705e+02, + -1.5180948040185285e+02, 6.4792324403413454e+02, + 4.0217885661629404e-01, -6.3173599767317887e-02, + -1.1855994553107792e-01, -2.6528290949597169e+02, + -1.6433175030942974e+02, 6.4579213325101989e+02, + 3.7729500397104448e-01, 2.5411839785800644e-01, + -1.5920999419516968e+00, -9.1685413438351574e+01, + 2.2014421305541984e+02, 8.2397961797907317e+02, + 1.8543654196331094e-01, 4.7172455712937283e-01, + -2.9477266488815732e+00, 6.0483407120981120e+01, + 2.2036019264521576e+02, 8.1012569537519346e+02, + 3.9872116159787435e-01, -2.2595918644259921e-01, + 1.5821452242004439e+00, 2.1942353356866812e+02, + -1.5294269447300303e+02, 6.2143273701106045e+02, + 2.1762656492494975e-01, -1.7791004328661417e-01, + 3.0308592261175693e-01, -2.4388389104303178e+02, + -1.3297246896568512e+02, 6.5280185021944601e+02, + -5.8293633204356592e-02, -5.9098581210046991e-02, + -8.9530762460421812e-02, -3.2321798044797049e+02, + -1.9618498443549377e+01, 6.8277496563927434e+02, + 3.5479985545926344e-02, -3.5611413591438046e-02, + -1.3232314047767793e-01, -1.2625821191982124e+02, + -2.5618913672336170e+01, 7.0385601784256005e+02, + 3.9211464190881729e-01, 2.1549658730119634e-01, + -1.4130773420718574e+00, -8.5523550079182243e+01, + 2.2984725360266845e+02, 8.2839582713436994e+02, + -2.1486395613228168e-01, -3.7473924531076987e-02, + -1.2192808652877701e-01, -2.5656431082473205e+02, + -3.8123930453167198e+01, 6.7578066921389507e+02, + -7.6289590058333828e-02, 2.9437340489530678e-01, + -7.8882840818867728e-01, -1.8217958163924104e+02, + 1.1097414929505841e+02, 7.4697035931731625e+02, + 8.7261956598297750e-03, -2.5237562752235082e-01, + 4.0351738841864915e-01, -2.3003814892692472e+02, + -1.4085825565455085e+02, 6.4516413702574084e+02, + -1.0555940811495185e-01, -4.6016602388014177e-01, + 3.0413421435923813e+00, 1.7441295323315637e+02, + 1.8734846533607646e+02, 7.9752317516395408e+02, + -9.1039990089083159e-02, -4.7519483656498479e-01, + 3.0032666117681273e+00, 3.2194871941055681e+02, + 1.5780707108135309e+02, 8.0321966331036128e+02, + -9.9552946449581819e-02, 1.0618837568091075e-01, + 3.0712556287925636e+00, 2.6929107633919546e+02, + 1.6439659778260724e+02, 6.6777875570616368e+02, + 1.5338089670609836e-01, 2.7372008867012287e-01, + -3.0935183198006868e+00, 1.7108269571471331e+02, + 2.0605011286974738e+02, 7.6112262118424530e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 20 + dt: d + data: [ 3.5773324527368561e-01, 4.4413915970770379e-01, + 4.5170444688059863e-01, 3.8137608802180739e-01, + 4.8504427729700922e-01, 4.0836310886972477e-01, + 5.3689523918086579e-01, 4.2198860090040929e-01, + 4.0169225895790017e-01, 3.7113508446024807e-01, + 3.6899942828720822e-01, 4.6215828398327491e-01, + 5.8726361927033932e-01, 3.2707933630218655e-01, + 2.3008301964905439e-01, 3.9189981831041298e-01, + 4.9289776074319019e-01, 4.5883509180190452e-01, + 3.2354694741349549e-01, 4.6654356860922008e-01 ] + avgReprojErr: 4.2450029623819413e-01 + maxReprojErr: 1.0800357572306361e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 0., 0., 0. ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. +Projector 0: + imageWidth: 1280 + imageHeight: 800 + responseGamma: 2.2000000000000002e+00 + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1.01525e+03, 0., 6.336e+02, 0., + 1.01525e+03, 7.6e+2, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ -3.9725914252164513e-02, 1.5719194938912929e-02, + 1.2401622635113425e-03, -1.6059312696931278e-03 ] + extrParams: !!opencv-matrix + rows: 20 + cols: 6 + dt: d + data: [ -1.6565501174976432e-01, 7.6844179042392380e-03, + -9.9088261519558376e-03, -3.6368977632228655e+02, + -4.8275957463821578e+02, 7.3008924531529851e+02, + -1.8988262046868867e-01, 9.6925486362167794e-03, + 9.6038258946726483e-03, -3.0176761764663132e+02, + -3.5138605896557544e+02, 7.0773201856215189e+02, + -1.4939186918764780e-01, 1.8644971347895634e-01, + 1.6372090749144861e+00, 3.7703726325803393e+02, + -4.9800619130231672e+02, 7.4541489911049553e+02, + 1.6143781336867585e-02, 2.9449535152621459e-01, + 3.1123367778616138e+00, 2.4339756937867477e+02, + -1.3063683809320253e+01, 6.3668744375635754e+02, + -6.0893308205941091e-02, -2.3284096812199140e-01, + -1.3365799371822504e+00, -3.3476586958192604e+02, + -7.6178033792564250e+01, 6.0799900862161849e+02, + 1.4005735885903960e-02, 3.5105039187963927e-01, + 3.1125022782761307e+00, 2.3693036304879922e+02, + -2.8568142368075439e-01, 6.3394886470640097e+02, + -1.5741993921112510e-01, 1.8478387897529949e-01, + 1.6305932554102116e+00, 1.0406075200986754e+02, + -4.2788257675892862e+02, 7.3209268211894357e+02, + -1.4866186062953998e-01, 5.0660440509027509e-02, + 2.6724071345270300e-01, -4.6583844679371246e+01, + -4.4200775191882667e+02, 7.1114047883908177e+02, + -2.2237444218611055e-02, -2.9190586569261168e-01, + -1.4315121305171044e+00, -2.4288601022040885e+02, + -6.0107906630516347e+01, 5.8587667480462164e+02, + -1.3383891526480721e-01, -7.3567680347234238e-02, + -2.7119893022687500e+00, 2.1893984049240541e+02, + -3.4745132969778446e+01, 6.3460903638692776e+02, + -4.8360883487703767e-02, 3.7555613593326970e-01, + -3.0885382600450790e+00, 3.1021668918418771e+02, + -1.4279947203664204e+02, 6.4817735443900926e+02, + 1.4513043987067846e-02, -2.2256963064512844e-01, + 3.1170802497860288e+00, 1.1309297113627383e+02, + -1.6178733846103702e+02, 6.5795222209566839e+02, + -1.4380881311468280e-01, 2.0862689738926013e-01, + 1.8111838979482744e+00, 9.8806599586769153e+01, + -4.3844118798338627e+02, 7.3383986725458055e+02, + 3.0112585551035010e-02, -6.0810321767227582e-01, + 3.0803437007890562e+00, 2.4203276452222789e+02, + -1.3041657973644365e+02, 6.4059315652748614e+02, + -3.2377127658349375e-01, -3.5699426326638739e-01, + 2.3978157304076744e+00, 1.8322530323931167e+02, + -2.9698646099132424e+02, 6.8043893394560678e+02, + -2.3099316037654685e-01, 1.9230664157044738e-01, + -2.5882825467021715e+00, 2.0475842471165492e+02, + -2.7455780575134913e+01, 6.2761279522019368e+02, + -1.2263756600610767e-01, 2.1292870578208025e-02, + 4.9730197474780739e-02, -1.6313097669984086e+02, + -4.2060277859646811e+02, 7.0054840801594992e+02, + -1.3400047086022487e-01, 9.4333004637413027e-03, + 1.0288980150924642e-02, -3.1394483299575592e+02, + -4.0800556941075212e+02, 7.0208214890871852e+02, + 2.4372974097728858e-01, 3.5302527318755175e-02, + 5.3809308751254725e-02, -2.5636153627376171e+02, + -3.8427551842628026e+02, 5.7115961427673369e+02, + 3.7494708186333641e-04, 4.5800720493244511e-02, + 1.5073060962530443e-01, -1.5671032165501393e+02, + -4.3134746108165967e+02, 6.5951979239585671e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 20 + dt: d + data: [ 4.4838025484459199e-01, 4.4929580640908989e-01, + 3.9203208369363124e-01, 3.4321653025028909e-01, + 4.5930572096873618e-01, 3.7065470302226500e-01, + 4.9213644418001867e-01, 3.6477042080264094e-01, + 7.4682573138073460e-01, 4.4965469127582031e-01, + 4.5630602413518806e-01, 3.7624618412907479e-01, + 6.7498543538669153e-01, 3.7476903570750086e-01, + 3.9868166654567755e-01, 1.9790820877638307e-01, + 4.5666275430331965e-01, 4.3541246901932890e-01, + 2.5419988314055963e-01, 3.2595677631185493e-01 ] + avgReprojErr: 4.3942414533823654e-01 + maxReprojErr: 1.3265849486322991e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -9.9286711543274231e-01, 1.1570567121908509e-01, + -2.8759150543898930e-02, -1.0848472041738899e-01, + -9.7679914542462176e-01, -1.8464694672181747e-01, + -4.9456612583421052e-02, -1.8020995295895770e-01, + 9.8238404726782047e-01 ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 1.1067357202823974e+01, -7.0390837297746913e+01, + -4.3855958230614874e+01 ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -1.2764089976276507e+00, -3.0153333043273900e+01, + -7.7248704417973855e+01, 4.4090492740471824e+01, + -3.0799351631285639e+00, -9.6111350564676830e+00, + -7.1089386732617200e+01, -2.6659659806182727e+00, + -4.0679344025381603e+00 ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -1.9732341756556793e-08, -4.6562802802395681e-07, + -5.3694600107161258e-04, 6.8150829629382099e-07, + -4.7553532828009189e-08, -2.9357415552722262e-04, + -1.8547824812829414e-03, 3.0152613717838799e-04, + 9.9999999999999989e-01 ] + avgEpipolarErr: 4.5130478957733655e-01 + maxEpipolarErr: 1.6255448850683165e+00 + colorOrder: BGR + avgColorErr: 0. + colorR2: 1. diff --git a/papart/data/calibration/saved/projector-p3B-procamcalib.yaml b/papart/data/calibration/saved/projector-p3B-procamcalib.yaml new file mode 100644 index 00000000..eb86abfe --- /dev/null +++ b/papart/data/calibration/saved/projector-p3B-procamcalib.yaml @@ -0,0 +1,214 @@ +%YAML:1.0 +Cameras: + - Camera 0 +Projectors: + - Projector 0 +Camera 0: + imageWidth: 640 + imageHeight: 480 + responseGamma: 0. + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 6.0336619173044176e+02, 0., 3.1412708141403124e+02, 0., + 6.0442266333410726e+02, 2.3392992279062375e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 1.4581568172715451e-01, -2.9304335419508754e-01, + -9.8065868768166184e-03, 1.6642932396551816e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -4.7367538411373789e-01, -1.7019243542241474e-02, + 9.6458977737399372e-03, -1.7315164553833495e+02, + -1.8612635986348377e+02, 5.9631718160439220e+02, + -3.8444503786908940e-01, -3.3979268883880359e-01, + -1.4707484103287070e+00, -1.0419100304800661e+02, + 1.1588590155621586e+02, 4.4463736579914519e+02, + 2.2068113139126499e-02, -6.7299271184357712e-01, + -3.0379180380052189e+00, 2.4207425855627142e+02, + 1.1162729434716046e+02, 4.5226208703309703e+02, + 3.0598013668146801e-01, 7.2193572926477190e-01, + 2.9980060017234109e+00, 1.6652539272776798e+02, + 6.7284638612982860e+01, 3.6936358329709788e+02, + -3.3556896451320831e-02, -7.1764336643938598e-01, + -2.9682834843227135e+00, 3.1763144237120150e+02, + 1.0657052350183055e+02, 4.4532380686527551e+02, + -2.1200110711757125e-01, 1.9983615133679153e-01, + 1.5545015173670433e+00, 1.5088628680296540e+02, + -2.9256298554786582e+02, 5.5743412806818856e+02, + -4.7866525078363376e-01, -1.4366917002575195e-02, + 1.7585631052476892e-02, -1.8106507938446046e+02, + -2.0601489547772519e+02, 6.0676063229476370e+02, + -4.3131772290916159e-01, -2.7292253538956990e-01, + -1.2080720333000643e+00, -1.1849915403199785e+02, + 8.9595924951884456e+01, 4.5762470913268066e+02, + -3.8520408084693375e-01, -3.4756010049584646e-01, + -1.5744458144304001e+00, -1.8549613075878557e+02, + 1.3444778079343811e+02, 4.3410016706333994e+02, + -4.3079439584009879e-02, 6.4856011049213513e-01, + 3.0528076362429086e+00, 2.3154496913217247e+02, + 6.7738568062628090e+01, 4.7327165920781187e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 3.3297489451038192e-01, 2.7443017905966699e-01, + 3.9225867153663374e-01, 3.9662553380781163e-01, + 3.9094336019940662e-01, 2.3530066173482525e-01, + 3.6632875722997627e-01, 4.9026108948039909e-01, + 3.7893793502081008e-01, 4.1982561263259860e-01 ] + avgReprojErr: 3.7736326610161719e-01 + maxReprojErr: 1.1061860448533452e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 0., 0., 0. ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 0., 0., 0., 0., 0., 0., 0., 0., 0. ] + avgEpipolarErr: 0. + maxEpipolarErr: 0. + colorOrder: BGR + colorMixingMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1., 0., 0., 0., 1., 0., 0., 0., 1. ] + additiveLight: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 0., 0., 0. ] + avgColorErr: 0. + colorR2: 1. +Projector 0: + imageWidth: 1280 + imageHeight: 800 + responseGamma: 2.2000000000000002e+00 + cameraMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 1.2563413051150239e+03, 0., 6.1553924606776650e+02, 0., + 1.2368291549251016e+03, 6.6016094038958443e+02, 0., 0., 1. ] + distortionCoeffs: !!opencv-matrix + rows: 1 + cols: 4 + dt: d + data: [ 3.5790450461787471e-02, -6.9014632423932951e-02, + -8.7105602669458101e-03, 2.0926794634546233e-03 ] + extrParams: !!opencv-matrix + rows: 10 + cols: 6 + dt: d + data: [ -3.3519585677079350e-01, -2.4751176841884402e-02, + 5.6450722169903156e-03, -1.7475803055902944e+02, + -2.8526769476846192e+02, 5.7654998758376394e+02, + -2.7005047957624245e-01, -2.3820884706815640e-01, + -1.4886005949136163e+00, -1.0442889063076275e+02, + 3.4438271626615823e+01, 4.6916406113879259e+02, + 3.9969391904097269e-02, -4.4952519180611317e-01, + -3.0831640429293725e+00, 2.4177702311562567e+02, + 2.8740672140084367e+01, 4.7854187036054810e+02, + 3.5846930653349890e-01, 5.2584112352569312e-01, + 3.0351324391641228e+00, 1.6507535549837374e+02, + -9.7429778083610135e+00, 3.6838252593390172e+02, + -2.1768127542179702e-02, -5.1135374556351265e-01, + -3.0132296343116525e+00, 3.1728637147825231e+02, + 2.3940672131866723e+01, 4.6919404513345796e+02, + -7.0044410993605852e-02, 3.3412158301295604e-02, + 1.5587061415014865e+00, 1.4865217483785480e+02, + -3.8915980756331180e+02, 5.0353924031304661e+02, + -3.4141268927128704e-01, -2.3196704363163921e-02, + 1.3235269962512643e-02, -1.8288377177069788e+02, + -3.0619084969696928e+02, 5.8406226907662108e+02, + -3.1096093446978923e-01, -1.8775397582118611e-01, + -1.2222532141593747e+00, -1.1895483027171115e+02, + 6.6751724785620228e+00, 4.7831449128361675e+02, + -2.7665670463571168e-01, -2.3756376324658632e-01, + -1.5926518995533041e+00, -1.8571238130387752e+02, + 5.4539902230989782e+01, 4.5997500830922348e+02, + -5.5179200125934351e-02, 4.1814329059201566e-01, + 3.0874837889528606e+00, 2.3097439532346635e+02, + -1.7744738014889073e+01, 4.9277929861942806e+02 ] + reprojErrs: !!opencv-matrix + rows: 1 + cols: 10 + dt: d + data: [ 3.4003159720932569e-01, 6.4400559331259588e-01, + 3.5493722205221800e-01, 8.1031265023380961e-01, + 3.4145181732367719e-01, 1.0597956456994664e+00, + 3.5947325905307848e-01, 5.5224144837909872e-01, + 3.5190322629802923e-01, 3.5917988120250516e-01 ] + avgReprojErr: 5.4262939199630345e-01 + maxReprojErr: 2.2710332160036666e+00 + R: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 9.9994587545892677e-01, 1.5340630900766295e-03, + -1.0290422883249568e-02, -2.7179253744314211e-03, + 9.9324101291584210e-01, -1.1603836927314588e-01, + 1.0042859868556547e-02, 1.1606005735113011e-01, + 9.9319142367084146e-01 ] + T: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 4.3602330533858638e+00, -3.0662744530509769e+01, + 6.5825911898322609e+00 ] + E: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ -2.9005065488090453e-01, -1.0096819429753907e+01, + -2.9690141746652394e+01, 6.5384457005556351e+00, + -4.9595078805887116e-01, -4.3982837208398928e+00, + 3.0649234135479777e+01, 4.3778008791188139e+00, + -8.2148694114575849e-01 ] + F: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 2.0654990909259168e-07, 7.1775459066158173e-06, + 1.1012952274212352e-02, -4.7295911927624633e-06, + 3.5811944148860187e-07, 3.3215291123388229e-03, + -2.4425540991174687e-02, -8.5642820718516768e-03, 1. ] + avgEpipolarErr: 2.7443524713497749e+00 + maxEpipolarErr: 1.0151392941537374e+01 + colorOrder: BGR + colorMixingMatrix: !!opencv-matrix + rows: 3 + cols: 3 + dt: d + data: [ 7.6604573382889479e-02, -5.7218538924928064e-02, + -1.1554917018250581e-01, -8.6169109359339024e-02, + 3.4270475395352729e-01, -8.8937433175895225e-02, + -3.0311399592083395e-02, -2.9647717451540440e-01, + 6.6640269113887163e-01 ] + additiveLight: !!opencv-matrix + rows: 3 + cols: 1 + dt: d + data: [ 7.5043589623580176e-01, 5.6984854817797825e-01, + 2.8773446633667960e-01 ] + avgColorErr: 1.0188152067555140e-01 + colorR2: 8.0575256584721777e-01 diff --git a/papart/data/markers/A4-calib-print.pdf b/papart/data/markers/A4-calib-print.pdf new file mode 100644 index 00000000..31a8f8ed Binary files /dev/null and b/papart/data/markers/A4-calib-print.pdf differ diff --git a/papart/data/markers/A4-calib.svg b/papart/data/markers/A4-calib.svg new file mode 100644 index 00000000..3c24c413 --- /dev/null +++ b/papart/data/markers/A4-calib.svg @@ -0,0 +1,4410 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PapARt Calibration board + http://rea.lity.tech + http://project.inria.fr/papart + + + + + + + + + diff --git a/papart/data/markers/A4-default-15.svg b/papart/data/markers/A4-default-15.svg new file mode 100644 index 00000000..70ac8300 --- /dev/null +++ b/papart/data/markers/A4-default-15.svg @@ -0,0 +1,190 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/papart/data/markers/A4-default.pdf b/papart/data/markers/A4-default.pdf new file mode 100644 index 00000000..b3c072f0 Binary files /dev/null and b/papart/data/markers/A4-default.pdf differ diff --git a/papart/data/markers/A4-default.svg b/papart/data/markers/A4-default.svg new file mode 100644 index 00000000..7c0c16cb --- /dev/null +++ b/papart/data/markers/A4-default.svg @@ -0,0 +1,633 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + http://rea.lity.tech + http://project.inria.fr/papart + PapARt + + + diff --git a/papart/data/markers/big-calib.cfg b/papart/data/markers/big-calib.cfg deleted file mode 100644 index 5e22a575..00000000 --- a/papart/data/markers/big-calib.cfg +++ /dev/null @@ -1,70 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# Papart MarkerBoard please fill the marker IDs. -# size:1488.189x1052.3622 - -#Number of Markers -8 - -# marker -0 -55.0 -27.5 27.5 -1.0 -0.0 0.0 61.5 -0.0 -1.0 0.0 217.0 -0.0 -0.0 1.0 0.0 - -# marker -1 -55.0 -27.5 27.5 -1.0 -0.0 0.0 142.16700744628906 -0.0 -1.0 0.0 217.0 -0.0 -0.0 1.0 0.0 - -# marker -2 -55.0 -27.5 27.5 -1.0 -0.0 0.0 222.83299255371094 -0.0 -1.0 0.0 217.0 -0.0 -0.0 1.0 0.0 - -# marker -3 -55.0 -27.5 27.5 -1.0 -0.0 0.0 303.5 -0.0 -1.0 0.0 217.0 -0.0 -0.0 1.0 0.0 - -# marker -6 -55.0 -27.5 27.5 -1.0 -0.0 0.0 303.5 -0.0 -1.0 0.0 129.2570037841797 -0.0 -0.0 1.0 0.0 - -# marker -7 -55.0 -27.5 27.5 -1.0 -0.0 0.0 61.5 -0.0 -1.0 0.0 129.2570037841797 -0.0 -0.0 1.0 0.0 - -# marker -8 -55.0 -27.5 27.5 -1.0 -0.0 0.0 142.16700744628906 -0.0 -1.0 0.0 129.2570037841797 -0.0 -0.0 1.0 0.0 - -# marker -9 -55.0 -27.5 27.5 -1.0 -0.0 0.0 222.83299255371094 -0.0 -1.0 0.0 129.2570037841797 -0.0 -0.0 1.0 0.0 diff --git a/papart/data/markers/big.cfg b/papart/data/markers/big.cfg deleted file mode 100755 index 0be52ca2..00000000 --- a/papart/data/markers/big.cfg +++ /dev/null @@ -1,106 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -12 - -# marker -0 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 12.25 - 0.0000 0.0000 1.0000 0.0 - -# marker -13 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 115.78 - 0.0000 0.0000 1.0000 0.0 - -# marker -7 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 219.31 - 0.0000 0.0000 1.0000 0.0 - -# marker -8 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 98.756 - 0.0000 1.0000 0.0000 219.31 - 0.0000 0.0000 1.0000 0.0 - - -# marker -9 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 182.511 - 0.0000 1.0000 0.0000 219.31 - 0.0000 0.0000 1.0000 0.0 - - -# marker -6 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 266.267 - 0.0000 1.0000 0.0000 219.31 - 0.0000 0.0000 1.0000 0.0 - - -# marker -11 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 350.0 - 0.0000 1.0000 0.0000 219.31 - 0.0000 0.0000 1.0000 0.0 - -# marker -15 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 350.0 - 0.0000 1.0000 0.0000 115.78 - 0.0000 0.0000 1.0000 0.0 - - -# marker -5 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 350.0 - 0.0000 1.0000 0.0000 12.257 - 0.0000 0.0000 1.0000 0.0 - -# marker -1 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 98.756 - 0.0000 1.0000 0.0000 12.257 - 0.0000 0.0000 1.0000 0.0 - -# marker -2 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 182.511 - 0.0000 1.0000 0.0000 12.257 - 0.0000 0.0000 1.0000 0.0 - -# marker -3 -55.0 -27.5 27.5 - 1.0000 0.0000 0.0000 266.267 - 0.0000 1.0000 0.0000 12.257 - 0.0000 0.0000 1.0000 0.0 - diff --git a/papart/data/markers/big.svg b/papart/data/markers/big.svg deleted file mode 100755 index 9947fefa..00000000 --- a/papart/data/markers/big.svg +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - 7 8 9 6 11 13 150 1 2 3 5 - diff --git a/papart/data/markers/blocks.cfg b/papart/data/markers/blocks.cfg deleted file mode 100644 index 47bf0371..00000000 --- a/papart/data/markers/blocks.cfg +++ /dev/null @@ -1,54 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# 40 is an approxmimation. They are all on a line... so it is not important. - -# number of markers -6 - - -# marker 0 -110 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -111 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 55.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -112 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 100.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -113 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 145.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 - -114 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 190.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 - -115 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 235.0 - 0.0000 1.0000 0.0000 40.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/blocks.svg b/papart/data/markers/blocks.svg deleted file mode 100644 index c6c079d9..00000000 --- a/papart/data/markers/blocks.svg +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - 110 111 112 113 114 115 - Crée à partir du sketch de Asher Salomon: http://openprocessing.org/sketch/20818 - Touchez pour créer des carrés. Passez la main au-dessus pour les déplacer. - - diff --git a/papart/data/markers/corners.svg b/papart/data/markers/corners.svg deleted file mode 100644 index ea73ac4d..00000000 --- a/papart/data/markers/corners.svg +++ /dev/null @@ -1,231 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - x - - - - - - y - 350 - 250 - - diff --git a/papart/data/markers/debug.cfg b/papart/data/markers/debug.cfg deleted file mode 100644 index e5f42299..00000000 --- a/papart/data/markers/debug.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -2290 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -2292 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -2291 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 45.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -2293 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 45.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/debug.svg b/papart/data/markers/debug.svg deleted file mode 100644 index 8aad566d..00000000 --- a/papart/data/markers/debug.svg +++ /dev/null @@ -1,805 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - 2292 22932290 2291 - - - - Détection de marqueurs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Jérémy Laviole et l'équipe Inria Potioc. - - diff --git a/papart/data/markers/drawing.cfg b/papart/data/markers/drawing.cfg deleted file mode 100755 index 170dc942..00000000 --- a/papart/data/markers/drawing.cfg +++ /dev/null @@ -1,113 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -13 - -# marker -21 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -36 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -35 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -34 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -33 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -32 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -22 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -23 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -24 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -28 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -29 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -30 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -31 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - diff --git a/papart/data/markers/drawing.svg b/papart/data/markers/drawing.svg deleted file mode 100755 index a45652cf..00000000 --- a/papart/data/markers/drawing.svg +++ /dev/null @@ -1,441 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - diff --git a/papart/data/markers/earth.cfg b/papart/data/markers/earth.cfg deleted file mode 100755 index 1dbb3338..00000000 --- a/papart/data/markers/earth.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -2 - -# marker -5 -70 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 15.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -15 -70 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/earth.svg b/papart/data/markers/earth.svg deleted file mode 100644 index 866439f9..00000000 --- a/papart/data/markers/earth.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - 7 8 9 6 1113 150 1 2 3 5 - La terre - - - - diff --git a/papart/data/markers/eclairage.cfg b/papart/data/markers/eclairage.cfg deleted file mode 100755 index 7eb6e9d0..00000000 --- a/papart/data/markers/eclairage.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -0 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -1 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -2 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -3 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -4 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -5 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -13 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -12 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -7 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - - - -# marker -8 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -9 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -6 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -10 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -11 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -14 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -15 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - diff --git a/papart/data/markers/eclairage.svg b/papart/data/markers/eclairage.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/markers/eclairage.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/markers/game.cfg b/papart/data/markers/game.cfg deleted file mode 100644 index 3271aea8..00000000 --- a/papart/data/markers/game.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -218 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -219 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 53.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -220 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -221 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 53.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/game.svg b/papart/data/markers/game.svg deleted file mode 100644 index de82b787..00000000 --- a/papart/data/markers/game.svg +++ /dev/null @@ -1,290 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - 218 - 219 - 220 - 221 - 222 - 223 - - - - - - 218 - - 219 - - - 220 - 221 - - diff --git a/papart/data/markers/instructions.svg b/papart/data/markers/instructions.svg deleted file mode 100644 index 17591074..00000000 --- a/papart/data/markers/instructions.svg +++ /dev/null @@ -1,860 +0,0 @@ - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - 2292 22932290 2291 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Jérémy Laviole, Inria Potioc team. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/markers/lapin.cfg b/papart/data/markers/lapin.cfg deleted file mode 100644 index ca25d4f4..00000000 --- a/papart/data/markers/lapin.cfg +++ /dev/null @@ -1,72 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -8 - -# marker -0 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 58.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -13 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 110.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -12 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 160.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -3 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 205.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -5 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 58.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -15 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 110.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -14 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 160.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -11 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 205.0 - 0.0000 0.0000 1.0000 0.0 - - diff --git a/papart/data/markers/lapin.svg b/papart/data/markers/lapin.svg deleted file mode 100644 index 3f536594..00000000 --- a/papart/data/markers/lapin.svg +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 1. Mettez vos lunettes 3D.2. Placez la feuille devant vous. - 3. Pressez le bouton "Pos". 4. Déplacez la lumière avec votre main et la feuille. - Le bouton "Pos" place le point de vue à 50 cmde hauteur et 50cm de distance de la feuille (debout face à celle-ci). - - diff --git a/papart/data/markers/lapinInterface.cfg b/papart/data/markers/lapinInterface.cfg deleted file mode 100644 index 8aeb0c52..00000000 --- a/papart/data/markers/lapinInterface.cfg +++ /dev/null @@ -1,63 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -5 - - -# marker 0 -2285 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -2286 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -2287 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 135.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -2288 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 135.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 336 -336 -35.0 -7.5 7.5 - 1.0000 0.0000 0.0000 170.0 - 0.0000 1.0000 0.0000 25.0 - 0.0000 0.0000 1.0000 0.0 - -# -10 + 30/2 -# ## xOffset = -xInkscape + patWidth/2 -# 10 + 30/2 -# 30.0 -# 0.0 0.0 -# 1.0000 0.0000 0.0000 45.0 -# 0.0000 1.0000 0.0000 135.0 -# 0.0000 0.0000 1.0000 0.0 - -# # marker 336 -# # 336 -# # 35.0 -# # 0.0 0.0 -# # 1.0000 0.0000 0.0000 170.0 -# # 0.0000 1.0000 0.0000 25.0 -# # 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/lapinInterface.svg b/papart/data/markers/lapinInterface.svg deleted file mode 100644 index 19dfd419..00000000 --- a/papart/data/markers/lapinInterface.svg +++ /dev/null @@ -1,189 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - 2287 22882285 2286 - - - Light - Rotate - Lock - - 336 - - diff --git a/papart/data/markers/A3-small1-legacy.cfg b/papart/data/markers/legacy/A3-small1-legacy.cfg similarity index 100% rename from papart/data/markers/A3-small1-legacy.cfg rename to papart/data/markers/legacy/A3-small1-legacy.cfg diff --git a/papart/data/markers/A3-small1.svg b/papart/data/markers/legacy/A3-small1.svg similarity index 100% rename from papart/data/markers/A3-small1.svg rename to papart/data/markers/legacy/A3-small1.svg diff --git a/papart/data/markers/A3-small2.svg b/papart/data/markers/legacy/A3-small2.svg similarity index 100% rename from papart/data/markers/A3-small2.svg rename to papart/data/markers/legacy/A3-small2.svg diff --git a/papart/data/markers/big-calib.svg b/papart/data/markers/legacy/big-calib.svg old mode 100755 new mode 100644 similarity index 100% rename from papart/data/markers/big-calib.svg rename to papart/data/markers/legacy/big-calib.svg diff --git a/papart/data/markers/mega-calib.svg b/papart/data/markers/legacy/mega-calib.svg old mode 100755 new mode 100644 similarity index 100% rename from papart/data/markers/mega-calib.svg rename to papart/data/markers/legacy/mega-calib.svg diff --git a/papart/data/markers/test.svg b/papart/data/markers/legacy/test.svg similarity index 100% rename from papart/data/markers/test.svg rename to papart/data/markers/legacy/test.svg diff --git a/papart/data/markers/mega-calib.cfg b/papart/data/markers/mega-calib.cfg deleted file mode 100644 index 301ba493..00000000 --- a/papart/data/markers/mega-calib.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -2 - -# marker -0 -150.0 -13.5 32.0 - 1.0000 0.0000 0.0000 61.500 - 0.0000 1.0000 0.0000 43.5000 - 0.0000 0.0000 1.0000 0.0 - -# marker -1 -150.0 -16.5 32.0 - 1.0000 0.0000 0.0000 245.0 - 0.0000 1.0000 0.0000 43.50 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/moon.cfg b/papart/data/markers/moon.cfg deleted file mode 100755 index 644216bc..00000000 --- a/papart/data/markers/moon.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -2 - -# marker -1 -70 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 15.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -8 -70 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/moon.svg b/papart/data/markers/moon.svg deleted file mode 100644 index a1f9e047..00000000 --- a/papart/data/markers/moon.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - 7 8 9 6 1113 150 1 2 3 5 La lune - - - - diff --git a/papart/data/markers/player1.cfg b/papart/data/markers/player1.cfg deleted file mode 100644 index 29c331cc..00000000 --- a/papart/data/markers/player1.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -210 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -211 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 165.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -213 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -212 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 165.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/player1.svg b/papart/data/markers/player1.svg deleted file mode 100644 index 67da8877..00000000 --- a/papart/data/markers/player1.svg +++ /dev/null @@ -1,548 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - 210 - - - - - - - - - 211 - 212 - 213 - 214 - 215 - 216 - 217 - 210 - - - 211 - - 212 - - 213 - - - - diff --git a/papart/data/markers/player2.cfg b/papart/data/markers/player2.cfg deleted file mode 100644 index 5df81ccf..00000000 --- a/papart/data/markers/player2.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -214 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -215 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 165.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -217 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -216 -35.0 -0.0 0.0 - 1.0000 0.0000 0.0000 255.0 - 0.0000 1.0000 0.0000 165.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/player2.svg b/papart/data/markers/player2.svg deleted file mode 100644 index c8973024..00000000 --- a/papart/data/markers/player2.svg +++ /dev/null @@ -1,145 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - 214 - 215 - 216 - 217 - - - - diff --git a/papart/data/markers/radio.cfg b/papart/data/markers/radio.cfg deleted file mode 100755 index 84c97b46..00000000 --- a/papart/data/markers/radio.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -47 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -55 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -54 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -53 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -52 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -51 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -50 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -49 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -48 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - - - -# marker -46 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -45 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -44 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -43 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -40 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -42 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -41 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - diff --git a/papart/data/markers/radio.svg b/papart/data/markers/radio.svg deleted file mode 100755 index 335a3468..00000000 --- a/papart/data/markers/radio.svg +++ /dev/null @@ -1,783 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - - - - - - - - - - - - - - - - - 47 - 55 - 54 - 53 - 52 - 51 - 41 - 42 - 40 - 50 - 49 - 48 - 46 - 45 - 44 - 43 - - diff --git a/papart/data/markers/renne.cfg b/papart/data/markers/renne.cfg deleted file mode 100755 index 84c97b46..00000000 --- a/papart/data/markers/renne.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -47 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -55 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -54 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -53 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -52 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -51 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 5.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -50 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -49 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -48 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - - - -# marker -46 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 85.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -45 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 155.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -44 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 225.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -43 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 295.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -40 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 257.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -42 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 170.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -41 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 - diff --git a/papart/data/markers/renne.svg b/papart/data/markers/renne.svg deleted file mode 100755 index 335a3468..00000000 --- a/papart/data/markers/renne.svg +++ /dev/null @@ -1,783 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - - - - - - - - - - - - - - - - - 47 - 55 - 54 - 53 - 52 - 51 - 41 - 42 - 40 - 50 - 49 - 48 - 46 - 45 - 44 - 43 - - diff --git a/papart/data/markers/rocks.jpg b/papart/data/markers/rocks.jpg deleted file mode 100644 index e52f4543..00000000 Binary files a/papart/data/markers/rocks.jpg and /dev/null differ diff --git a/papart/data/markers/sun.cfg b/papart/data/markers/sun.cfg deleted file mode 100755 index c0576b99..00000000 --- a/papart/data/markers/sun.cfg +++ /dev/null @@ -1,21 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -2 - -# marker -0 -70.0 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 15.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -13 -70.0 -35.0 35.0 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 100.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/markers/sun.svg b/papart/data/markers/sun.svg deleted file mode 100755 index dea8d726..00000000 --- a/papart/data/markers/sun.svg +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - 7 8 9 6 1113 150 1 2 3 5 Le soleil - - - diff --git a/papart/data/markers/tableauInterieur.jpg b/papart/data/markers/tableauInterieur.jpg deleted file mode 100644 index 22eca173..00000000 Binary files a/papart/data/markers/tableauInterieur.jpg and /dev/null differ diff --git a/papart/data/markers/tableauInterieurI.jpg b/papart/data/markers/tableauInterieurI.jpg deleted file mode 100644 index 084691ac..00000000 Binary files a/papart/data/markers/tableauInterieurI.jpg and /dev/null differ diff --git a/papart/data/markers/tableauLarge.jpg b/papart/data/markers/tableauLarge.jpg deleted file mode 100644 index d979156a..00000000 Binary files a/papart/data/markers/tableauLarge.jpg and /dev/null differ diff --git a/papart/data/markers/tableauLarge.xcf b/papart/data/markers/tableauLarge.xcf deleted file mode 100644 index dc7dc1b4..00000000 Binary files a/papart/data/markers/tableauLarge.xcf and /dev/null differ diff --git a/papart/data/markers/tablet.svg b/papart/data/markers/tablet.svg deleted file mode 100644 index a1c14e67..00000000 --- a/papart/data/markers/tablet.svg +++ /dev/null @@ -1,580 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/markers/test.cfg b/papart/data/markers/test.cfg deleted file mode 100644 index ef2ab6ff..00000000 --- a/papart/data/markers/test.cfg +++ /dev/null @@ -1,46 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# Papart MarkerBoard please fill the marker IDs. -# size: 1488.189x1052.3622 - -#Number of Markers -5 - -# marker -100 -38.179 -19.0895 19.0895 --0.7129644751548767 0.7012001276016235 0.0 54.4370002746582 -0.7012001276016235 0.7129644751548767 0.0 34.40700149536133 -0.0 -0.0 1.0 0.0 - -# marker -101 -66.688 -33.344 33.344 -0.9768182039260864 0.21407058835029602 0.0 251.36599731445312 -0.21407058835029602 -0.9768182039260864 0.0 202.9810028076172 -0.0 -0.0 1.0 0.0 - -# marker -102 -46.204 -23.102 23.102 -0.9701638221740723 -0.24245022237300873 0.0 171.9600067138672 --0.24245022237300873 -0.9701638221740723 0.0 261.0369873046875 -0.0 -0.0 1.0 0.0 - -# marker -103 -91.775 -45.8875 45.8875 -0.8660396933555603 0.4999752342700958 0.0 18.636999130249023 -0.4999752342700958 -0.8660396933555603 0.0 209.8769989013672 -0.0 -0.0 1.0 0.0 - -# marker -104 -36.468 -18.234 18.234 -0.8621888756752014 0.5065869092941284 0.0 150.39300537109375 -0.5065869092941284 -0.8621888756752014 0.0 109.20099639892578 -0.0 -0.0 1.0 0.0 diff --git a/papart/data/markers/test1.cfg b/papart/data/markers/test1.cfg deleted file mode 120000 index d9fd5234..00000000 --- a/papart/data/markers/test1.cfg +++ /dev/null @@ -1 +0,0 @@ -/home/jiii/papart/markerGen/artoolkitPlus/test1.cfg \ No newline at end of file diff --git a/papart/data/old/configs/Homography.txt b/papart/data/old/configs/Homography.txt deleted file mode 100755 index 5111f7bc..00000000 --- a/papart/data/old/configs/Homography.txt +++ /dev/null @@ -1,16 +0,0 @@ -3.4817705154418945 --3.8324077129364014 -0.8412020206451416 -0.0 -3.5817983150482178 -0.40009868144989014 -0.9028071165084839 -0.0 -2.420985221862793 -8.831888198852539 -1.0 -0.0 -0.0 -0.0 -0.0 -1.0 diff --git a/papart/data/old/configs/PlaneParameters.txt b/papart/data/old/configs/PlaneParameters.txt deleted file mode 100644 index aa7cb0c4..00000000 --- a/papart/data/old/configs/PlaneParameters.txt +++ /dev/null @@ -1,6 +0,0 @@ -151 -1142 -0 -589 -0 -477 diff --git a/papart/data/old/configs/kinectHomography.txt b/papart/data/old/configs/kinectHomography.txt deleted file mode 100644 index 13f40388..00000000 --- a/papart/data/old/configs/kinectHomography.txt +++ /dev/null @@ -1,16 +0,0 @@ --1.3911159038543701 -0.07879400253295898 -0.35574108362197876 -0.0 --0.14813756942749023 --2.9834423065185547 -0.5096640586853027 -0.0 -0.06685977429151535 --0.999718189239502 -1.0 -0.0 -0.0 -0.0 -0.0 -1.0 diff --git a/papart/data/old/configs/makerboardNumPad.cfg b/papart/data/old/configs/makerboardNumPad.cfg deleted file mode 100755 index 6c6eb15d..00000000 --- a/papart/data/old/configs/makerboardNumPad.cfg +++ /dev/null @@ -1,113 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -12 - -#### Left - -# marker -103 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -104 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 60,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -100 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 60,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -105 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 60,0 - 0,0000 1,0000 0,0000 60,0 - 0,0000 0,0000 1,0000 0,0 - -###### Right - -# marker -110 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 210,0 - 0,0000 1,0000 0,0000 60,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -111 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 256,0 - 0,0000 1,0000 0,0000 60,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -112 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 210,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -113 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 256,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - - -##### Top - -# marker -120 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 22,0 - 0,0000 1,0000 0,0000 150,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -121 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 98,0 - 0,0000 1,0000 0,0000 150,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -122 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 180,0 - 0,0000 1,0000 0,0000 150,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -123 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 256,0 - 0,0000 1,0000 0,0000 150,0 - 0,0000 0,0000 1,0000 0,0 - - - - - diff --git a/papart/data/old/configs/markerboard_480-499.cfg b/papart/data/old/configs/markerboard_480-499.cfg deleted file mode 100755 index 7a43f7c3..00000000 --- a/papart/data/old/configs/markerboard_480-499.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -6 - -# marker 0 -0 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 26,5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -1 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 81.5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -2 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 141,5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -3 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 26,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 4 -4 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 81,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 5 -5 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 141,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/configs/plane.txt b/papart/data/old/configs/plane.txt deleted file mode 100644 index 214c5d09..00000000 --- a/papart/data/old/configs/plane.txt +++ /dev/null @@ -1,8 +0,0 @@ -0.026787128 -0.008649012 --0.872214 --0.035829786 -0.60323375 --0.7967593 -0.59999996 -0.01 diff --git a/papart/data/old/configs/proj-homography.txt b/papart/data/old/configs/proj-homography.txt deleted file mode 100755 index 41acb856..00000000 --- a/papart/data/old/configs/proj-homography.txt +++ /dev/null @@ -1,16 +0,0 @@ -1.0582029819488525 --0.2413066029548645 -0.0 --5.839362144470215 -0.007576711941510439 -0.9950700402259827 -0.0 --3.140962839126587 -0.0 -0.0 -1.0 -0.0 -0.0 -0.0 -0.0 -1.0 diff --git a/papart/data/old/configs/proj.txt b/papart/data/old/configs/proj.txt deleted file mode 100755 index b5669ddf..00000000 --- a/papart/data/old/configs/proj.txt +++ /dev/null @@ -1,6 +0,0 @@ - -gauche : 61.3 -droite : 61.4 - -haut : 53.5 -bas : 53.8 diff --git a/papart/data/old/configs/projectorDist.txt b/papart/data/old/configs/projectorDist.txt deleted file mode 100755 index a852e2fb..00000000 --- a/papart/data/old/configs/projectorDist.txt +++ /dev/null @@ -1,16 +0,0 @@ -0.8914685249328613 --7.59786123844058E-19 -0.0 -5.340541181474715E-19 --7.666998028013528E-19 -0.8684563636779785 -0.0 -1.5093313898131916E-19 -0.0 -0.0 -1.0 -0.0 -0.0 -0.0 -0.0 -1.0 diff --git a/papart/data/old/configs/settings.pcc b/papart/data/old/configs/settings.pcc deleted file mode 100755 index 0e44d8e5..00000000 --- a/papart/data/old/configs/settings.pcc +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - 0 - - - com.googlecode.javacv.OpenCVFrameGrabber - - - 480 - - - 640 - - - Eye Cam - - - - - com.googlecode.javacv.OpenCVFrameGrabber - - - - - - - 0.2 - - - Samsung - - - - - - - 8 - - - 5 - - - 34.0 - - - 34.0 - - - 51.0 - - - 51.0 - - - - - - 15 - - - - - false - - - /home/jeremy/sketchbook/calib/data/calibration-p1.yaml - diff --git a/papart/data/old/markers/A3v1-a.svg b/papart/data/old/markers/A3v1-a.svg deleted file mode 100755 index 335a3468..00000000 --- a/papart/data/old/markers/A3v1-a.svg +++ /dev/null @@ -1,783 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - - - - - - - - - - - - - - - - - 47 - 55 - 54 - 53 - 52 - 51 - 41 - 42 - 40 - 50 - 49 - 48 - 46 - 45 - 44 - 43 - - diff --git a/papart/data/old/markers/A3v1-l.svg b/papart/data/old/markers/A3v1-l.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/old/markers/A3v1-l.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/A3v1-r.svg b/papart/data/old/markers/A3v1-r.svg deleted file mode 100755 index 7ab020f7..00000000 --- a/papart/data/old/markers/A3v1-r.svg +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - diff --git a/papart/data/old/markers/A3v1.svg b/papart/data/old/markers/A3v1.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/old/markers/A3v1.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/A3v2.svg b/papart/data/old/markers/A3v2.svg deleted file mode 100755 index acbb65ac..00000000 --- a/papart/data/old/markers/A3v2.svg +++ /dev/null @@ -1,172 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/old/markers/a3/A3p1.cfg b/papart/data/old/markers/a3/A3p1.cfg deleted file mode 100755 index ecc191d0..00000000 --- a/papart/data/old/markers/a3/A3p1.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -0 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -4 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -5 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -8 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -9 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -10 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -15 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/A3p1.svg b/papart/data/old/markers/a3/A3p1.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/old/markers/a3/A3p1.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/a3/A3p2.cfg b/papart/data/old/markers/a3/A3p2.cfg deleted file mode 100755 index bb6a44d1..00000000 --- a/papart/data/old/markers/a3/A3p2.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -21 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -36 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -35 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -34 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -33 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -32 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -22 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -23 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -24 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -25 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -26 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -27 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -28 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -29 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -30 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -31 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/A3p2.svg b/papart/data/old/markers/a3/A3p2.svg deleted file mode 100755 index 7ab020f7..00000000 --- a/papart/data/old/markers/a3/A3p2.svg +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - diff --git a/papart/data/old/markers/a3/A3p3.cfg b/papart/data/old/markers/a3/A3p3.cfg deleted file mode 100755 index d467d2a3..00000000 --- a/papart/data/old/markers/a3/A3p3.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -47 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -55 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -54 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -53 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -52 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -51 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -50 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -49 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -48 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -46 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -45 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -44 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -43 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -40 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -42 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -41 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/A3p3.svg b/papart/data/old/markers/a3/A3p3.svg deleted file mode 100755 index 335a3468..00000000 --- a/papart/data/old/markers/a3/A3p3.svg +++ /dev/null @@ -1,783 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - - - - - - - - - - - - - - - - - 47 - 55 - 54 - 53 - 52 - 51 - 41 - 42 - 40 - 50 - 49 - 48 - 46 - 45 - 44 - 43 - - diff --git a/papart/data/old/markers/a3/maquet/A3p1.cfg b/papart/data/old/markers/a3/maquet/A3p1.cfg deleted file mode 100755 index ecc191d0..00000000 --- a/papart/data/old/markers/a3/maquet/A3p1.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -0 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -4 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -5 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -8 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -9 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -10 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -15 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/maquet/A3p1.svg b/papart/data/old/markers/a3/maquet/A3p1.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/old/markers/a3/maquet/A3p1.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/a3/maquet/A3p2.cfg b/papart/data/old/markers/a3/maquet/A3p2.cfg deleted file mode 100755 index bb6a44d1..00000000 --- a/papart/data/old/markers/a3/maquet/A3p2.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -21 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -36 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -35 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -34 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -33 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -32 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -22 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -23 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -24 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -25 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -26 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -27 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -28 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -29 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -30 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -31 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/maquet/A3p2.svg b/papart/data/old/markers/a3/maquet/A3p2.svg deleted file mode 100755 index 7ab020f7..00000000 --- a/papart/data/old/markers/a3/maquet/A3p2.svg +++ /dev/null @@ -1,527 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - diff --git a/papart/data/old/markers/a3/maquet/A3p3.cfg b/papart/data/old/markers/a3/maquet/A3p3.cfg deleted file mode 100755 index d467d2a3..00000000 --- a/papart/data/old/markers/a3/maquet/A3p3.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -47 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -55 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -54 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -53 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -52 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -51 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -50 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -49 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -48 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -46 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -45 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -44 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -43 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -40 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -42 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -41 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/a3/maquet/A3p3.svg b/papart/data/old/markers/a3/maquet/A3p3.svg deleted file mode 100755 index 335a3468..00000000 --- a/papart/data/old/markers/a3/maquet/A3p3.svg +++ /dev/null @@ -1,783 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - 21 - 22 23 24 25 - 26 - 27 - 28 - 29 - 30 - 31 - 32 - 33 - 34 - 35 - 36 - - - - - - - - - - - - - - - - - - 47 - 55 - 54 - 53 - 52 - 51 - 41 - 42 - 40 - 50 - 49 - 48 - 46 - 45 - 44 - 43 - - diff --git a/papart/data/old/markers/a3/small/A3-small1-mm.svg b/papart/data/old/markers/a3/small/A3-small1-mm.svg deleted file mode 100644 index 9f7d8895..00000000 --- a/papart/data/old/markers/a3/small/A3-small1-mm.svg +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/old/markers/a3/small/A3-small1.cfg b/papart/data/old/markers/a3/small/A3-small1.cfg deleted file mode 100644 index ca25d4f4..00000000 --- a/papart/data/old/markers/a3/small/A3-small1.cfg +++ /dev/null @@ -1,72 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -8 - -# marker -0 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 58.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -13 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 110.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -12 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 160.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -3 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 15.0 - 0.0000 1.0000 0.0000 205.0 - 0.0000 0.0000 1.0000 0.0 - - -# marker -5 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 58.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -15 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 110.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -14 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 160.0 - 0.0000 0.0000 1.0000 0.0 - -# marker -11 -35.0 --43.9 -26.9 - 1.0000 0.0000 0.0000 365.0 - 0.0000 1.0000 0.0000 205.0 - 0.0000 0.0000 1.0000 0.0 - - diff --git a/papart/data/old/markers/a3/small/A3-small1.svg b/papart/data/old/markers/a3/small/A3-small1.svg deleted file mode 100644 index 0c65bd7b..00000000 --- a/papart/data/old/markers/a3/small/A3-small1.svg +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/a3/small/A3p1.cfg b/papart/data/old/markers/a3/small/A3p1.cfg deleted file mode 100755 index ff43593a..00000000 --- a/papart/data/old/markers/a3/small/A3p1.cfg +++ /dev/null @@ -1,72 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -8 - -# marker -0 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 58,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 205,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -5 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 58,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -15 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 205,0 - 0,0000 0,0000 1,0000 0,0 - - diff --git a/papart/data/old/markers/a3/small/A3p1.svg b/papart/data/old/markers/a3/small/A3p1.svg deleted file mode 100755 index cbaf969a..00000000 --- a/papart/data/old/markers/a3/small/A3p1.svg +++ /dev/null @@ -1,235 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - 7 8 9 6 10 1112 1413 150 1 2 3 4 5 - diff --git a/papart/data/old/markers/artkp3.svg b/papart/data/old/markers/artkp3.svg deleted file mode 100755 index d9bd1048..00000000 --- a/papart/data/old/markers/artkp3.svg +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/old/markers/mini1.cfg b/papart/data/old/markers/mini1.cfg deleted file mode 100644 index ef10e838..00000000 --- a/papart/data/old/markers/mini1.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - -# marker -103 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -104 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -100 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -105 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/mini1.svg b/papart/data/old/markers/mini1.svg deleted file mode 100755 index caad7ab0..00000000 --- a/papart/data/old/markers/mini1.svg +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - 100   105103 104 - diff --git a/papart/data/old/markers/mini3.svg b/papart/data/old/markers/mini3.svg deleted file mode 100644 index 12d3cd94..00000000 --- a/papart/data/old/markers/mini3.svg +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - 100   105103 104 this way up - diff --git a/papart/data/old/markers/my_markerboard tmp.cfg b/papart/data/old/markers/my_markerboard tmp.cfg deleted file mode 100755 index 18686330..00000000 --- a/papart/data/old/markers/my_markerboard tmp.cfg +++ /dev/null @@ -1,62 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -3 - -# marker 5 -5 -60,0 -0,0 0,0 - 1,0000 0,0000 0,0000 40,0 - 0,0000 1,0000 0,0000 337,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -6 -60,0 -0,0 0,0 - 1,0000 0,0000 0,0000 117,0 - 0,0000 1,0000 0,0000 337,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -4 -60,0 -0,0 0,0 - 1,0000 0,0000 0,0000 195,0 - 0,0000 1,0000 0,0000 337,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -3 -45,0 -0,0 0,0 - 1,0000 0,0000 0,0000 255,0 - 0,0000 1,0000 0,0000 40,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 4 -2 -45,0 -0,0 0,0 - 1,0000 0,0000 0,0000 255,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 5 -1 -45,0 -0,0 0,0 - 1,0000 0,0000 0,0000 255,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 6 -0 -45,0 -0,0 0,0 - 1,0000 0,0000 0,0000 255,0 - 0,0000 1,0000 0,0000 220,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboard-big.cfg b/papart/data/old/markers/my_markerboard-big.cfg deleted file mode 100755 index e00aa5f8..00000000 --- a/papart/data/old/markers/my_markerboard-big.cfg +++ /dev/null @@ -1,77 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -8 - -# marker -0 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 27,0 - 0,0000 1,0000 0,0000 8,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 53,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 27,0 - 0,0000 1,0000 0,0000 98,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 143,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -4 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -5 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 110,0 - 0,0000 1,0000 0,0000 140,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 200,0 - 0,0000 1,0000 0,0000 140,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -8 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 245,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/my_markerboard.cfg b/papart/data/old/markers/my_markerboard.cfg deleted file mode 100755 index aee59708..00000000 --- a/papart/data/old/markers/my_markerboard.cfg +++ /dev/null @@ -1,69 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -8 - -# marker -0 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 15,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 90,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 230,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -4 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 327,0 - 0,0000 1,0000 0,0000 15,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 327,0 - 0,0000 1,0000 0,0000 90,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 327,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -8 -55,0 --67,5 17,5 - 1,0000 0,0000 0,0000 327,0 - 0,0000 1,0000 0,0000 230,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/my_markerboard0.cfg b/papart/data/old/markers/my_markerboard0.cfg deleted file mode 100755 index 87a1387f..00000000 --- a/papart/data/old/markers/my_markerboard0.cfg +++ /dev/null @@ -1,78 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -9 - -# marker -0 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 8,0 - 0,0000 1,0000 0,0000 8,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 8,0 - 0,0000 1,0000 0,0000 53,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 8,0 - 0,0000 1,0000 0,0000 98,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 8,0 - 0,0000 1,0000 0,0000 143,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -4 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 55,0 - 0,0000 1,0000 0,0000 169,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -5 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 100,0 - 0,0000 1,0000 0,0000 169,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 145,0 - 0,0000 1,0000 0,0000 169,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 190,0 - 0,0000 1,0000 0,0000 169,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -8 -35,0 -17,5 17,5 - 1,0000 0,0000 0,0000 235,0 - 0,0000 1,0000 0,0000 169,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboard1.cfg b/papart/data/old/markers/my_markerboard1.cfg deleted file mode 100755 index 7a43f7c3..00000000 --- a/papart/data/old/markers/my_markerboard1.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -6 - -# marker 0 -0 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 26,5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -1 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 81.5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -2 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 141,5 - 0,0000 1,0000 0,0000 266,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -3 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 26,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 4 -4 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 81,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 - -# marker 5 -5 -43,0 -0,0 0,0 - 1,0000 0,0000 0,0000 141,5 - 0,0000 1,0000 0,0000 26,5 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/my_markerboard3.cfg b/papart/data/old/markers/my_markerboard3.cfg deleted file mode 100755 index e00aa5f8..00000000 --- a/papart/data/old/markers/my_markerboard3.cfg +++ /dev/null @@ -1,77 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -8 - -# marker -0 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 27,0 - 0,0000 1,0000 0,0000 8,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 53,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 27,0 - 0,0000 1,0000 0,0000 98,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 143,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -4 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -5 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 110,0 - 0,0000 1,0000 0,0000 140,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 200,0 - 0,0000 1,0000 0,0000 140,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -8 -35,0 --67,5 97,5 - 1,0000 0,0000 0,0000 245,0 - 0,0000 1,0000 0,0000 160,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/my_markerboard3v2.cfg b/papart/data/old/markers/my_markerboard3v2.cfg deleted file mode 100755 index e4ef58df..00000000 --- a/papart/data/old/markers/my_markerboard3v2.cfg +++ /dev/null @@ -1,121 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -14 - -# marker -0 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 8,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 58,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 108,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 158,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -4 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 8,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -5 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 58,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 108,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 65,0 - 0,0000 1,0000 0,0000 158,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -8 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 108,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 158,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 190,0 - 0,0000 1,0000 0,0000 108,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 190,0 - 0,0000 1,0000 0,0000 158,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 250,0 - 0,0000 1,0000 0,0000 108,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -17 -35,0 --107,5 142,5 - 1,0000 0,0000 0,0000 250,0 - 0,0000 1,0000 0,0000 158,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboarda3.cfg b/papart/data/old/markers/my_markerboarda3.cfg deleted file mode 100755 index d9ac90aa..00000000 --- a/papart/data/old/markers/my_markerboarda3.cfg +++ /dev/null @@ -1,101 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -12 - -# marker -0 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 67,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 122,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 252,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -4 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 307,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -5 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 362,0 - 0,0000 1,0000 0,0000 242,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 12,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 67,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -8 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 122,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -9 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 252,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -10 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 307,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -45,0 --67,5 17,5 - 1,0000 0,0000 0,0000 362,0 - 0,0000 1,0000 0,0000 12,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/my_markerboarda3v1-mini.cfg b/papart/data/old/markers/my_markerboarda3v1-mini.cfg deleted file mode 100644 index ecc191d0..00000000 --- a/papart/data/old/markers/my_markerboarda3v1-mini.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -0 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -4 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -5 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -8 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -9 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -10 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -15 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboarda3v1.cfg b/papart/data/old/markers/my_markerboarda3v1.cfg deleted file mode 100755 index ecc191d0..00000000 --- a/papart/data/old/markers/my_markerboarda3v1.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -0 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -1 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -2 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -3 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -4 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -5 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -13 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -12 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -7 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -8 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -9 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -6 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -10 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -11 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -14 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -15 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboarda3v2.cfg b/papart/data/old/markers/my_markerboarda3v2.cfg deleted file mode 100755 index bb6a44d1..00000000 --- a/papart/data/old/markers/my_markerboarda3v2.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -21 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -36 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -35 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -34 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -33 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -32 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -22 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -23 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -24 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -25 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -26 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -27 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -28 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -29 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -30 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -31 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboarda3v3.cfg b/papart/data/old/markers/my_markerboarda3v3.cfg deleted file mode 100755 index d467d2a3..00000000 --- a/papart/data/old/markers/my_markerboarda3v3.cfg +++ /dev/null @@ -1,139 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers 85 - 130 -16 - -# marker -47 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -55 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -54 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -53 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -52 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -51 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 5,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -50 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -49 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -48 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 15,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - - - -# marker -46 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 85,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -45 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 155,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -44 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 225,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -43 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 295,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -40 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 257,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -42 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 170,0 - 0,0000 0,0000 1,0000 0,0 - - -# marker -41 -35,0 --43,9 -26,9 - 1,0000 0,0000 0,0000 365,0 - 0,0000 1,0000 0,0000 100,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboardmini.cfg b/papart/data/old/markers/my_markerboardmini.cfg deleted file mode 100755 index 4df87f30..00000000 --- a/papart/data/old/markers/my_markerboardmini.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - -# marker -103 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -104 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 90,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -100 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 80,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -105 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 90,0 - 0,0000 1,0000 0,0000 80,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/my_markerboardmini2.cfg b/papart/data/old/markers/my_markerboardmini2.cfg deleted file mode 100755 index ef10e838..00000000 --- a/papart/data/old/markers/my_markerboardmini2.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - -# marker -103 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -104 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -100 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - -# marker -105 -35,0 -17,50 17,50 - 1,0000 0,0000 0,0000 130,0 - 0,0000 1,0000 0,0000 110,0 - 0,0000 0,0000 1,0000 0,0 - diff --git a/papart/data/old/markers/nouveaux/2285.cfg b/papart/data/old/markers/nouveaux/2285.cfg deleted file mode 100644 index 3af66c05..00000000 --- a/papart/data/old/markers/nouveaux/2285.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -2285 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 1 -2286 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 10.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 2 -2287 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 10.0 - 0.0000 1.0000 0.0000 45.0 - 0.0000 0.0000 1.0000 0.0 - -# marker 3 -2288 -30.0 -5.0 5.0 - 1.0000 0.0000 0.0000 45.0 - 0.0000 1.0000 0.0000 45.0 - 0.0000 0.0000 1.0000 0.0 diff --git a/papart/data/old/markers/nouveaux/2285.svg b/papart/data/old/markers/nouveaux/2285.svg deleted file mode 100644 index cdb6afae..00000000 --- a/papart/data/old/markers/nouveaux/2285.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - 2287 22882285 2286 - diff --git a/papart/data/old/markers/nouveaux/2290.cfg b/papart/data/old/markers/nouveaux/2290.cfg deleted file mode 100644 index 19384b30..00000000 --- a/papart/data/old/markers/nouveaux/2290.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -2290 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -2292 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -2291 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -2293 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/nouveaux/2290.svg b/papart/data/old/markers/nouveaux/2290.svg deleted file mode 100644 index e4f3d538..00000000 --- a/papart/data/old/markers/nouveaux/2290.svg +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - 2292 22932290 2291 - - - - - diff --git a/papart/data/old/markers/nouveaux/2300.cfg b/papart/data/old/markers/nouveaux/2300.cfg deleted file mode 100644 index 6006f581..00000000 --- a/papart/data/old/markers/nouveaux/2300.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -2300 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -2301 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -2302 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -2303 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/nouveaux/2300.svg b/papart/data/old/markers/nouveaux/2300.svg deleted file mode 100644 index 39430868..00000000 --- a/papart/data/old/markers/nouveaux/2300.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - 2302 23032300 2301 - - - - - diff --git a/papart/data/old/markers/nouveaux/2310.cfg b/papart/data/old/markers/nouveaux/2310.cfg deleted file mode 100644 index 1183828b..00000000 --- a/papart/data/old/markers/nouveaux/2310.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# multimarker definition file for ARToolKit (format defined by ARToolKit) -# dataset for test Painting application - -# number of markers -4 - - -# marker 0 -2310 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 1 -2311 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 10,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 2 -2312 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 10,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 - -# marker 3 -2313 -30,0 -5,0 5,0 - 1,0000 0,0000 0,0000 45,0 - 0,0000 1,0000 0,0000 45,0 - 0,0000 0,0000 1,0000 0,0 diff --git a/papart/data/old/markers/nouveaux/2310.svg b/papart/data/old/markers/nouveaux/2310.svg deleted file mode 100644 index 5baa330d..00000000 --- a/papart/data/old/markers/nouveaux/2310.svg +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - 2312 23132310 2311 - - - - - diff --git a/papart/data/old/markers/numPad.svg b/papart/data/old/markers/numPad.svg deleted file mode 100644 index 5ef2f5e5..00000000 --- a/papart/data/old/markers/numPad.svg +++ /dev/null @@ -1,230 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - 100   105103 104 this way up - - 120 121 122 123 - - 110 111112 113 - - - - - - diff --git a/papart/data/old/markers/touches.svg b/papart/data/old/markers/touches.svg deleted file mode 100644 index 140ee25b..00000000 --- a/papart/data/old/markers/touches.svg +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/papart/data/old/shaders/Filters/alpha.frag b/papart/data/old/shaders/Filters/alpha.frag deleted file mode 100644 index ce87175b..00000000 --- a/papart/data/old/shaders/Filters/alpha.frag +++ /dev/null @@ -1,9 +0,0 @@ -uniform sampler2D sceneTex; - -void main() -{ - - gl_FragColor = vec4(texture2D(sceneTex, gl_TexCoord[0].st).rgb, 0.0); -} - - diff --git a/papart/data/old/shaders/Filters/alpha.xml b/papart/data/old/shaders/Filters/alpha.xml deleted file mode 100644 index 22c2a495..00000000 --- a/papart/data/old/shaders/Filters/alpha.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Blur - default1.vert - alpha.frag - - 0 - - - - - diff --git a/papart/data/old/shaders/Filters/alphaZone.frag b/papart/data/old/shaders/Filters/alphaZone.frag deleted file mode 100644 index 54c04c65..00000000 --- a/papart/data/old/shaders/Filters/alphaZone.frag +++ /dev/null @@ -1,17 +0,0 @@ -uniform sampler2D sceneTex; -uniform sampler2D mask; - - -void main() -{ - - vec4 maskColor = texture2D(mask, gl_TexCoord[0].st); - vec4 texC = texture2D(sceneTex, gl_TexCoord[0].st); - - float a = 1. - maskColor.r; - - gl_FragColor = vec4(texC.rgb * a, a); - -} - - diff --git a/papart/data/old/shaders/Filters/alphaZone.xml b/papart/data/old/shaders/Filters/alphaZone.xml deleted file mode 100644 index 39a3454a..00000000 --- a/papart/data/old/shaders/Filters/alphaZone.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Blur Zone - default1.vert - alphaZone.frag - - 0 - 1 - - - - - diff --git a/papart/data/old/shaders/Filters/blur.frag b/papart/data/old/shaders/Filters/blur.frag deleted file mode 100644 index 93c45bc8..00000000 --- a/papart/data/old/shaders/Filters/blur.frag +++ /dev/null @@ -1,129 +0,0 @@ -uniform sampler2D sceneTex; -uniform vec2 wh; - - -/* vec2 gaussianDeriv(int deriSize){ */ - -/* int neighbor = 2*deriSize + 1; */ -/* float sigma = float(deriSize)/3.0; */ -/* float dem = 2.0*sigma*sigma; */ -/* vec4 sumX1 = vec4(0.0); */ -/* vec4 sumY1 = vec4(0.0); */ -/* for(int yi=0; yi 0.5){ */ - /* vec2 intens = gaussianDeriv(derivSize); */ - - /* /\* gl_FragColor = vec4(intens.r, intens.g, 0, 1); *\/ */ - /* /\* return; *\/ */ - - /* float threshold = intensT; */ - - /* if(intens.r > threshold || intens.g > threshold){ */ - /* // if(intens.r > 0.2 || intens.g > 0.2){ */ - - /* gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); */ - /* return; */ - - /* } else { */ - - /* gl_FragColor = vec4(texC.r * 0.3, texC.g * 0.3, texC.b * 0.3, 1.0); */ - /* return; */ - /* } */ - /* } */ - - - /* /// Blue codes for high intensity */ - /* if(maskColor.b > 0.5){ */ - - /* gl_FragColor = vec4(2.0 * texC.rgb, 1.0); */ - /* return; */ - - /* } */ - /* // green codes for Edge enhance */ - /* // No code ? Image */ - - /* gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); */ -} - - diff --git a/papart/data/old/shaders/Filters/blur.xml b/papart/data/old/shaders/Filters/blur.xml deleted file mode 100644 index 646a35e6..00000000 --- a/papart/data/old/shaders/Filters/blur.xml +++ /dev/null @@ -1,12 +0,0 @@ - - Blur - default1.vert - blur.frag - - 0 - - 0.2 0.2 - - - - diff --git a/papart/data/old/shaders/Filters/blurZone.frag b/papart/data/old/shaders/Filters/blurZone.frag deleted file mode 100644 index ddbbff8b..00000000 --- a/papart/data/old/shaders/Filters/blurZone.frag +++ /dev/null @@ -1,92 +0,0 @@ -uniform sampler2D sceneTex; -uniform sampler2D mask; - -uniform vec2 wh; -/* uniform int derivSize; */ -/* uniform float intensT; */ - -vec4 computeBlur(){ - - vec2 uv = gl_TexCoord[0].xy; - vec4 c = texture2D(sceneTex, uv); - - c += texture2D(sceneTex, uv+0.001); - c += texture2D(sceneTex, uv+0.003); - c += texture2D(sceneTex, uv+0.005); - c += texture2D(sceneTex, uv+0.007); - c += texture2D(sceneTex, uv+0.009); - c += texture2D(sceneTex, uv+0.011); - - c += texture2D(sceneTex, uv-0.001); - c += texture2D(sceneTex, uv-0.003); - c += texture2D(sceneTex, uv-0.005); - c += texture2D(sceneTex, uv-0.007); - c += texture2D(sceneTex, uv-0.009); - c += texture2D(sceneTex, uv-0.011); - - c.rgb = vec3((c.r+c.g+c.b)/3.0); - // c = c / 9.5; - - c = c / 11.5; - - return c; -} - -vec4 gaussianBlur(){ - - float dx = wh.s; - float dy = wh.t; - vec2 st = gl_TexCoord[0].st; - - // Apply 3x3 gaussian filter - vec4 color = 4.0 * texture2D(sceneTex, st); - color += 2.0 * texture2D(sceneTex, st + vec2(+dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(-dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, +dy)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, -dy)); - - return color/ 16.0; -} - - -void main() -{ - // RECOPIE - // gl_FragColor = vec4(0.4, 0.2, 0.8, 0.3); - - vec4 maskColor = texture2D(mask, gl_TexCoord[0].st); - vec4 texC = texture2D(sceneTex, gl_TexCoord[0].st); - - float dx = wh.s; - float dy = wh.t; - vec2 st = gl_TexCoord[0].st; - - // Apply 3x3 gaussian filter - vec4 color = 4.0 * texture2D(sceneTex, st); - color += 2.0 * texture2D(sceneTex, st + vec2(+dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(-dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, +dy)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, -dy)); - - color = color / 16.0; - vec4 color2 = texture2D(sceneTex, gl_TexCoord[0].st); - - - gl_FragColor = (maskColor.r * color) + (1. - maskColor.r) * color2; - - // gl_FragColor = color; - - - // gl_FragColor = vec4(maskColor.r, color, color, 0.5); - -} - - diff --git a/papart/data/old/shaders/Filters/blurZone.xml b/papart/data/old/shaders/Filters/blurZone.xml deleted file mode 100644 index 30ace7cf..00000000 --- a/papart/data/old/shaders/Filters/blurZone.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Blur Zone - default1.vert - blurZone.frag - - 0 - 1 - - 0.2 0.2 - - - - - - diff --git a/papart/data/old/shaders/Filters/default1.vert b/papart/data/old/shaders/Filters/default1.vert deleted file mode 100644 index ffd109b4..00000000 --- a/papart/data/old/shaders/Filters/default1.vert +++ /dev/null @@ -1,14 +0,0 @@ - - -//vertex shader - -void main() -{ - // gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; - // gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - - // gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_Position = ftransform(); - -} diff --git a/papart/data/old/shaders/Filters/oldFilm.frag b/papart/data/old/shaders/Filters/oldFilm.frag deleted file mode 100644 index bb7f7416..00000000 --- a/papart/data/old/shaders/Filters/oldFilm.frag +++ /dev/null @@ -1,149 +0,0 @@ -/// http://devmaster.net/posts/2989/shader-effects-old-film - - -/// -/// Uniform variables. -/// -uniform vec2 ImageSize; -uniform vec2 TexelSize; -uniform vec4 Colour; -uniform sampler2D Sample0; - -uniform float SepiaValue; -uniform float NoiseValue; -uniform float ScratchValue; -uniform float InnerVignetting; -uniform float OuterVignetting; -uniform float RandomValue; -uniform float TimeLapse; - - -/// -/// Varying variables. -/// -varying vec2 vUv; - - -/// -/// Computes the overlay between the source and destination colours. -/// -vec3 Overlay (vec3 src, vec3 dst) -{ - // if (dst <= Ω) then: 2 * src * dst - // if (dst > Ω) then: 1 - 2 * (1 - dst) * (1 - src) - return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), - (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), - (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); -} - - -/// -/// 2D Noise by Ian McEwan, Ashima Arts. -/// -vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } -vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } -vec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); } -float snoise (vec2 v) -{ - const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0 - 0.366025403784439, // 0.5*(sqrt(3.0)-1.0) - -0.577350269189626, // -1.0 + 2.0 * C.x - 0.024390243902439); // 1.0 / 41.0 - - // First corner - vec2 i = floor(v + dot(v, C.yy) ); - vec2 x0 = v - i + dot(i, C.xx); - - // Other corners - vec2 i1; - i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0); - vec4 x12 = x0.xyxy + C.xxzz; - x12.xy -= i1; - - // Permutations - i = mod289(i); // Avoid truncation effects in permutation - vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) - + i.x + vec3(0.0, i1.x, 1.0 )); - - vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0); - m = m*m ; - m = m*m ; - - // Gradients: 41 points uniformly over a line, mapped onto a diamond. - // The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287) - - vec3 x = 2.0 * fract(p * C.www) - 1.0; - vec3 h = abs(x) - 0.5; - vec3 ox = floor(x + 0.5); - vec3 a0 = x - ox; - - // Normalise gradients implicitly by scaling m - // Approximation of: m *= inversesqrt( a0*a0 + h*h ); - m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h ); - - // Compute final noise value at P - vec3 g; - g.x = a0.x * x0.x + h.x * x0.y; - g.yz = a0.yz * x12.xz + h.yz * x12.yw; - return 130.0 * dot(m, g); -} - - -/// -/// Fragment shader entry. -/// -void main () -{ - // Sepia RGB value - vec3 sepia = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0); - - // Step 1: Convert to grayscale - vec3 colour = texture2D(Sample0, vUv).xyz; - float gray = (colour.x + colour.y + colour.z) / 3.0; - vec3 grayscale = vec3(gray); - - // Step 2: Appy sepia overlay - vec3 finalColour = Overlay(sepia, grayscale); - - // Step 3: Lerp final sepia colour - finalColour = grayscale + SepiaValue * (finalColour - grayscale); - - // Step 4: Add noise - float noise = snoise(vUv * vec2(1024.0 + RandomValue * 512.0, 1024.0 + RandomValue * 512.0)) * 0.5; - finalColour += noise * NoiseValue; - - // Optionally add noise as an overlay, simulating ISO on the camera - //vec3 noiseOverlay = Overlay(finalColour, vec3(noise)); - //finalColour = finalColour + NoiseValue * (finalColour - noiseOverlay); - - // Step 5: Apply scratches - if ( RandomValue < ScratchValue ) - { - // Pick a random spot to show scratches - float dist = 1.0 / ScratchValue; - float d = distance(vUv, vec2(RandomValue * dist, RandomValue * dist)); - if ( d < 0.4 ) - { - // Generate the scratch - float xPeriod = 8.0; - float yPeriod = 1.0; - float pi = 3.141592; - float phase = TimeLapse; - float turbulence = snoise(vUv * 2.5); - float vScratch = 0.5 + (sin(((vUv.x * xPeriod + vUv.y * yPeriod + turbulence)) * pi + phase) * 0.5); - vScratch = clamp((vScratch * 10000.0) + 0.35, 0.0, 1.0); - - finalColour.xyz *= vScratch; - } - } - - // Step 6: Apply vignetting - // Max distance from centre to corner is ~0.7. Scale that to 1.0. - /* float d = distance(vec2(0.5, 0.5), vUv) * 1.414213; */ - /* float vignetting = clamp((OuterVignetting - d) / (OuterVignetting - InnerVignetting), 0.0, 1.0); */ - /* finalColour.xyz *= vignetting; */ - - // Apply colour - gl_FragColor.xyz = finalColour; - gl_FragColor.w = 1.0; -} diff --git a/papart/data/old/shaders/Filters/oldFilm.xml b/papart/data/old/shaders/Filters/oldFilm.xml deleted file mode 100644 index 8c9c14f5..00000000 --- a/papart/data/old/shaders/Filters/oldFilm.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Blur - default1.vert - oldFilm.frag - - 0 - - 0.2 - 0.2 - 0.2 - 0.1 - 0.8 - 0.2 - 0.2 - - - - diff --git a/papart/data/old/shaders/Filters/oldFilmZone.frag b/papart/data/old/shaders/Filters/oldFilmZone.frag deleted file mode 100644 index b0a84a3f..00000000 --- a/papart/data/old/shaders/Filters/oldFilmZone.frag +++ /dev/null @@ -1,152 +0,0 @@ - -/// -/// Uniform variables. -/// -uniform vec2 ImageSize; -uniform vec2 TexelSize; -uniform vec4 Colour; -uniform sampler2D Sample0; -uniform sampler2D mask; - -uniform float SepiaValue; -uniform float NoiseValue; -uniform float ScratchValue; -uniform float InnerVignetting; -uniform float OuterVignetting; -uniform float RandomValue; -uniform float TimeLapse; - - - -/// -/// Computes the overlay between the source and destination colours. -/// -vec3 Overlay (vec3 src, vec3 dst) -{ - // if (dst <= Ω) then: 2 * src * dst - // if (dst > Ω) then: 1 - 2 * (1 - dst) * (1 - src) - return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), - (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), - (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); -} - - -/// -/// 2D Noise by Ian McEwan, Ashima Arts. -/// -vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } -vec2 mod289(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; } -vec3 permute(vec3 x) { return mod289(((x*34.0)+1.0)*x); } -float snoise (vec2 v) -{ - const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0 - 0.366025403784439, // 0.5*(sqrt(3.0)-1.0) - -0.577350269189626, // -1.0 + 2.0 * C.x - 0.024390243902439); // 1.0 / 41.0 - - // First corner - vec2 i = floor(v + dot(v, C.yy) ); - vec2 x0 = v - i + dot(i, C.xx); - - // Other corners - vec2 i1; - i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0); - vec4 x12 = x0.xyxy + C.xxzz; - x12.xy -= i1; - - // Permutations - i = mod289(i); // Avoid truncation effects in permutation - vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 )) - + i.x + vec3(0.0, i1.x, 1.0 )); - - vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0); - m = m*m ; - m = m*m ; - - // Gradients: 41 points uniformly over a line, mapped onto a diamond. - // The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287) - - vec3 x = 2.0 * fract(p * C.www) - 1.0; - vec3 h = abs(x) - 0.5; - vec3 ox = floor(x + 0.5); - vec3 a0 = x - ox; - - // Normalise gradients implicitly by scaling m - // Approximation of: m *= inversesqrt( a0*a0 + h*h ); - m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h ); - - // Compute final noise value at P - vec3 g; - g.x = a0.x * x0.x + h.x * x0.y; - g.yz = a0.yz * x12.xz + h.yz * x12.yw; - return 130.0 * dot(m, g); -} - - -/// -/// Fragment shader entry. -/// -void main () -{ - - vec2 vUv = gl_TexCoord[0].st; - - // Sepia RGB value - vec3 sepia = vec3(112.0 / 255.0, 66.0 / 255.0, 20.0 / 255.0); - - // Step 1: Convert to grayscale - vec3 colour = texture2D(Sample0, vUv).xyz; - float gray = (colour.x + colour.y + colour.z) / 3.0; - vec3 grayscale = vec3(gray); - - // Step 2: Appy sepia overlay - vec3 finalColour = Overlay(sepia, grayscale); - - // Step 3: Lerp final sepia colour - finalColour = grayscale + SepiaValue * (finalColour - grayscale); - - // Step 4: Add noise - float noise = snoise(vUv * vec2(1024.0 + RandomValue * 512.0, 1024.0 + RandomValue * 512.0)) * 0.5; - finalColour += noise * NoiseValue; - - // Optionally add noise as an overlay, simulating ISO on the camera - //vec3 noiseOverlay = Overlay(finalColour, vec3(noise)); - //finalColour = finalColour + NoiseValue * (finalColour - noiseOverlay); - - // Step 5: Apply scratches - if ( RandomValue < ScratchValue ) - { - // Pick a random spot to show scratches - float dist = 1.0 / ScratchValue; - float d = distance(vUv, vec2(RandomValue * dist, RandomValue * dist)); - if ( d < 0.4 ) - { - // Generate the scratch - float xPeriod = 8.0; - float yPeriod = 1.0; - float pi = 3.141592; - float phase = TimeLapse; - float turbulence = snoise(vUv * 2.5); - float vScratch = 0.5 + (sin(((vUv.x * xPeriod + vUv.y * yPeriod + turbulence)) * pi + phase) * 0.5); - vScratch = clamp((vScratch * 10000.0) + 0.35, 0.0, 1.0); - - finalColour.xyz *= vScratch; - } - } - - // Step 6: Apply vignetting - // Max distance from centre to corner is ~0.7. Scale that to 1.0. - /* float d = distance(vec2(0.5, 0.5), vUv) * 1.414213; */ - /* float vignetting = clamp((OuterVignetting - d) / (OuterVignetting - InnerVignetting), 0.0, 1.0); */ - /* finalColour.xyz *= vignetting; */ - - // Apply colour - - - gl_FragColor.xyz = finalColour; - gl_FragColor.w = texture2D(Sample0, gl_TexCoord[0].st).w; - - - // gl_FragColor = vec4((maskColor.r * finalColour).xyz + ((1. - maskColor.r) * colour).xyz, colour.w); - -} diff --git a/papart/data/old/shaders/Filters/oldFilmZone.xml b/papart/data/old/shaders/Filters/oldFilmZone.xml deleted file mode 100644 index 41884e7e..00000000 --- a/papart/data/old/shaders/Filters/oldFilmZone.xml +++ /dev/null @@ -1,19 +0,0 @@ - - Blur Zone - default1.vert - oldFilmZone.frag - - 0 - 1 - - 0.7 - 0.3 - 0.3 - - - 0.0 - 0.5 - - - - diff --git a/papart/data/old/shaders/Sobel.xml b/papart/data/old/shaders/Sobel.xml deleted file mode 100755 index 9b232b44..00000000 --- a/papart/data/old/shaders/Sobel.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Sobel edge detector (requires OpenGL 3.3) - SobelVert.glsl - SobelFrag.glsl - - 0 - - - - - diff --git a/papart/data/old/shaders/SobelFrag.glsl b/papart/data/old/shaders/SobelFrag.glsl deleted file mode 100755 index f33e73c6..00000000 --- a/papart/data/old/shaders/SobelFrag.glsl +++ /dev/null @@ -1,41 +0,0 @@ -#version 330 compatibility - -uniform sampler2D sceneTex; -uniform vec2 offset; - -uniform mat3 G[2] = mat3[] -( - mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 ), - mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 ) -); - -void main() -{ - vec2 uv = gl_TexCoord[0].xy; - vec3 tc = vec3(1.0, 0.0, 0.0); - - mat3 I; - float cnv[2]; - vec3 sample; - - // fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value - for (int i=0; i<3; i++) - { - for (int j=0; j<3; j++) - { - sample = texelFetch(sceneTex, ivec2(uv / offset) + ivec2(i-1,j-1), 0).rgb; - I[i][j] = length(sample); - } - } - - // calculate the convolution values for all the masks - for (int i=0; i<2; i++) - { - float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]); - cnv[i] = dp3 * dp3; - } - - tc = vec3(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1])); - - gl_FragColor = vec4(tc, 1.0); -} diff --git a/papart/data/old/shaders/SobelVert.glsl b/papart/data/old/shaders/SobelVert.glsl deleted file mode 100755 index 34f23f45..00000000 --- a/papart/data/old/shaders/SobelVert.glsl +++ /dev/null @@ -1,7 +0,0 @@ -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; -} - - diff --git a/papart/data/old/shaders/Thermal.xml b/papart/data/old/shaders/Thermal.xml deleted file mode 100755 index f8b027d3..00000000 --- a/papart/data/old/shaders/Thermal.xml +++ /dev/null @@ -1,11 +0,0 @@ - - Predator’s Thermal Vision Post Processing Filter - ThermalVert.glsl - ThermalFrag.glsl - - 0 - - - - - diff --git a/papart/data/old/shaders/ThermalFrag.glsl b/papart/data/old/shaders/ThermalFrag.glsl deleted file mode 100755 index 8a61f65e..00000000 --- a/papart/data/old/shaders/ThermalFrag.glsl +++ /dev/null @@ -1,16 +0,0 @@ -uniform sampler2D sceneTex; - -void main() -{ - vec2 uv = gl_TexCoord[0].xy; - vec3 tc = vec3(1.0, 0.0, 0.0); - vec3 pixcol = texture2D(sceneTex, uv).rgb; - vec3 colors[3]; - colors[0] = vec3(0.,0.,1.); - colors[1] = vec3(1.,1.,0.); - colors[2] = vec3(1.,0.,0.); - float lum = (pixcol.r+pixcol.g+pixcol.b)/3.; - int ix = (lum < 0.5)? 0:1; - tc = mix(colors[ix],colors[ix+1],(lum-float(ix)*0.5)/0.5); - gl_FragColor = vec4(tc, 1.0); -} \ No newline at end of file diff --git a/papart/data/old/shaders/ThermalVert.glsl b/papart/data/old/shaders/ThermalVert.glsl deleted file mode 100755 index 34f23f45..00000000 --- a/papart/data/old/shaders/ThermalVert.glsl +++ /dev/null @@ -1,7 +0,0 @@ -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; -} - - diff --git a/papart/data/old/shaders/Toon.xml b/papart/data/old/shaders/Toon.xml deleted file mode 100755 index bc3036b9..00000000 --- a/papart/data/old/shaders/Toon.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Toon shading on images, by Agnius Vasiliauskas (http://coding-experiments.blogspot.com/2011/01/toon-pixel-shader.html) - ToonVert.glsl - ToonFrag.glsl - - 0 - - - - 0.0 80.0 160.0 240.0 320.0 360.0 - - 0.0 0.15 0.3 0.45 0.6 0.8 1.0 - 0.0 0.3 0.6 1.0 - - - - - diff --git a/papart/data/old/shaders/ToonFrag.glsl b/papart/data/old/shaders/ToonFrag.glsl deleted file mode 100755 index 549b0b13..00000000 --- a/papart/data/old/shaders/ToonFrag.glsl +++ /dev/null @@ -1,169 +0,0 @@ -uniform sampler2D Texture0; -uniform vec2 offset; - -#define HueLevCount 6 -#define SatLevCount 7 -#define ValLevCount 4 -uniform float HueLevels[HueLevCount]; -uniform float SatLevels[SatLevCount]; -uniform float ValLevels[ValLevCount]; - -vec3 RGBtoHSV( float r, float g, float b) { - float minv, maxv, delta; - vec3 res; - - minv = min(min(r, g), b); - maxv = max(max(r, g), b); - res.z = maxv; // v - - delta = maxv - minv; - - if( maxv != 0.0 ) - res.y = delta / maxv; // s - else { - // r = g = b = 0 // s = 0, v is undefined - res.y = 0.0; - res.x = -1.0; - return res; - } - - if( r == maxv ) - res.x = ( g - b ) / delta; // between yellow & magenta - else if( g == maxv ) - res.x = 2.0 + ( b - r ) / delta; // between cyan & yellow - else - res.x = 4.0 + ( r - g ) / delta; // between magenta & cyan - - res.x = res.x * 60.0; // degrees - if( res.x < 0.0 ) - res.x = res.x + 360.0; - - return res; -} - -vec3 HSVtoRGB(float h, float s, float v ) { - int i; - float f, p, q, t; - vec3 res; - - if( s == 0.0 ) { - // achromatic (grey) - res.x = v; - res.y = v; - res.z = v; - return res; - } - - h /= 60.0; // sector 0 to 5 - i = int(floor( h )); - f = h - float(i); // factorial part of h - p = v * ( 1.0 - s ); - q = v * ( 1.0 - s * f ); - t = v * ( 1.0 - s * ( 1.0 - f ) ); - - // Default: - res.x = v; - res.y = p; - res.z = q; - if (i == 0) { - res.x = v; - res.y = t; - res.z = p; - } - if (i == 1) { - res.x = q; - res.y = v; - res.z = p; - } - if (i == 2) { - res.x = p; - res.y = v; - res.z = t; - } - if (i == 3) { - res.x = p; - res.y = q; - res.z = v; - } - if (i == 4) { - res.x = t; - res.y = p; - res.z = v; - } - - return res; -} - -float nearestLevel(float col, int mode) { - int levCount; - if (mode==0) levCount = HueLevCount; - if (mode==1) levCount = SatLevCount; - if (mode==2) levCount = ValLevCount; - - for (int i =0; i= HueLevels[i] && col <= HueLevels[i+1]) { - return HueLevels[i+1]; - } - } - if (mode==1) { - if (col >= SatLevels[i] && col <= SatLevels[i+1]) { - return SatLevels[i+1]; - } - } - if (mode==2) { - if (col >= ValLevels[i] && col <= ValLevels[i+1]) { - return ValLevels[i+1]; - } - } - } -} - -// averaged pixel intensity from 3 color channels -float avg_intensity(vec4 pix) { - return (pix.r + pix.g + pix.b)/3.; -} - -vec4 get_pixel(vec2 coords, float dx, float dy) { - return texture2D(Texture0,coords + vec2(dx, dy)); -} - -// returns pixel color -float IsEdge(in vec2 coords){ - float dxtex = offset.x; - float dytex = offset.y; - float pix[9]; - int k = -1; - float delta; - - // read neighboring pixel intensities - for (int i=-1; i<2; i++) { - for(int j=-1; j<2; j++) { - k++; - pix[k] = avg_intensity(get_pixel(coords,float(i)*dxtex, - float(j)*dytex)); - } - } - - // average color differences around neighboring pixels - delta = (abs(pix[1]-pix[7])+ - abs(pix[5]-pix[3]) + - abs(pix[0]-pix[8])+ - abs(pix[2]-pix[6]) - )/4.; - - return clamp(5.5*delta,0.0,1.0); -} - -void main(void) -{ - vec2 texCoord = gl_TexCoord[0].xy; - vec4 colorOrg = texture2D( Texture0, texCoord ); - vec3 vHSV = RGBtoHSV(colorOrg.r,colorOrg.g,colorOrg.b); - vHSV.x = nearestLevel(vHSV.x, 0); - vHSV.y = nearestLevel(vHSV.y, 1); - vHSV.z = nearestLevel(vHSV.z, 2); - float edg = IsEdge(texCoord); - vec3 vRGB = (edg >= 0.3)? vec3(0.0,0.0,0.0):HSVtoRGB(vHSV.x,vHSV.y,vHSV.z); - gl_FragColor = vec4(vRGB.x,vRGB.y,vRGB.z,1.0); -} \ No newline at end of file diff --git a/papart/data/old/shaders/ToonVert.glsl b/papart/data/old/shaders/ToonVert.glsl deleted file mode 100755 index 34f23f45..00000000 --- a/papart/data/old/shaders/ToonVert.glsl +++ /dev/null @@ -1,7 +0,0 @@ -void main(void) -{ - gl_Position = ftransform(); - gl_TexCoord[0] = gl_MultiTexCoord0; -} - - diff --git a/papart/data/old/shaders/anaglyph.frag b/papart/data/old/shaders/anaglyph.frag deleted file mode 100755 index 4594e056..00000000 --- a/papart/data/old/shaders/anaglyph.frag +++ /dev/null @@ -1,15 +0,0 @@ -uniform sampler2D leftTex; -uniform sampler2D rightTex; - -void main() -{ - // RECOPIE - // gl_FragColor = vec4(0.4, 0.2, 0.8, 0.3); - - vec4 leftColor = texture2D(leftTex, gl_TexCoord[0].st); - vec4 rightColor = texture2D(rightTex, gl_TexCoord[0].st); - - gl_FragColor = normalize(leftColor + rightColor); - -} - diff --git a/papart/data/old/shaders/anaglyph.vert b/papart/data/old/shaders/anaglyph.vert deleted file mode 100755 index 2d83590e..00000000 --- a/papart/data/old/shaders/anaglyph.vert +++ /dev/null @@ -1,12 +0,0 @@ -//vertex shader - -void main() -{ - // gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; - // gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - - // gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_Position = ftransform(); - -} diff --git a/papart/data/old/shaders/anaglyph.xml b/papart/data/old/shaders/anaglyph.xml deleted file mode 100755 index 7ecdb9a7..00000000 --- a/papart/data/old/shaders/anaglyph.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Apply the opposite of the projector lens distortion to get a good visualisation. - anaglyph.vert - anaglyph.frag - - 0 - 1 - - - diff --git a/papart/data/old/shaders/blur.frag b/papart/data/old/shaders/blur.frag deleted file mode 100644 index c22d9d25..00000000 --- a/papart/data/old/shaders/blur.frag +++ /dev/null @@ -1,151 +0,0 @@ -uniform sampler2D sceneTex; -uniform sampler2D mask; - -uniform vec2 wh; -uniform int derivSize; -uniform float intensT; - -vec4 computeBlur(){ - - vec2 uv = gl_TexCoord[0].xy; - vec4 c = texture2D(sceneTex, uv); - - c += texture2D(sceneTex, uv+0.001); - c += texture2D(sceneTex, uv+0.003); - c += texture2D(sceneTex, uv+0.005); - c += texture2D(sceneTex, uv+0.007); - c += texture2D(sceneTex, uv+0.009); - c += texture2D(sceneTex, uv+0.011); - - c += texture2D(sceneTex, uv-0.001); - c += texture2D(sceneTex, uv-0.003); - c += texture2D(sceneTex, uv-0.005); - c += texture2D(sceneTex, uv-0.007); - c += texture2D(sceneTex, uv-0.009); - c += texture2D(sceneTex, uv-0.011); - - c.rgb = vec3((c.r+c.g+c.b)/3.0); - // c = c / 9.5; - - c = c / 11.5; - - return c; -} - -vec4 gaussianBlur(){ - - float dx = wh.s; - float dy = wh.t; - vec2 st = gl_TexCoord[0].st; - - // Apply 3x3 gaussian filter - vec4 color = 4.0 * texture2D(sceneTex, st); - color += 2.0 * texture2D(sceneTex, st + vec2(+dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(-dx, 0.0)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, +dy)); - color += 2.0 * texture2D(sceneTex, st + vec2(0.0, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, +dy)); - color += texture2D(sceneTex, st + vec2(-dx, -dy)); - color += texture2D(sceneTex, st + vec2(+dx, -dy)); - - return color/ 16.0; -} - - -vec2 gaussianDeriv(int deriSize){ - - int neighbor = 2*deriSize + 1; - float sigma = float(deriSize)/3.0; - float dem = 2.0*sigma*sigma; - vec4 sumX1 = vec4(0.0); - vec4 sumY1 = vec4(0.0); - for(int yi=0; yi 0.7){ - - gl_FragColor = computeBlur(); - return; - } - - if(maskColor.g > 0.5){ - vec2 intens = gaussianDeriv(derivSize); - - /* gl_FragColor = vec4(intens.r, intens.g, 0, 1); */ - /* return; */ - - float threshold = intensT; - - if(intens.r > threshold || intens.g > threshold){ - // if(intens.r > 0.2 || intens.g > 0.2){ - - gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); - return; - - } else { - - gl_FragColor = vec4(texC.r * 0.3, texC.g * 0.3, texC.b * 0.3, 1.0); - return; - } - } - - - /// Blue codes for high intensity - if(maskColor.b > 0.5){ - - gl_FragColor = vec4(2.0 * texC.rgb, 1.0); - return; - - } - // green codes for Edge enhance - // No code ? Image - - gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); - - // gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); - - /* vec4 c1 = texture2D(sceneTex, gl_TexCoord[0].st); */ - /* vec4 c2 = texture2D(mask, gl_TexCoord[0].st); */ - /* /\* gl_FragColor = texture2D(mask, gl_TexCoord[0].st); *\/ */ - - /* gl_FragColor = c2; */ - - // gl_FragColor = vec4(c1.r,, 0.5, 1.0); - - // gl_FragColor = texture2D(sceneTex, gl_TexCoord[0].st); - -} - diff --git a/papart/data/old/shaders/blur.vert b/papart/data/old/shaders/blur.vert deleted file mode 100644 index ffd109b4..00000000 --- a/papart/data/old/shaders/blur.vert +++ /dev/null @@ -1,14 +0,0 @@ - - -//vertex shader - -void main() -{ - // gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex; - // gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - - // gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_TexCoord[0] = gl_MultiTexCoord0; - gl_Position = ftransform(); - -} diff --git a/papart/data/old/shaders/blur.xml b/papart/data/old/shaders/blur.xml deleted file mode 100644 index 99416e46..00000000 --- a/papart/data/old/shaders/blur.xml +++ /dev/null @@ -1,15 +0,0 @@ - - Dream Vision Post Processing Filter - blur.vert - blur.frag - - 0 - 1 - - 0.2 0.2 - 5 - 0.3 - - - - diff --git a/papart/data/old/shaders/calib.xml b/papart/data/old/shaders/calib.xml deleted file mode 100644 index a1dde8b2..00000000 --- a/papart/data/old/shaders/calib.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - 400 - 1200 - - - - 0.026787128 - 0.008649012 - -0.872214 - - - -0.035829786 - 0.60323375 - -0.7967593 - - 0.0059999996 - 1 - - - -1.3911159038543701 - 0.07879400253295898 - 0.35574108362197876 - -0.14813756942749023 - -2.9834423065185547 - 0.5096640586853027 - 0.06685977429151535 - -0.999718189239502 - 1.0 - - - - localhost - 3333 - - - 50 - 50 - - diff --git a/papart/data/old/shaders/capSc.frag b/papart/data/old/shaders/capSc.frag deleted file mode 100644 index 537f2189..00000000 --- a/papart/data/old/shaders/capSc.frag +++ /dev/null @@ -1,45 +0,0 @@ -uniform sampler2D tex; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - - -void main() -{ - /* vec3 n,halfV,viewV,ldir; */ - /* float NdotL,NdotHV; */ - /* vec4 color = ambient; */ - - /* /\* a fragment shader can't write a verying variable, hence we need */ - /* a new variable to store the normalized interpolated normal *\/ */ - /* n = normalize(normal); */ - - /* /\* compute the dot product between normal and ldir *\/ */ - /* NdotL = max(dot(n,lightDir),0.0); */ - - /* if (NdotL > 0.0) { */ - /* halfV = normalize(halfVector); */ - /* NdotHV = max(dot(n,halfV),0.0); */ - /* color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); */ - /* color += diffuse * NdotL; */ - /* } */ - - - vec3 ct,cf; - vec4 texel; - float intensity,at,af; - intensity = max(dot(lightDir,normalize(normal)),0.0); - - cf = intensity * (gl_FrontMaterial.diffuse).rgb + - gl_FrontMaterial.ambient.rgb * 0.6; - af = gl_FrontMaterial.diffuse.a; - - // texel = texture2D(gl_TextureMatrix[0], gl_TexCoord[0].st); - texel = texture2D(tex, gl_TexCoord[0].st); - // texel = texture2D(tex,gl_TexCoord[0].st); - - ct = texel.rgb; - at = texel.a; - gl_FragColor = vec4(ct * cf, at * af); - -} diff --git a/papart/data/old/shaders/capSc.vert b/papart/data/old/shaders/capSc.vert deleted file mode 100644 index cc6d9c39..00000000 --- a/papart/data/old/shaders/capSc.vert +++ /dev/null @@ -1,26 +0,0 @@ -/* // Used for shadow lookup */ -/* varying vec4 ShadowCoord; */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - // halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - /* ShadowCoord= gl_TextureMatrix[7] * gl_Vertex ; */ - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/classique/color.frag b/papart/data/old/shaders/classique/color.frag deleted file mode 100644 index 0e0697ba..00000000 --- a/papart/data/old/shaders/classique/color.frag +++ /dev/null @@ -1,8 +0,0 @@ - -varying float intensity; - - -void main() -{ - gl_FragColor = vec4(gl_Color.rgb * intensity, 1); -} diff --git a/papart/data/old/shaders/classique/color.vert b/papart/data/old/shaders/classique/color.vert deleted file mode 100644 index e620a034..00000000 --- a/papart/data/old/shaders/classique/color.vert +++ /dev/null @@ -1,11 +0,0 @@ - - -varying float intensity; - -void main() -{ - vec3 lightDir = normalize(vec3(gl_LightSource[0].position)); - intensity = dot(lightDir,gl_Normal); - gl_FrontColor = gl_Color; - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix-tex.xml b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix-tex.xml deleted file mode 100644 index fecdf1a5..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix-tex.xml +++ /dev/null @@ -1,9 +0,0 @@ - - normal drawing - dirLightAmbDiffSpecPix.vert - dirLightAmbDiffSpecPix-tex.frag - - 0 - - - diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.frag b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.frag deleted file mode 100755 index 30d0209f..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.frag +++ /dev/null @@ -1,36 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - gl_FragColor = color; -} diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.vert b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.vert deleted file mode 100755 index c24379b7..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.vert +++ /dev/null @@ -1,34 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.xml b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.xml deleted file mode 100755 index e1f655b9..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPix.xml +++ /dev/null @@ -1,9 +0,0 @@ - - normal drawing - dirLightAmbDiffSpecPix.vert - dirLightAmbDiffSpecPix.frag - - 0 - - - diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.frag b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.frag deleted file mode 100755 index abdb06ab..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.frag +++ /dev/null @@ -1,56 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,diffuse2,ambient; -varying vec3 normal,lightDir,halfVector,lightDir2,halfVector2; - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotL2,NdotHV; - float intensity, intens1, intens2; - // vec4 color = ambient; - vec4 color = vec4(0, 0, 0, 0); - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - NdotL2 = max(dot(n,lightDir2),0.0); - - if (NdotL > 0.0) { - // halfV = normalize(halfVector); - // NdotHV = max(dot(n,halfV),0.0); - // color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - if (NdotL2 > 0.0) { - // halfV = normalize(halfVector2); - // NdotHV = max(dot(n,halfV),0.0); - // color += gl_FrontMaterial.specular * gl_LightSource[1].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse2 * NdotL2; - } - - intensity = (NdotL + NdotL2) * 0.8; - - intens1 = NdotL / intensity; - intens2 = NdotL2 / intensity; - - // if(intensity >= 1.) - color = diffuse * NdotL * intens1 + diffuse2 * NdotL2 * intens2; - /* else */ - /* color = diffuse * NdotL + diffuse2 * NdotL2 ; */ - // color = gl_LightSource[0].diffuse * 0.5 * NdotL + gl_LightSource[1].diffuse * NdotL2 * 0.5; - - gl_FragColor = color; -} diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.vert b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.vert deleted file mode 100755 index ce1bb1a6..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.vert +++ /dev/null @@ -1,37 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,diffuse2,ambient; -varying vec3 normal,lightDir,halfVector,lightDir2,halfVector2; - -void main() -{ - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - lightDir2 = normalize(vec3(gl_LightSource[1].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - halfVector2 = normalize(gl_LightSource[1].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * (gl_LightSource[0].diffuse); //+ gl_LightSource[1].diffuse); - diffuse2 = gl_FrontMaterial.diffuse * (gl_LightSource[1].diffuse); //+ gl_LightSource[1].diffuse); - // ambient = gl_FrontMaterial.ambient * (gl_LightSource[1].ambient);// + gl_LightSource[1].ambient); - // ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.xml b/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.xml deleted file mode 100755 index 83eeb74d..00000000 --- a/papart/data/old/shaders/classique/dirLightAmbDiffSpecPixMult2.xml +++ /dev/null @@ -1,9 +0,0 @@ - - normal drawing - dirLightAmbDiffSpecPixMult2.vert - dirLightAmbDiffSpecPixMult2.frag - - 0 - - - diff --git a/papart/data/old/shaders/classique/kinect1.frag b/papart/data/old/shaders/classique/kinect1.frag deleted file mode 100755 index a0a25c6d..00000000 --- a/papart/data/old/shaders/classique/kinect1.frag +++ /dev/null @@ -1,45 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; -varying vec4 v_color; - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - - //vec4 color = ambient; - // vec4 color = v_color; - vec4 color = vec4(0, 0, 0, 0); - - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.4) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - - /* color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); */ - - // color += gl_LightSource[0].ambient * pow(NdotHV, 10.); - color += gl_LightSource[0].ambient * NdotL * v_color; - // color += diffuse * NdotL; - } - - gl_FragColor = v_color; - -} diff --git a/papart/data/old/shaders/classique/kinect1.vert b/papart/data/old/shaders/classique/kinect1.vert deleted file mode 100755 index 648b624a..00000000 --- a/papart/data/old/shaders/classique/kinect1.vert +++ /dev/null @@ -1,39 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; -varying vec4 v_color; - -void main() -{ - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - - // diffuse = gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - v_color = gl_Color; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/classique/texture/t.frag b/papart/data/old/shaders/classique/texture/t.frag deleted file mode 100644 index b4ccc81a..00000000 --- a/papart/data/old/shaders/classique/texture/t.frag +++ /dev/null @@ -1,29 +0,0 @@ -uniform sampler2D tex; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - - -void main() -{ - - vec3 ct,cf; - vec4 texel; - float intensity,at,af; - intensity = max(dot(lightDir,normalize(normal)),0.0); - - /* cf = intensity * (gl_FrontMaterial.diffuse).rgb + */ - /* gl_FrontMaterial.ambient.rgb * 0.6; */ - - cf = intensity * diffuse + ambient; - // gl_FrontMaterial.ambient.rgb * 0.6; - - af = gl_FrontMaterial.diffuse.a; - texel = texture2D(tex,gl_TexCoord[0].st); - - ct = texel.rgb; - at = texel.a; - gl_FragColor = vec4(ct * cf, at * af); - - // gl_FragColor = vec4(cf, 1); -} diff --git a/papart/data/old/shaders/classique/texture/t.vert b/papart/data/old/shaders/classique/texture/t.vert deleted file mode 100644 index 6f47c881..00000000 --- a/papart/data/old/shaders/classique/texture/t.vert +++ /dev/null @@ -1,21 +0,0 @@ -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - // halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/classique/texture/textureShader.frag b/papart/data/old/shaders/classique/texture/textureShader.frag deleted file mode 100644 index c34f63c4..00000000 --- a/papart/data/old/shaders/classique/texture/textureShader.frag +++ /dev/null @@ -1,42 +0,0 @@ -uniform sampler2D tex; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - - -void main() -{ - /* vec3 n,halfV,viewV,ldir; */ - /* float NdotL,NdotHV; */ - /* vec4 color = ambient; */ - - /* /\* a fragment shader can't write a verying variable, hence we need */ - /* a new variable to store the normalized interpolated normal *\/ */ - /* n = normalize(normal); */ - - /* /\* compute the dot product between normal and ldir *\/ */ - /* NdotL = max(dot(n,lightDir),0.0); */ - - /* if (NdotL > 0.0) { */ - /* halfV = normalize(halfVector); */ - /* NdotHV = max(dot(n,halfV),0.0); */ - /* color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); */ - /* color += diffuse * NdotL; */ - /* } */ - - - vec3 ct,cf; - vec4 texel; - float intensity,at,af; - intensity = max(dot(lightDir,normalize(normal)),0.0); - - cf = intensity * (gl_FrontMaterial.diffuse).rgb + - gl_FrontMaterial.ambient.rgb * 0.6; - af = gl_FrontMaterial.diffuse.a; - texel = texture2D(tex,gl_TexCoord[0].st); - - ct = texel.rgb; - at = texel.a; - gl_FragColor = vec4(ct * cf, at * af); - -} diff --git a/papart/data/old/shaders/classique/texture/textureShader.vert b/papart/data/old/shaders/classique/texture/textureShader.vert deleted file mode 100644 index cc4b4146..00000000 --- a/papart/data/old/shaders/classique/texture/textureShader.vert +++ /dev/null @@ -1,26 +0,0 @@ -// Used for shadow lookup -varying vec4 ShadowCoord; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - // halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - ShadowCoord= gl_TextureMatrix[7] * gl_Vertex ; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/distortFrag.glsl b/papart/data/old/shaders/distortFrag.glsl deleted file mode 100755 index 9c053dd6..00000000 --- a/papart/data/old/shaders/distortFrag.glsl +++ /dev/null @@ -1,33 +0,0 @@ -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - - -uniform sampler2D texture; - -varying vec4 vertColor; -varying vec4 vertTexCoord; - -void main() { - gl_FragColor = texture2D(texture, vertTexCoord.st) * vertColor; -} - - - - -/* uniform sampler2D texture; */ -/* uniform sampler2D mapTex; */ - -/* void main() */ -/* { */ - -/* vec4 mapCoord = texture2D(mapTex, gl_TexCoord[0].st); */ -/* gl_FragColor = texture2D(srcTex, mapCoord.rg); */ - -/* gl_FragColor = vec4(1, 0, 0, 1); */ - -/* /\* gl_FragColor = texture2D(srcTex, gl_TexCoord[0].st); *\/ */ -/* // gl_FragColor = texture2D(mapTex, gl_TexCoord[0].st); */ -/* } */ - diff --git a/papart/data/old/shaders/distortVert.glsl b/papart/data/old/shaders/distortVert.glsl deleted file mode 100755 index a23997a1..00000000 --- a/papart/data/old/shaders/distortVert.glsl +++ /dev/null @@ -1,27 +0,0 @@ -/* //vertex shader */ - -/* void main() */ -/* { */ -/* gl_TexCoord[0] = gl_MultiTexCoord0; */ -/* gl_Position = ftransform(); */ - -/* } */ - -#define PROCESSING_TEXTURE_SHADER - -uniform mat4 transform; -uniform mat4 texMatrix; - -attribute vec4 vertex; -attribute vec4 color; -attribute vec2 texCoord; - -varying vec4 vertColor; -varying vec4 vertTexCoord; - -void main() { - gl_Position = transform * vertex; - - vertColor = color; - vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); -} diff --git a/papart/data/old/shaders/kinect/kinect1.frag b/papart/data/old/shaders/kinect/kinect1.frag deleted file mode 100755 index fd8d1b80..00000000 --- a/papart/data/old/shaders/kinect/kinect1.frag +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -varying vec4 vertColor; - -void main() { - - // gl_FragColor = vec4(1, 1, 1, 1); - gl_FragColor = vec4(vertColor.rgb, 1); -} diff --git a/papart/data/old/shaders/kinect/kinect1.vert b/papart/data/old/shaders/kinect/kinect1.vert deleted file mode 100755 index 1bcb0476..00000000 --- a/papart/data/old/shaders/kinect/kinect1.vert +++ /dev/null @@ -1,13 +0,0 @@ -#define PROCESSING_POINT_SHADER - -uniform mat4 transform; - -attribute vec4 vertex; -attribute vec4 color; - -varying vec4 vertColor; - -void main() { - gl_Position = transform * vertex; - vertColor = color / 255; -} diff --git a/papart/data/old/shaders/kinect/kinectTri.frag b/papart/data/old/shaders/kinect/kinectTri.frag deleted file mode 100755 index 3e6fbd73..00000000 --- a/papart/data/old/shaders/kinect/kinectTri.frag +++ /dev/null @@ -1,23 +0,0 @@ -#define PROCESSING_LIGHT_SHADER - -uniform mat4 modelview; -uniform mat4 transform; -uniform mat3 normalMatrix; - -uniform vec4 lightPosition; - -attribute vec4 vertex; -attribute vec4 color; -attribute vec3 normal; - -varying vec4 vertColor; - -void main() { - gl_Position = transform * vertex; - vec3 ecVertex = vec3(modelview * vertex); - vec3 ecNormal = normalize(normalMatrix * normal); - - vec3 direction = normalize(lightPosition.xyz - ecVertex); - float intensity = max(0.0, dot(direction, ecNormal)); - vertColor = vec4(intensity, intensity, intensity, 1) * color; -} diff --git a/papart/data/old/shaders/kinect/kinectTri.vert b/papart/data/old/shaders/kinect/kinectTri.vert deleted file mode 100755 index ec69a61d..00000000 --- a/papart/data/old/shaders/kinect/kinectTri.vert +++ /dev/null @@ -1,12 +0,0 @@ -uniform mat4 transform; - -attribute vec4 vertex; -attribute vec4 color; -attribute vec4 normal; - -varying vec4 vertColor; - -void main() { - gl_Position = transform * vertex; - vertColor = color / 255; -} diff --git a/papart/data/old/shaders/litSphere (working).frag b/papart/data/old/shaders/litSphere (working).frag deleted file mode 100755 index edcf791e..00000000 --- a/papart/data/old/shaders/litSphere (working).frag +++ /dev/null @@ -1,26 +0,0 @@ - -uniform sampler2D litTexture; - -varying vec3 normal; - -vec4 litSphereColor(in vec3 n) { - //Normal to camera space - - vec2 pos = normalize(n).xy; - vec2 posInTex = vec2( 0.5 + pos.x * 0.5, 0.5 - pos.y * 0.5 ); - vec4 color = texture2D(litTexture, posInTex); - -// vec2 pos = normalize(normal).xy; - -/// vec2 posInTex = vec2( 0.5 + pos.x * 0.5, 0.5 - pos.y * 0.5 ); -/// vec4 color0 = texture2D( tex0, posInTex ); -/// vec4 color1 = texture2D( tex1, posInTex ); -/// float c = clamp(0.5 + 0.5*tanh(curvature*enhance), 0.0,1.0); -/// gl_FragData[0] = c*color0 + (1.0-c)*color1; - - return color; -} - -void main() { - gl_FragColor = litSphereColor(normal); -} diff --git a/papart/data/old/shaders/litSphere.frag b/papart/data/old/shaders/litSphere.frag deleted file mode 100755 index 911bbb3d..00000000 --- a/papart/data/old/shaders/litSphere.frag +++ /dev/null @@ -1,14 +0,0 @@ -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform float enhance; -varying vec3 normal, lightDir; -varying float curvature; - -void main () { - vec2 pos = normalize(normal + lightDir).xy; - vec2 posInTex = vec2( 0.5 + pos.x * 0.5, 0.5 - pos.y * 0.5 ); - - vec4 color0 = texture2D( tex0, posInTex ); - vec4 color1 = texture2D( tex1, posInTex ); - gl_FragData[0] = color0; -} diff --git a/papart/data/old/shaders/litSphere.vert b/papart/data/old/shaders/litSphere.vert deleted file mode 100755 index 4ff760ea..00000000 --- a/papart/data/old/shaders/litSphere.vert +++ /dev/null @@ -1,25 +0,0 @@ -varying vec3 normal,lightDir; -varying vec4 diffuse,ambient; -varying vec3 halfVector; - -void main(void) { - - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/litSphere.xml b/papart/data/old/shaders/litSphere.xml deleted file mode 100755 index 6a2b3459..00000000 --- a/papart/data/old/shaders/litSphere.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Lit Sphere - litSphere.vert - litSphere.frag - - 0 - - - diff --git a/papart/data/old/shaders/litsphere.frag b/papart/data/old/shaders/litsphere.frag deleted file mode 100755 index 911bbb3d..00000000 --- a/papart/data/old/shaders/litsphere.frag +++ /dev/null @@ -1,14 +0,0 @@ -uniform sampler2D tex0; -uniform sampler2D tex1; -uniform float enhance; -varying vec3 normal, lightDir; -varying float curvature; - -void main () { - vec2 pos = normalize(normal + lightDir).xy; - vec2 posInTex = vec2( 0.5 + pos.x * 0.5, 0.5 - pos.y * 0.5 ); - - vec4 color0 = texture2D( tex0, posInTex ); - vec4 color1 = texture2D( tex1, posInTex ); - gl_FragData[0] = color0; -} diff --git a/papart/data/old/shaders/litsphere.vert b/papart/data/old/shaders/litsphere.vert deleted file mode 100755 index 4ff760ea..00000000 --- a/papart/data/old/shaders/litsphere.vert +++ /dev/null @@ -1,25 +0,0 @@ -varying vec3 normal,lightDir; -varying vec4 diffuse,ambient; -varying vec3 halfVector; - -void main(void) { - - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/normal.frag b/papart/data/old/shaders/normal.frag deleted file mode 100755 index d3967fc9..00000000 --- a/papart/data/old/shaders/normal.frag +++ /dev/null @@ -1,16 +0,0 @@ -// -// Fragment shader for cartoon-style shading -// -// Author: Philip Rideout -// -// Copyright (c) 2004 3Dlabs Inc. Ltd. -// -// See 3Dlabs-License.txt for license information -// - -varying vec3 Normal; - -void main (void) -{ - gl_FragColor = vec4(Normal / 2.0 + vec3(0.5, 0.5, 0.5), 1.0); -} diff --git a/papart/data/old/shaders/normal.vert b/papart/data/old/shaders/normal.vert deleted file mode 100755 index 3ca74d39..00000000 --- a/papart/data/old/shaders/normal.vert +++ /dev/null @@ -1,18 +0,0 @@ -// -// Vertex shader for cartoon-style shading -// -// Author: Philip Rideout -// -// Copyright (c) 2004 3Dlabs Inc. Ltd. -// -// See 3Dlabs-License.txt for license information -// - -varying vec3 Normal; - -void main(void) -{ - Normal = normalize(gl_NormalMatrix * gl_Normal); - // Normal = vec3(0, 1, 0); - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; -} diff --git a/papart/data/old/shaders/normal.xml b/papart/data/old/shaders/normal.xml deleted file mode 100755 index 842f2a02..00000000 --- a/papart/data/old/shaders/normal.xml +++ /dev/null @@ -1,9 +0,0 @@ - - normal drawing - normal.vert - normal.frag - - 0 - - - diff --git a/papart/data/old/shaders/processing/ToonFrag.glsl b/papart/data/old/shaders/processing/ToonFrag.glsl deleted file mode 100644 index 054bb0df..00000000 --- a/papart/data/old/shaders/processing/ToonFrag.glsl +++ /dev/null @@ -1,25 +0,0 @@ -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -varying vec3 vertNormal; -varying vec3 vertLightDir; - -void main() { - float intensity; - vec4 color; - intensity = max(0.0, dot(vertLightDir, vertNormal)); - - if (intensity > 0.95) { - color = vec4(1.0, 0.5, 0.5, 1.0); - } else if (intensity > 0.5) { - color = vec4(0.6, 0.3, 0.3, 1.0); - } else if (intensity > 0.25) { - color = vec4(0.4, 0.2, 0.2, 1.0); - } else { - color = vec4(0.2, 0.1, 0.1, 1.0); - } - - gl_FragColor = color; -} \ No newline at end of file diff --git a/papart/data/old/shaders/processing/ToonVert.glsl b/papart/data/old/shaders/processing/ToonVert.glsl deleted file mode 100644 index 01b77b2c..00000000 --- a/papart/data/old/shaders/processing/ToonVert.glsl +++ /dev/null @@ -1,31 +0,0 @@ -// Toon shader using per-pixel lighting. Based on the glsl -// tutorial from lighthouse 3D: -// http://www.lighthouse3d.com/tutorials/glsl-tutorial/toon-shader-version-ii/ - -#define PROCESSING_LIGHT_SHADER - -uniform mat4 modelview; -uniform mat4 transform; -uniform mat3 normalMatrix; - -uniform vec3 lightNormal[8]; - -attribute vec4 vertex; -attribute vec3 normal; - -varying vec3 vertNormal; -varying vec3 vertLightDir; - -void main() { - // Vertex in clip coordinates - gl_Position = transform * vertex; - - // Normal vector in eye coordinates is passed - // to the fragment shader - vertNormal = normalize(normalMatrix * normal); - - // Assuming that there is only one directional light. - // Its normal vector is passed to the fragment shader - // in order to perform per-pixel lighting calculation. - vertLightDir = -lightNormal[0]; -} \ No newline at end of file diff --git a/papart/data/old/shaders/processing/normal.frag b/papart/data/old/shaders/processing/normal.frag deleted file mode 100755 index 0be2bc86..00000000 --- a/papart/data/old/shaders/processing/normal.frag +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -varying vec4 vertColor; -varying vec3 ecNormal; -varying vec3 lightDir; - -void main() { - vec3 direction = normalize(lightDir); - vec3 normal = normalize(ecNormal); - float intensity = max(0.0, dot(direction, normal)); - gl_FragColor = vec4(intensity, intensity, intensity, 1) * vertColor; - - gl_FragColor = vec4(ecNormal, 1); - -} - - diff --git a/papart/data/old/shaders/processing/normal.vert b/papart/data/old/shaders/processing/normal.vert deleted file mode 100755 index f0ab9810..00000000 --- a/papart/data/old/shaders/processing/normal.vert +++ /dev/null @@ -1,25 +0,0 @@ -#define PROCESSING_LIGHT_SHADER - -uniform mat4 modelview; -uniform mat4 transform; -uniform mat3 normalMatrix; - -uniform vec4 lightPosition; -uniform vec3 lightNormal; - -attribute vec4 vertex; -attribute vec4 color; -attribute vec3 normal; - -varying vec4 vertColor; -varying vec3 ecNormal; -varying vec3 lightDir; - -void main() { - gl_Position = transform * vertex; - vec3 ecVertex = vec3(modelview * vertex); - - ecNormal = normalize(normalMatrix * normal); - lightDir = normalize(lightPosition.xyz - ecVertex); - vertColor = color; -} diff --git a/papart/data/old/shaders/projDistort.xml b/papart/data/old/shaders/projDistort.xml deleted file mode 100755 index c49d1849..00000000 --- a/papart/data/old/shaders/projDistort.xml +++ /dev/null @@ -1,10 +0,0 @@ - - Apply the opposite of the projector lens distortion to get a good visualisation. - distortVert.glsl - distortFrag.glsl - - 0 - 1 - - - diff --git a/papart/data/old/shaders/shadowMap-noTex.frag b/papart/data/old/shaders/shadowMap-noTex.frag deleted file mode 100644 index f17d3a18..00000000 --- a/papart/data/old/shaders/shadowMap-noTex.frag +++ /dev/null @@ -1,69 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - // vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - - // Used to lower moiré pattern and self-shadowing - shadowCoordinateWdivide.z += 0.0005; - - float distanceFromLight = texture2D(ShadowMap, shadowCoordinateWdivide.st).z; - - float shadow = 1.0; - if (ShadowCoord.w > 0.0) - shadow = distanceFromLight < shadowCoordinateWdivide.z ? 0.5 : 1.0 ; - - - /* vec3 ct,cf; */ - /* vec4 texel; */ - /* float intensity,at,af; */ - /* intensity = max(dot(lightDir,normalize(normal)),0.0); */ - /* cf = intensity * (gl_FrontMaterial.diffuse).rgb + gl_FrontMaterial.ambient.rgb * 0.6; */ - /* af = gl_FrontMaterial.diffuse.a; */ - - gl_FragColor = vec4(color.rgb * shadow, color.a); - - - // gl_FragColor = color * 0.5 + 0.5 * vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 2); - - - gl_FragColor = vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 1); - - - - - - - // gl_FragColor = texture2D(ShadowMap, gl_TexCoord[0].st); - - // gl_FragColor = vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 1); - // gl_FragColor = vec4(1. - shadowCoordinateWdivide.z); - -} - diff --git a/papart/data/old/shaders/shadowMap-noTex.frag.backup b/papart/data/old/shaders/shadowMap-noTex.frag.backup deleted file mode 100644 index c25e5d2d..00000000 --- a/papart/data/old/shaders/shadowMap-noTex.frag.backup +++ /dev/null @@ -1,75 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - // vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - - // Used to lower moiré pattern and self-shadowing - shadowCoordinateWdivide.z += 0.0005; - - float distanceFromLight = texture2D(ShadowMap, shadowCoordinateWdivide.st).z; - - vec4 _color; - float shadow = 1.0; - if (ShadowCoord.w > 0.0){ - shadow = distanceFromLight < shadowCoordinateWdivide.z ? 0.5 : 1.0 ; - - - if( distanceFromLight < shadowCoordinateWdivide.z ){ - - gl_FragColor = vec4(0.0,0.0,0.0,1.0); - return; - } - - /* return; */ - } - - /* vec3 ct,cf; */ - /* vec4 texel; */ - /* float intensity,at,af; */ - /* intensity = max(dot(lightDir,normalize(normal)),0.0); */ - /* cf = intensity * (gl_FrontMaterial.diffuse).rgb + gl_FrontMaterial.ambient.rgb * 0.6; */ - /* af = gl_FrontMaterial.diffuse.a; */ - - - _color = vec4(color.rgb * shadow, color.a); - - // Toon shader... - - if (color.r > 0.5) - _color = vec4(0.8,0.8,0.8,1.0); - else if (color.r > 0.35) - _color = vec4(0.4,0.4,0.4,1.0); - else - _color = vec4(0.2,0.2,0.2,1.0); - - gl_FragColor = _color; - -} - diff --git a/papart/data/old/shaders/shadowMap.frag b/papart/data/old/shaders/shadowMap.frag deleted file mode 100755 index fa799760..00000000 --- a/papart/data/old/shaders/shadowMap.frag +++ /dev/null @@ -1,161 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; -uniform float usingTex; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - - -/* float lookup(float x, float y) */ -/* { */ -/* /\* float depth = shadow2DProj(ShadowMap, *\/ */ -/* /\* ShadowCoord + vec3(x, y, 0) * 0.0005).x; *\/ */ - -/* vec4 p = ShadowCoord + vec4(vec3(x * ShadowCoord.w , y * ShadowCoord.w, 0) * 0.0005, 1.); */ - -/* float depth = shadow2DProj(ShadowMap, p).w; */ - -/* // ShadowCoord + vec4(vec3(x, y, 0) * 0.0005,0) ).x; */ - -/* return depth != 1.0 ? 0.75 : 1.0; */ -/* } */ - - -/* float lookup( vec2 offSet) */ -/* { */ -/* // Values are multiplied by ShadowCoord.w because shadow2DProj does a W division for us. */ -/* return shadow2DProj(ShadowMap, ShadowCoord + */ -/* vec4(offSet.x * xPixelOffset * ShadowCoord.w, offSet.y * yPixelOffset * ShadowCoord.w, 0.05, 0.0) ).w; */ -/* } */ - - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - // vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - - /////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - - - /* float shadeFactor = lookup(0.0, 0.0); */ - /* gl_FragColor = vec4(shadeFactor * color.rgb * TexColor.rgb, color.a * TexColor.a); */ - - - /////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - - - vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - - // Used to lower moiré pattern and self-shadowing - shadowCoordinateWdivide.z += 0.0005; - - // vec2 ind = vec2(1.-shadowCoordinateWdivide.s, 1.-shadowCoordinateWdivide.t ); - - // float distanceFromLight = texture2D(ShadowMap,shadowCoordinateWdivide.st).z; - float distanceFromLight = texture2D(ShadowMap, shadowCoordinateWdivide.st).z; - - float shadow = 1.0; - if (ShadowCoord.w > 0.0) - shadow = distanceFromLight < shadowCoordinateWdivide.z ? 0.5 : 1.0 ; - - /* if(shadowCoordinateWdivide.z > 0.5){ */ - /* // shadow = 1.0; */ - /* gl_FragColor = vec4(color.xyz * shadow, color[3]); */ - /* }else */ - /* gl_FragColor = vec4(0., 0., 1., 1.); */ - - // gl_FragColor = vec4(distanceFromLight, shadowCoordinateWdivide.z, 0., 1.); - - // gl_FragColor = vec4(color.xyz * shadow, color[3]); - - - // gl_FragColor = TexColor * color; - // gl_FragColor = shadow * color * TexColor; - - - - vec3 ct,cf; - vec4 texel; - float intensity,at,af; - intensity = max(dot(lightDir,normalize(normal)),0.0); - - cf = intensity * (gl_FrontMaterial.diffuse).rgb + - gl_FrontMaterial.ambient.rgb * 0.6; - af = gl_FrontMaterial.diffuse.a; - texel = texture2D(tex,gl_TexCoord[0].st); - - ct = texel.rgb; - at = texel.a; - gl_FragColor = vec4(ct * cf * shadow, at * af); - - // NO TEXTURE - // gl_FragColor = color * shadow; - // gl_FragColor = color; - - /* if(usingTex == 1) */ - /* gl_FragColor = vec4(ct * cf * shadow, at * af); */ - /* else{ */ - // - // gl_FragColor = vec4(cf * shadow, af); - // } - - - // gl_FragColor = vec4(TexColor.rgb * color.rgb , color.a); - // gl_FragColor = vec4(color.rgb * shadow, color.a); - - - /* vec2 coord = gl_FragCoord.xy / 512.; */ - /* gl_FragColor = vec4(texture2D(ShadowMap, coord).rgb, 1.); */ - /* gl_FragColor = vec4(texture2D(tex, coord).rgba); */ - - - - /* if(shadowCoordinateWdivide.xyz == clamp(shadowCoordinateWdivide.xyz, 0., 1.)){ */ - /* gl_FragColor = vec4(color.xyz * shadow, color[3]); */ - /* } else{ */ - /* gl_FragColor = vec4(0., 0., 1., 1.); */ - /* } */ - - - - /* gl_FragColor = vec4(TexColor.xyz * color.xyz * shadow, color[3]); */ - - - - - - // gl_FragColor = vec4((shadowCoordinateWdivide.xyz) ,1); - - /* gl_FragColor = texture2D(ShadowMap, coord) + TexColor * 0.00; */ - - - // gl_FragColor = vec4(vec3(texture2D(ShadowMap, coord)) ,1); - - - - -} - diff --git a/papart/data/old/shaders/shadowMap.frag.backup b/papart/data/old/shaders/shadowMap.frag.backup deleted file mode 100644 index fa799760..00000000 --- a/papart/data/old/shaders/shadowMap.frag.backup +++ /dev/null @@ -1,161 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; -uniform float usingTex; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - - -/* float lookup(float x, float y) */ -/* { */ -/* /\* float depth = shadow2DProj(ShadowMap, *\/ */ -/* /\* ShadowCoord + vec3(x, y, 0) * 0.0005).x; *\/ */ - -/* vec4 p = ShadowCoord + vec4(vec3(x * ShadowCoord.w , y * ShadowCoord.w, 0) * 0.0005, 1.); */ - -/* float depth = shadow2DProj(ShadowMap, p).w; */ - -/* // ShadowCoord + vec4(vec3(x, y, 0) * 0.0005,0) ).x; */ - -/* return depth != 1.0 ? 0.75 : 1.0; */ -/* } */ - - -/* float lookup( vec2 offSet) */ -/* { */ -/* // Values are multiplied by ShadowCoord.w because shadow2DProj does a W division for us. */ -/* return shadow2DProj(ShadowMap, ShadowCoord + */ -/* vec4(offSet.x * xPixelOffset * ShadowCoord.w, offSet.y * yPixelOffset * ShadowCoord.w, 0.05, 0.0) ).w; */ -/* } */ - - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - // vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - - /////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - - - /* float shadeFactor = lookup(0.0, 0.0); */ - /* gl_FragColor = vec4(shadeFactor * color.rgb * TexColor.rgb, color.a * TexColor.a); */ - - - /////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////// - - - vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - - // Used to lower moiré pattern and self-shadowing - shadowCoordinateWdivide.z += 0.0005; - - // vec2 ind = vec2(1.-shadowCoordinateWdivide.s, 1.-shadowCoordinateWdivide.t ); - - // float distanceFromLight = texture2D(ShadowMap,shadowCoordinateWdivide.st).z; - float distanceFromLight = texture2D(ShadowMap, shadowCoordinateWdivide.st).z; - - float shadow = 1.0; - if (ShadowCoord.w > 0.0) - shadow = distanceFromLight < shadowCoordinateWdivide.z ? 0.5 : 1.0 ; - - /* if(shadowCoordinateWdivide.z > 0.5){ */ - /* // shadow = 1.0; */ - /* gl_FragColor = vec4(color.xyz * shadow, color[3]); */ - /* }else */ - /* gl_FragColor = vec4(0., 0., 1., 1.); */ - - // gl_FragColor = vec4(distanceFromLight, shadowCoordinateWdivide.z, 0., 1.); - - // gl_FragColor = vec4(color.xyz * shadow, color[3]); - - - // gl_FragColor = TexColor * color; - // gl_FragColor = shadow * color * TexColor; - - - - vec3 ct,cf; - vec4 texel; - float intensity,at,af; - intensity = max(dot(lightDir,normalize(normal)),0.0); - - cf = intensity * (gl_FrontMaterial.diffuse).rgb + - gl_FrontMaterial.ambient.rgb * 0.6; - af = gl_FrontMaterial.diffuse.a; - texel = texture2D(tex,gl_TexCoord[0].st); - - ct = texel.rgb; - at = texel.a; - gl_FragColor = vec4(ct * cf * shadow, at * af); - - // NO TEXTURE - // gl_FragColor = color * shadow; - // gl_FragColor = color; - - /* if(usingTex == 1) */ - /* gl_FragColor = vec4(ct * cf * shadow, at * af); */ - /* else{ */ - // - // gl_FragColor = vec4(cf * shadow, af); - // } - - - // gl_FragColor = vec4(TexColor.rgb * color.rgb , color.a); - // gl_FragColor = vec4(color.rgb * shadow, color.a); - - - /* vec2 coord = gl_FragCoord.xy / 512.; */ - /* gl_FragColor = vec4(texture2D(ShadowMap, coord).rgb, 1.); */ - /* gl_FragColor = vec4(texture2D(tex, coord).rgba); */ - - - - /* if(shadowCoordinateWdivide.xyz == clamp(shadowCoordinateWdivide.xyz, 0., 1.)){ */ - /* gl_FragColor = vec4(color.xyz * shadow, color[3]); */ - /* } else{ */ - /* gl_FragColor = vec4(0., 0., 1., 1.); */ - /* } */ - - - - /* gl_FragColor = vec4(TexColor.xyz * color.xyz * shadow, color[3]); */ - - - - - - // gl_FragColor = vec4((shadowCoordinateWdivide.xyz) ,1); - - /* gl_FragColor = texture2D(ShadowMap, coord) + TexColor * 0.00; */ - - - // gl_FragColor = vec4(vec3(texture2D(ShadowMap, coord)) ,1); - - - - -} - diff --git a/papart/data/old/shaders/shadowMap.vert b/papart/data/old/shaders/shadowMap.vert deleted file mode 100755 index aa6f1aec..00000000 --- a/papart/data/old/shaders/shadowMap.vert +++ /dev/null @@ -1,26 +0,0 @@ -// Used for shadow lookup -varying vec4 ShadowCoord; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - ShadowCoord= gl_TextureMatrix[7] * gl_Vertex ; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/shadowMap.vert.backup b/papart/data/old/shaders/shadowMap.vert.backup deleted file mode 100644 index aa6f1aec..00000000 --- a/papart/data/old/shaders/shadowMap.vert.backup +++ /dev/null @@ -1,26 +0,0 @@ -// Used for shadow lookup -varying vec4 ShadowCoord; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - ShadowCoord= gl_TextureMatrix[7] * gl_Vertex ; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/shadowMap.xml b/papart/data/old/shaders/shadowMap.xml deleted file mode 100755 index 0a6f5154..00000000 --- a/papart/data/old/shaders/shadowMap.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Maybe a shadow map - shadowMap.vert - shadowMap.frag - - 0 - - - diff --git a/papart/data/old/shaders/sponza.mtl b/papart/data/old/shaders/sponza.mtl deleted file mode 100755 index 29ffca7e..00000000 --- a/papart/data/old/shaders/sponza.mtl +++ /dev/null @@ -1,312 +0,0 @@ -# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware -# File Created: 25.08.2009 16:17:12 - -newmtl sp_00_luk_mali - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7451 0.7098 0.6745 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka SP_LUK.JPG - map_Kd SP_LUK.JPG - map_bump SP_LUK.JPG - bump SP_LUK.JPG - -newmtl sp_svod_kapitel - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7137 0.7059 0.6588 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 00_SKAP.JPG - map_Kd 00_SKAP.JPG - map_bump 00_SKAP.JPG - bump 00_SKAP.JPG - -newmtl sp_01_stub_baza_ - Ns 20.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7843 0.7843 0.7843 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - -newmtl sp_01_stub_kut - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7373 0.7098 0.6706 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_STUB.JPG - map_Kd 01_STUB.JPG - map_bump 01_STUB.JPG - bump 01_STUB.JPG - -newmtl sp_00_stup - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7373 0.7098 0.6706 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_STUB.JPG - map_Kd 01_STUB.JPG - map_bump 01_STUB.JPG - bump 01_STUB.JPG - -newmtl sp_01_stub_baza - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.8000 0.7843 0.7490 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_S_BA.JPG - map_Kd 01_S_BA.JPG - map_bump 01_S_BA.JPG - bump 01_S_BA.JPG - -newmtl sp_00_luk_mal1 - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7451 0.7098 0.6745 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_ST_KP.JPG - map_Kd 01_ST_KP.JPG - map_bump SP_LUK.JPG - bump SP_LUK.JPG - -newmtl sp_01_stub - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7373 0.7098 0.6706 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_STUB.JPG - map_Kd 01_STUB.JPG - map_bump 01_STUB.JPG - bump 01_STUB.JPG - -newmtl sp_01_stup - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.8275 0.8000 0.7686 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka X01_ST.JPG - map_Kd X01_ST.JPG - -newmtl sp_vijenac - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7137 0.7059 0.6588 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 00_SKAP.JPG - map_Kd 00_SKAP.JPG - map_bump 00_SKAP.JPG - bump 00_SKAP.JPG - -newmtl sp_00_pod - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.6275 0.5725 0.5608 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka KAMEN.JPG - map_Kd KAMEN.JPG - map_bump KAMEN.JPG - bump KAMEN.JPG - -newmtl sp_00_svod - Ns 1.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.1451 0.1451 0.1451 - Kd 0.9412 0.8667 0.7373 - Ks 0.0340 0.0323 0.0293 - Ke 0.0000 0.0000 0.0000 - -newmtl sp_02_reljef - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.5294 0.4980 0.4902 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka RELJEF.JPG - map_Kd RELJEF.JPG - map_bump RELJEF.JPG - bump RELJEF.JPG - -newmtl sp_01_luk_a - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7451 0.7098 0.6745 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka SP_LUK.JPG - map_Kd SP_LUK.JPG - map_bump SP_LUK.JPG - bump SP_LUK.JPG - -newmtl sp_zid_vani - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.6275 0.5725 0.5608 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka KAMEN.JPG - map_Kd KAMEN.JPG - map_bump KAMEN.JPG - bump KAMEN.JPG - -newmtl sp_00_zid - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.6275 0.5725 0.5608 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka KAMEN.JPG - map_Kd KAMEN.JPG - map_bump KAMEN.JPG - bump KAMEN.JPG - -newmtl sp_01_stup_baza - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.8000 0.7843 0.7490 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka 01_S_BA.JPG - map_Kd 01_S_BA.JPG - map_bump 01_S_BA.JPG - bump 01_S_BA.JPG - -newmtl sp_00_prozor - Ns 50.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 1.0000 1.0000 1.0000 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka PROZOR1.JPG - map_Kd PROZOR1.JPG - map_bump PROZOR1.JPG - bump PROZOR1.JPG - -newmtl sp_00_vrata_krug - Ns 20.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7843 0.7843 0.7843 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka VRATA_KR.JPG - map_Kd VRATA_KR.JPG - map_bump VRATA_KR.JPG - bump VRATA_KR.JPG - -newmtl sp_00_vrata_kock - Ns 20.0000 - Ni 1.5000 - d 1.0000 - Tr 0.0000 - Tf 1.0000 1.0000 1.0000 - illum 2 - Ka 0.0000 0.0000 0.0000 - Kd 0.7843 0.7843 0.7843 - Ks 0.0000 0.0000 0.0000 - Ke 0.0000 0.0000 0.0000 - map_Ka VRATA_KO.JPG - map_Kd VRATA_KO.JPG - map_bump VRATA_KO.JPG - bump VRATA_KO.JPG diff --git a/papart/data/old/shaders/spotLight.xml b/papart/data/old/shaders/spotLight.xml deleted file mode 100755 index 082b9599..00000000 --- a/papart/data/old/shaders/spotLight.xml +++ /dev/null @@ -1,9 +0,0 @@ - - normal drawing - spotlight.vert - spotlight.frag - - 0 - - - diff --git a/papart/data/old/shaders/spotlight.frag b/papart/data/old/shaders/spotlight.frag deleted file mode 100644 index 6e87704c..00000000 --- a/papart/data/old/shaders/spotlight.frag +++ /dev/null @@ -1,49 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a spotlight per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -Antonio Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambientGlobal, ambient; -varying vec3 normal,lightDir,halfVector; -varying float dist; - - -void main() -{ - vec3 n,halfV; - float NdotL,NdotHV; - vec4 color = ambientGlobal; - float att,spotEffect; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,normalize(lightDir)),0.0); - - if (NdotL > 0.0) { - - spotEffect = dot(normalize(gl_LightSource[0].spotDirection), normalize(-lightDir)); - if (spotEffect > gl_LightSource[0].spotCosCutoff) { - spotEffect = pow(spotEffect, gl_LightSource[0].spotExponent); - att = spotEffect / (gl_LightSource[0].constantAttenuation + - gl_LightSource[0].linearAttenuation * dist + - gl_LightSource[0].quadraticAttenuation * dist * dist); - - color += att * (diffuse * NdotL + ambient); - - - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += att * gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - } - } - - gl_FragColor = color; -} diff --git a/papart/data/old/shaders/spotlight.vert b/papart/data/old/shaders/spotlight.vert deleted file mode 100755 index e3d09fb5..00000000 --- a/papart/data/old/shaders/spotlight.vert +++ /dev/null @@ -1,47 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a spotlight per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -Antonio Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambientGlobal, ambient; -varying vec3 normal,lightDir,halfVector; -varying float dist; - -void main() -{ - vec4 ecPos; - vec3 aux; - - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space.*/ - ecPos = gl_ModelViewMatrix * gl_Vertex; - aux = vec3(gl_LightSource[0].position-ecPos); - lightDir = normalize(aux); - - /* compute the distance to the light source to a varying variable*/ - dist = length(aux); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambientGlobal = gl_LightModel.ambient * gl_FrontMaterial.ambient; - - - gl_Position = ftransform(); - - - - - -} diff --git a/papart/data/old/shaders/stereoMatch.frag b/papart/data/old/shaders/stereoMatch.frag deleted file mode 100644 index c75ff012..00000000 --- a/papart/data/old/shaders/stereoMatch.frag +++ /dev/null @@ -1,70 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; -uniform float usingTex; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; -varying vec4 pos; - -void main() -{ - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - // shadowCoordinateWdivide.z += 0.0005; - vec4 viewFromOther = texture2D(ShadowMap, shadowCoordinateWdivide.st); - - // If depth is the same (approx) - // we take the other color, - // else we compute the right color - - float d = distance(pos, viewFromOther) / 1000.; - - if(d < 0.3){ - gl_FragColor = vec4(viewFromOther.rg, 0, 1); - - // TODO: compute the distance, shift to match the depth - - }else { - - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - gl_FragColor = color; - // gl_FragColor = vec4(1.0, 0, 0, 1); - } - - - // The main difference is in Z ! - - d = 0.005 * abs(pos.z - viewFromOther.z); - /* gl_FragColor = vec4(0.005 *abs(pos.x - viewFromOther.x), */ - /* 0.005 *abs(pos.y - viewFromOther.y), */ - /* 0.005 *abs(pos.z - viewFromOther.z), 1); */ - - - /* float d = 0.01 * sqrt(distance(pos, viewFromOther)); */ - gl_FragColor = vec4(d, d, d, 1); - - // gl_FragColor = vec4(0, viewFromOther.x, 0, 1.0); - - /* // display the texture */ - /* vec2 screenCoord = vec2(gl_FragCoord.s / 800., 1.- (gl_FragCoord.t / 600.)); */ - /* gl_FragColor = vec4(texture2D(tex, screenCoord).rgb, 1.); */ - - -} - diff --git a/papart/data/old/shaders/stereoMatch.vert b/papart/data/old/shaders/stereoMatch.vert deleted file mode 100644 index 38918fd9..00000000 --- a/papart/data/old/shaders/stereoMatch.vert +++ /dev/null @@ -1,29 +0,0 @@ -// Used for shadow lookup -varying vec4 ShadowCoord; -varying vec4 pos; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - ShadowCoord = gl_TextureMatrix[6] * gl_Vertex ; - - pos = gl_Vertex * gl_ModelViewProjectionMatrix; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/stereoMatch2.frag b/papart/data/old/shaders/stereoMatch2.frag deleted file mode 100644 index 8341c9f6..00000000 --- a/papart/data/old/shaders/stereoMatch2.frag +++ /dev/null @@ -1,197 +0,0 @@ -uniform sampler2D leftTex, rightTex; -uniform sampler2D ShadowMap; -uniform float usingTex; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; -varying vec4 coord, leftCoord, rightCoord; -varying vec4 leftShift, rightShift, pos1, diff; - -uniform float shift, scale; - -void main() -{ - - vec2 screenCoord = vec2(gl_FragCoord.s / (297. * 6.), - gl_FragCoord.t / (210. * 6.)); - - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - vec4 centerView = color; - - - - - - // Todo : linear depth ? - // Todo : tran - // TODO: hand calibration ?? - // TODO: calcul de min et max, en pixels - - /* gl_FragColor = vec4(texture2D(rightTex, screenCoord).r, */ - /* texture2D(leftTex, screenCoord).gb, */ - /* 1.); */ - - // ce pixel, vu par la camera gauche - /* vec4 leftCoordWdivide = leftCoord / leftCoord.w ; */ - /* vec4 leftView = texture2D(leftTex, leftCoordWdivide.st); */ - - float depth2 = (2.0 * gl_FragCoord.z - gl_DepthRange.near - gl_DepthRange.far) / (gl_DepthRange.far - gl_DepthRange.near); - - // float depth2 = gl_FragCoord.z; - - depth2 = 1. - depth2; - - // depth2 *= scale; - depth2 -= shift; - // depth2 = depth2 * scale ; - - - float c = depth2 * 297. * 6. / 100.; - gl_FragColor = vec4(c, c, c, 1); - - // return ; - - // return; - /* float diff2 = 1. - gl_FragCoord.z; */ - /* diff2 -= shift; */ - /* diff2 *= scale; */ - /* float c = diff2 * 297. * 6. / 10.; */ - /* gl_FragColor = vec4(c, c, c, 1); */ - - // gl_FragColor = vec4(depth2, depth2, depth2, 1); - - gl_FragColor = vec4(leftShift.x, leftShift.y, 0, 1); - return; - - /* vec4 leftView = texture2D(leftTex, screenCoord.rg); */ - /* vec4 rightView = texture2D(rightTex, screenCoord.rg); */ - vec4 leftView = texture2D(leftTex, vec2(screenCoord.r + leftShift.r, screenCoord.g)); - vec4 rightView = texture2D(rightTex, vec2(screenCoord.r - leftShift.g, screenCoord.g)); - - /* if(diff2 *297. * 6. < 4 ){ */ - /* gl_FragColor = vec4(leftView.rgb, 1); */ - /* return; */ - /* } */ - - gl_FragColor = vec4(rightView.r, leftView.gb, 1); - return; - - float dist = distance(leftView.rgb, centerView.rgb); - if(dist < 0.4){ - - leftView.r = leftView.r + 4.0 * (leftView.r - centerView.r); - leftView.g = leftView.g + 4.0 * (leftView.g - centerView.g); - leftView.b = leftView.b + 4.0 * (leftView.b - centerView.b); - - // leftView = vec4(0, 0, 0, 1); - } else - if(dist > 0.8){ - - leftView.r = leftView.r - 4.0 * (leftView.r - centerView.r); - leftView.g = leftView.g - 4.0 * (leftView.g - centerView.g); - leftView.b = leftView.b - 4.0 * (leftView.b - centerView.b); - - //leftView = centerView; - } - - dist = distance(rightView.rgb, centerView.rgb); - if(dist < 0.4){ - - rightView.r = rightView.r + 4.0 * (rightView.r - centerView.r); - rightView.g = rightView.g + 4.0 * (rightView.g - centerView.g); - rightView.b = rightView.b + 4.0 * (rightView.b - centerView.b); - - // rightView = vec4(0, 0, 0, 1); - } else - if(dist > 0.8){ - - rightView.r = rightView.r - 4.0 * (rightView.r - centerView.r); - rightView.g = rightView.g - 4.0 * (rightView.g - centerView.g); - rightView.b = rightView.b - 4.0 * (rightView.b - centerView.b); - - // rightView = centerView; - } - - - - - /* float di = distance(vec4(rightView.r, leftView.gb, 1), */ - /* vec4(texture2D(rightTex, screenCoord).r, */ - /* texture2D(leftTex, screenCoord).gb, */ - /* 1.)); */ - /* gl_FragColor = vec4(di, di, di, 1); */ - - gl_FragColor = vec4(rightView.r, leftView.gb, 1); - /* gl_FragColor = vec4(texture2D(rightTex, screenCoord).r, */ - /* texture2D(leftTex, screenCoord).gb, */ - /* 1.); */ - - -} - - - - - /////////////////////////////////////////////// - - - // The main difference is in Z ! - - // d = 0.005 * abs(coord.z - leftView.z); - /* gl_FragColor = vec4(0.005 *abs(pos.x - viewFromOther.x), */ - /* 0.005 *abs(pos.y - viewFromOther.y), */ - /* 0.005 *abs(pos.z - viewFromOther.z), 1); */ - - - /* float d = 0.01 * sqrt(distance(pos, viewFromOther)); */ - // gl_FragColor = vec4(d , d, d, 1); - - - - - /********* Stereo *********/ - /* // display the texture */ - - /* gl_FragColor = vec4(texture2D(rightTex, screenCoord).r, */ - /* texture2D(leftTex, screenCoord).gb, */ - /* 1.); */ - - - - - ///////////////////// Non fonctionnel //////// - - /* // Idee : fragCoord, reprojeté dans la vue gauche, pour récup sa couleur. */ - /* vec4 screenCoord = vec4(gl_FragCoord.s / (297 * 6), */ - /* gl_FragCoord.t / (210 * 6), gl_FragDepth, 1); */ - /* // calcul de la position de vertex courant, vu par la camara frontale. */ - /* vec4 leftPix = gl_TextureMatrix[5] * screenCoord; */ - - /* // récupération de la couleur de ce vertex. */ - /* vec4 leftPixWd = leftPix / leftPix.w; */ - /* vec4 leftCol = texture2D(leftTex, leftPix.st); */ - - - /* // Test de reprojection... non concluant. */ - /* vec4 vue = screenCoord * gl_ModelViewProjectionMatrix; */ - /* vue = vue / vue.w; */ - /* vec4 screenCoord2 = vec4(vue.x / (297 * 6), */ - /* vue.y / (210 * 6), vue.z, 1); */ - - - diff --git a/papart/data/old/shaders/stereoMatch2.vert b/papart/data/old/shaders/stereoMatch2.vert deleted file mode 100644 index 7ee6bb8a..00000000 --- a/papart/data/old/shaders/stereoMatch2.vert +++ /dev/null @@ -1,51 +0,0 @@ -// Used for shadow lookup -varying vec4 coord, leftCoord, rightCoord; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -varying vec4 leftShift, rightShift, pos1, diff; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - lightDir = normalize(vec3(gl_LightSource[0].position)); - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - leftCoord = gl_TextureMatrix[5] * gl_Vertex ; - // rightCoord = gl_TextureMatrix[6] * gl_Vertex ; - coord = gl_Vertex * gl_ModelViewProjectionMatrix; - - - leftShift = gl_TextureMatrix[4] * gl_Vertex; - leftShift.x /= (297. * 6.); - leftShift.y /= (210. * 6.); - leftShift.z = leftShift.z / leftShift.w; - - rightShift = gl_TextureMatrix[6] * gl_Vertex ; - rightShift.x /= (297. * 6.); - rightShift.y /= (210. * 6.); - rightShift.z = rightShift.z / rightShift.w; - - pos1 = coord; - pos1.x /= (297. * 6.); - pos1.y /= (210. * 6.); - pos1.z = pos1.z / pos1.w; - // pos1 = pos1 / pos1.z; - - leftShift.x = leftShift.x - pos1.x; - leftShift.y = leftShift.y - pos1.y; - - - diff = leftShift - rightShift; - /* diff = diff / diff.b; */ - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/toon.frag b/papart/data/old/shaders/toon.frag deleted file mode 100644 index 09e7c72b..00000000 --- a/papart/data/old/shaders/toon.frag +++ /dev/null @@ -1,35 +0,0 @@ -// -// Fragment shader for cartoon-style shading -// -// Author: Philip Rideout -// -// Copyright (c) 2004 3Dlabs Inc. Ltd. -// -// See 3Dlabs-License.txt for license information -// - -uniform vec3 DiffuseColor; -uniform vec3 PhongColor; -uniform float Edge; -uniform float Phong; -varying vec3 Normal; - -void main (void) -{ - vec3 color = DiffuseColor; - float f = dot(vec3(0,0,1),Normal); - if (abs(f) < Edge) - color = vec3(0.2); - if (f > Phong) - color = PhongColor; - - gl_FragColor = vec4(color, 1); - // gl_FragColor = vec4(Normal / 2 + vec3(0.5, 0.5, 0.5), 1.0); - // gl_FragColor = vec4(DiffuseColor, 1.0); - - - /* if(Phong > 0.2) */ - /* gl_FragColor = vec4(Edge, 0.0, 0.0, 1.0); */ - /* else */ - /* gl_FragColor = vec4(0.0, Edge, 0.0, 1.0); */ -} diff --git a/papart/data/old/shaders/toon.vert b/papart/data/old/shaders/toon.vert deleted file mode 100755 index 3ca74d39..00000000 --- a/papart/data/old/shaders/toon.vert +++ /dev/null @@ -1,18 +0,0 @@ -// -// Vertex shader for cartoon-style shading -// -// Author: Philip Rideout -// -// Copyright (c) 2004 3Dlabs Inc. Ltd. -// -// See 3Dlabs-License.txt for license information -// - -varying vec3 Normal; - -void main(void) -{ - Normal = normalize(gl_NormalMatrix * gl_Normal); - // Normal = vec3(0, 1, 0); - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; -} diff --git a/papart/data/old/shaders/toon.xml b/papart/data/old/shaders/toon.xml deleted file mode 100755 index bc3036b9..00000000 --- a/papart/data/old/shaders/toon.xml +++ /dev/null @@ -1,18 +0,0 @@ - - Toon shading on images, by Agnius Vasiliauskas (http://coding-experiments.blogspot.com/2011/01/toon-pixel-shader.html) - ToonVert.glsl - ToonFrag.glsl - - 0 - - - - 0.0 80.0 160.0 240.0 320.0 360.0 - - 0.0 0.15 0.3 0.45 0.6 0.8 1.0 - 0.0 0.3 0.6 1.0 - - - - - diff --git a/papart/data/old/shaders/toonShadow.frag b/papart/data/old/shaders/toonShadow.frag deleted file mode 100644 index 992584ca..00000000 --- a/papart/data/old/shaders/toonShadow.frag +++ /dev/null @@ -1,65 +0,0 @@ -uniform sampler2D tex; -uniform sampler2D ShadowMap; - -varying vec4 ShadowCoord; -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - // vec4 TexColor = texture2D(tex,gl_TexCoord[0].st); - - - vec4 shadowCoordinateWdivide = ShadowCoord / ShadowCoord.w ; - - // Used to lower moiré pattern and self-shadowing - shadowCoordinateWdivide.z += 0.0005; - - float distanceFromLight = texture2D(ShadowMap, shadowCoordinateWdivide.st).z; - - float shadow = 1.0; - if (ShadowCoord.w > 0.0) - shadow = distanceFromLight < shadowCoordinateWdivide.z ? 0.5 : 1.0 ; - - - /* vec3 ct,cf; */ - /* vec4 texel; */ - /* float intensity,at,af; */ - /* intensity = max(dot(lightDir,normalize(normal)),0.0); */ - /* cf = intensity * (gl_FrontMaterial.diffuse).rgb + gl_FrontMaterial.ambient.rgb * 0.6; */ - /* af = gl_FrontMaterial.diffuse.a; */ - - gl_FragColor = vec4(color.rgb * shadow, color.a); - - - // gl_FragColor = color * 0.5 + 0.5 * vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 2); - - - gl_FragColor = vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 1); - - - // gl_FragColor = texture2D(ShadowMap, gl_TexCoord[0].st); - - // gl_FragColor = vec4(texture2D(ShadowMap, shadowCoordinateWdivide.st).rgb, 1); - // gl_FragColor = vec4(1. - shadowCoordinateWdivide.z); - -} - diff --git a/papart/data/old/shaders/toonShadow.vert b/papart/data/old/shaders/toonShadow.vert deleted file mode 100644 index aa6f1aec..00000000 --- a/papart/data/old/shaders/toonShadow.vert +++ /dev/null @@ -1,26 +0,0 @@ -// Used for shadow lookup -varying vec4 ShadowCoord; - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - normal = normalize(gl_NormalMatrix * gl_Normal); - - lightDir = normalize(vec3(gl_LightSource[0].position)); - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - // Texture handling - gl_TexCoord[0] = gl_MultiTexCoord0; - - ShadowCoord= gl_TextureMatrix[7] * gl_Vertex ; - - gl_Position = ftransform(); - - // gl_FrontColor = gl_Color; -} diff --git a/papart/data/old/shaders/toonShadow.xml b/papart/data/old/shaders/toonShadow.xml deleted file mode 100644 index f676befd..00000000 --- a/papart/data/old/shaders/toonShadow.xml +++ /dev/null @@ -1,9 +0,0 @@ - - toon effect - toonShadow.vert - toonShadow.frag - - 0 - - - diff --git a/papart/data/old/shaders/toonf2 (copie).frag b/papart/data/old/shaders/toonf2 (copie).frag deleted file mode 100644 index 1f6f5bdb..00000000 --- a/papart/data/old/shaders/toonf2 (copie).frag +++ /dev/null @@ -1,28 +0,0 @@ -varying vec3 lightDir,normal; - -void main() -{ - - float intensity; - vec4 color; - - // normalizing the lights position to be on the safe side - vec3 l = normalize(vec3(gl_LightSource[0].position)); - - vec3 n = normalize(normal); - - intensity = dot(l,n); - - if (intensity > 0.95) - color = vec4(0.6,0.6,0.6,1.0); - else if (intensity > 0.7) - color = vec4(0.4,0.4,0.4,1.0); - else if (intensity > 0.5) - color = vec4(0.3,0.3,0.3,1.0); - else if (intensity > 0.25) - color = vec4(0.2,0.2,0.2,1.0); - else - color = vec4(0.1,0.1,0.1,1.0); - - gl_FragColor = color; -} diff --git a/papart/data/old/shaders/toonf2 (copie).vert b/papart/data/old/shaders/toonf2 (copie).vert deleted file mode 100755 index 51fb4e63..00000000 --- a/papart/data/old/shaders/toonf2 (copie).vert +++ /dev/null @@ -1,11 +0,0 @@ - - -varying vec3 lightDir,normal; - -void main() -{ - lightDir = normalize(vec3(gl_LightSource[0].position)); - normal = gl_NormalMatrix * gl_Normal; - - gl_Position = ftransform(); -} diff --git a/papart/data/old/shaders/toonf2.frag b/papart/data/old/shaders/toonf2.frag deleted file mode 100644 index 4ce4329e..00000000 --- a/papart/data/old/shaders/toonf2.frag +++ /dev/null @@ -1,84 +0,0 @@ - -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - vec4 _color; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - - /* if (intensity > 0.98) */ - /* _color = vec4(1.0,1.0,1.0,1.0); */ - /* else */ - - if (color.r > 0.5) - _color = vec4(0.8,0.8,0.8,1.0); - else if (color.r > 0.35) - _color = vec4(0.4,0.4,0.4,1.0); - else - _color = vec4(0.0,0.0,0.0,1.0); - - gl_FragColor = _color; - - // gl_FragColor = color; -} - - - - - - - -/* varying vec3 normal, lightDir; */ -/* varying vec2 texCoord; */ -/* //uniform sampler2D texture; */ - -/* void main() */ -/* { */ -/* float intensity; */ -/* vec3 n; */ -/* vec4 _color; */ - -/* n = normalize(normal); */ -/* intensity = dot(lightDir, n); */ - -/* /\* if (intensity > 0.98) *\/ */ -/* /\* _color = vec4(1.0,1.0,1.0,1.0); *\/ */ -/* /\* else *\/ */ -/* if (intensity > 0.5) */ -/* _color = vec4(0.8,0.8,0.8,1.0); */ -/* else if (intensity > 0.35) */ -/* _color = vec4(0.4,0.4,0.4,1.0); */ -/* else */ -/* _color = vec4(0.0,0.0,0.0,1.0); */ -/* // gl_FragColor = _color * texture2D(texture, texCoord); */ -/* gl_FragColor = _color; */ -/* } */ diff --git a/papart/data/old/shaders/toonf2.vert b/papart/data/old/shaders/toonf2.vert deleted file mode 100755 index 301143ea..00000000 --- a/papart/data/old/shaders/toonf2.vert +++ /dev/null @@ -1,51 +0,0 @@ - - -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - gl_Position = ftransform(); -} - - -/* varying vec3 normal, lightDir; */ -/* // varying vec2 texCoord; */ - -/* void main() */ -/* { */ -/* vec4 ecPos; */ -/* ecPos = vec4(gl_ModelViewMatrix * gl_Vertex); */ -/* lightDir = normalize(vec3(gl_LightSource[0].position) - ecPos.xyz); */ -/* normal = normalize(gl_NormalMatrix * gl_Normal); */ - -/* // texCoord = vec2(gl_MultiTexCoord0); */ -/* gl_Position = ftransform(); */ -/* } */ diff --git a/papart/data/old/shaders/toonv2.xml b/papart/data/old/shaders/toonv2.xml deleted file mode 100755 index 85807ae2..00000000 --- a/papart/data/old/shaders/toonv2.xml +++ /dev/null @@ -1,9 +0,0 @@ - - toon effect - toonf2.vert - toonf2.frag - - 0 - - - diff --git a/papart/data/old/shaders/transparency.frag b/papart/data/old/shaders/transparency.frag deleted file mode 100644 index 4991bc82..00000000 --- a/papart/data/old/shaders/transparency.frag +++ /dev/null @@ -1,36 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - - -void main() -{ - vec3 n,halfV,viewV,ldir; - float NdotL,NdotHV; - vec4 color = ambient; - - /* a fragment shader can't write a verying variable, hence we need - a new variable to store the normalized interpolated normal */ - n = normalize(normal); - - /* compute the dot product between normal and ldir */ - NdotL = max(dot(n,lightDir),0.0); - - if (NdotL > 0.0) { - halfV = normalize(halfVector); - NdotHV = max(dot(n,halfV),0.0); - color += gl_FrontMaterial.specular * gl_LightSource[0].specular * pow(NdotHV,gl_FrontMaterial.shininess); - color += diffuse * NdotL; - } - - gl_FragColor = vec4(color.rgb, 1.0); -} diff --git a/papart/data/old/shaders/transparency.vert b/papart/data/old/shaders/transparency.vert deleted file mode 100755 index abbe5d8a..00000000 --- a/papart/data/old/shaders/transparency.vert +++ /dev/null @@ -1,40 +0,0 @@ -/* ------------------------------------------------------- - -This shader implements a directional light per pixel using the -diffuse, specular, and ambient terms acoording to "Mathematics of Lighthing" -as found in the book "OpenGL Programming Guide" (aka the Red Book) - -António Ramires Fernandes - ---------------------------------------------------------- */ - -varying vec4 diffuse,ambient; -varying vec3 normal,lightDir,halfVector; - -void main() -{ - /* first transform the normal into eye space and normalize the result */ - normal = normalize(gl_NormalMatrix * gl_Normal); - - /* now normalize the light's direction. Note that according to the - OpenGL specification, the light is stored in eye space. Also since - we're talking about a directional light, the position field is actually - direction */ - lightDir = normalize(vec3(gl_LightSource[0].position)); - - /* Normalize the halfVector to pass it to the fragment shader */ - halfVector = normalize(gl_LightSource[0].halfVector.xyz); - - /* Compute the diffuse, ambient and globalAmbient terms */ - diffuse = gl_FrontMaterial.diffuse * gl_LightSource[0].diffuse; - ambient = gl_FrontMaterial.ambient * gl_LightSource[0].ambient; - ambient += gl_LightModel.ambient * gl_FrontMaterial.ambient; - - - gl_Position = ftransform(); - - - - - -} diff --git a/papart/data/old/shaders/transparency.xml b/papart/data/old/shaders/transparency.xml deleted file mode 100755 index eaaa7be3..00000000 --- a/papart/data/old/shaders/transparency.xml +++ /dev/null @@ -1,6 +0,0 @@ - - transparency - transparency.vert - transparency.frag - - diff --git a/papart/data/savedLocations/loc.xml b/papart/data/savedLocations/loc.xml new file mode 100644 index 00000000..57f4f734 --- /dev/null +++ b/papart/data/savedLocations/loc.xml @@ -0,0 +1,4 @@ + + + + diff --git a/papart/pom.xml b/papart/pom.xml index a55b9405..6530a48d 100755 --- a/papart/pom.xml +++ b/papart/pom.xml @@ -3,7 +3,7 @@ 4.0.0 fr.inria papart - 0.7-SNAPSHOT + 1.0 jar PapARt @@ -53,179 +53,228 @@ + + + org.reflections + reflections + 0.9.9 + + - tech.lity.rea - SVGExtended - 3.2.1 + org.processing + core + 3.2.3 + - org.bytedeco - javacpp - 1.2 + org.jogamp.jogl + jogl + 2.3.2 + + + + org.jogamp.jogl + jogl-all + 2.3.2 + + + + org.jogamp.gluegen + gluegen-rt-main + 2.3.2 + + + + org.jogamp.jogl + newt-main + 2.3.2 - org.bytedeco.javacpp-presets - opencv - 3.1.0-1.2 - compile + org.jogamp.jogl + nativewindow-main + 2.3.2 - + - org.bytedeco.javacpp-presets - ffmpeg - 2.7.1-1.0 + org.processing + video + 3.2.3 + + - org.bytedeco.javacpp-presets - flycapture - 2.7.3.19-1.0 + com.googlecode.gstreamer-java + gstreamer-java + 1.5 + + + + - org.bytedeco.javacpp-presets - libdc1394 - 2.2.3-1.0 + tech.lity.rea + SVGExtended + 3.2.1 + + - org.bytedeco.javacpp-presets - videoinput - 0.200-1.0 + fr.inria.potioc + ProcessingTUIO + 1.1.0 - + + + + org.clojars.frederikdb + oscp5 + 0.9.8-SNAPSHOT + + + + + org.clojars.hozumi + toxiclibscore + 0022 + + + + + fr.inria.potioc + skatolo + 1.0 + + + + + org.bytedeco + javacpp + 1.3 + + + org.bytedeco javacv - 1.2 + 1.3 org.bytedeco.javacpp-presets opencv - 3.1.0-1.2 + 3.1.0-1.3 ${platform} runtime + + org.bytedeco.javacpp-presets + opencv + 3.1.0-1.3 + compile + + org.bytedeco.javacpp-presets artoolkitplus - 2.3.1-1.2 + 2.3.1-1.3 org.bytedeco.javacpp-presets artoolkitplus - 2.3.1-1.2 + 2.3.1-1.3 ${platform} runtime org.bytedeco.javacpp-presets - libfreenect - 0.5.3-1.2 + ffmpeg + 3.2.1-1.3 - - org.bytedeco.javacpp-presets - libfreenect - 0.5.3-1.2 - ${platform} - runtime - - org.bytedeco.javacpp-presets ffmpeg - 3.0.2-1.2 + 3.2.1-1.3 ${platform} - org.processing - video - 3.0a11 - - - - org.processing - core - 3.1.2 + org.bytedeco.javacpp-presets + flycapture + 2.9.3.43-1.3 - + + + - org.reflections - reflections - 0.9.9 + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 - junit - junit - 4.7 - test - - + org.bytedeco.javacpp-presets + libfreenect + 0.5.3-1.3 + ${platform} + runtime + + + - org.jogamp.jogl - jogl - 2.3.2 + org.bytedeco.javacpp-presets + libfreenect2 + 0.2.0-1.3 - - org.jogamp.jogl - jogl-all - 2.3.2 + org.bytedeco.javacpp-presets + libfreenect2 + 0.2.0-1.3 + ${platform} + runtime - org.jogamp.gluegen - gluegen-rt-main - 2.3.2 + org.bytedeco.javacpp-presets + librealsense + 1.9.6-1.3 - org.jogamp.jogl - newt-main - 2.3.2 + org.bytedeco.javacpp-presets + librealsense + 1.9.6-1.3 + ${platform} + runtime + - - org.jogamp.jogl - nativewindow-main - 2.3.2 - + - fr.inria.potioc - ProcessingTUIO - 1.1.0 - - - com.googlecode.gstreamer-java - gstreamer-java - 1.5 - - - org.clojars.frederikdb - oscp5 - 0.9.8-SNAPSHOT - - - org.clojars.hozumi - toxiclibscore - 0022 + junit + junit + 4.7 + test - - fr.inria.potioc - skatolo - 1.0 - + diff --git a/papart/src/fr/inria/papart/apps/MultiTouch.java b/papart/src/fr/inria/papart/apps/MultiTouch.java index dbc1ddb3..cb468c68 100644 --- a/papart/src/fr/inria/papart/apps/MultiTouch.java +++ b/papart/src/fr/inria/papart/apps/MultiTouch.java @@ -47,7 +47,7 @@ public void setup() { Papart papart = Papart.projection2D(this); // arguments are 2D and 3D precision. - papart.loadTouchInputKinectOnly(); + papart.loadTouchInput(); touchInput = (KinectTouchInput) papart.getTouchInput(); frameRate(200); } diff --git a/papart/src/fr/inria/papart/apps/MyApp2D.java b/papart/src/fr/inria/papart/apps/MyApp2D.java index 382b768b..e7e0f29d 100644 --- a/papart/src/fr/inria/papart/apps/MyApp2D.java +++ b/papart/src/fr/inria/papart/apps/MyApp2D.java @@ -28,7 +28,7 @@ public class MyApp2D extends PaperScreen { @Override public void settings() { setDrawingSize(297, 210); - loadMarkerBoard(Papart.markerFolder + "A3-small1.svg", 297, 210); + loadMarkerBoard(Papart.markerFolder + "A4-default.svg", 297, 210); // loadMarkerBoard(Papart.markerFolder + "test.cfg", 297, 210); } diff --git a/papart/src/fr/inria/papart/apps/MyApp2DTouch.java b/papart/src/fr/inria/papart/apps/MyApp2DTouch.java index ce1d05a3..b3dc1ffa 100644 --- a/papart/src/fr/inria/papart/apps/MyApp2DTouch.java +++ b/papart/src/fr/inria/papart/apps/MyApp2DTouch.java @@ -28,7 +28,7 @@ public class MyApp2DTouch extends PaperTouchScreen { @Override public void settings() { setDrawingSize(297, 210); - loadMarkerBoard(Papart.markerFolder + "A3-small1.cfg", 297, 210); + loadMarkerBoard(Papart.markerFolder + "A4-default.svg", 297, 210); } @Override diff --git a/papart/src/fr/inria/papart/apps/PaperApp2D.java b/papart/src/fr/inria/papart/apps/PaperApp2D.java index d2c465ac..f8b12d4c 100644 --- a/papart/src/fr/inria/papart/apps/PaperApp2D.java +++ b/papart/src/fr/inria/papart/apps/PaperApp2D.java @@ -36,7 +36,7 @@ public class PaperApp2D extends PApplet { @Override public void settings() { - size(900, 600, P3D); + size(900, 600); // fullScreen(P3D, 2); } diff --git a/papart/src/fr/inria/papart/calibration/CalibrationApp.java b/papart/src/fr/inria/papart/calibration/CalibrationApp.java index f015655f..86d9209e 100644 --- a/papart/src/fr/inria/papart/calibration/CalibrationApp.java +++ b/papart/src/fr/inria/papart/calibration/CalibrationApp.java @@ -28,7 +28,7 @@ public class CalibrationApp extends PaperScreen { @Override public void settings() { setDrawingSize(297, 210); - loadMarkerBoard(Papart.markerFolder + Papart.calibrationFileName, 297, 210); + loadMarkerBoard(Papart.markerFolder + Papart.calibrationFileName, 162, 104);// 297, 210); setDrawAroundPaper(); } diff --git a/papart/src/fr/inria/papart/calibration/CalibrationExtrinsic.java b/papart/src/fr/inria/papart/calibration/CalibrationExtrinsic.java index de47bfd2..ea4cfe10 100644 --- a/papart/src/fr/inria/papart/calibration/CalibrationExtrinsic.java +++ b/papart/src/fr/inria/papart/calibration/CalibrationExtrinsic.java @@ -19,34 +19,17 @@ */ package fr.inria.papart.calibration; -import static fr.inria.papart.calibration.CalibrationPopup.KINECT_ARTOOLKIT_NAME; -import fr.inria.papart.depthcam.devices.Kinect360; -import fr.inria.papart.depthcam.devices.KinectDevice; -import fr.inria.papart.depthcam.devices.KinectDevice.Type; -import fr.inria.papart.depthcam.devices.KinectOne; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.multitouch.KinectTouchInput; -import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.procam.Papart; -import fr.inria.papart.procam.ProjectiveDeviceP; import fr.inria.papart.procam.camera.Camera; -import fr.inria.papart.procam.camera.ProjectorAsCamera; -import fr.inria.papart.procam.camera.TrackedView; import fr.inria.papart.procam.display.ProjectorDisplay; -import fr.inria.skatolo.gui.group.Textarea; import java.util.ArrayList; -import org.bytedeco.javacpp.opencv_core; -import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U; -import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY; -import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor; import processing.core.PApplet; -import static processing.core.PApplet.println; import processing.core.PMatrix3D; import processing.core.PVector; import toxi.geom.Plane; -import toxi.geom.Ray3D; -import toxi.geom.ReadonlyVec3D; import toxi.geom.Vec3D; -import static processing.core.PApplet.println; /** * @@ -56,14 +39,15 @@ public class CalibrationExtrinsic { private final PApplet parent; + private static final float OPEN_KINECT_Z_OFFSET = -25f; + private static final float REALSENSE_Z_OFFSET = -52f; // Cameras private ProjectorDisplay projector; - private PMatrix3D kinectCameraExtrinsics = new PMatrix3D(); - private Papart papart; + private final PMatrix3D kinectCameraExtrinsics = new PMatrix3D(); + private final Papart papart; // Kinect - private KinectDevice.Type kinectType; - private KinectDevice kinectDevice; + private DepthCameraDevice depthCameraDevice; public CalibrationExtrinsic(PApplet parent) { this.parent = parent; @@ -74,13 +58,12 @@ void setProjector(ProjectorDisplay projector) { this.projector = projector; } - public void setDefaultKinect() { - this.kinectType = papart.getKinectType(); - this.kinectDevice = papart.getKinectDevice(); + public void setDefaultDepthCamera() { + this.depthCameraDevice = papart.getDepthCameraDevice(); } - public void setKinect(KinectDevice device, Type type) { - this.kinectType = type; - this.kinectDevice = device; + + public void setDepthCamera(DepthCameraDevice device) { + this.depthCameraDevice = device; } public PMatrix3D getKinectCamExtrinsics() { @@ -94,7 +77,7 @@ public void computeProjectorCameraExtrinsics(ArrayList snap 0, 0, 0, 0); for (CalibrationSnapshot snapshot : snapshots) { - PMatrix3D extr = computeExtrinsics(snapshot.cameraPaper, + PMatrix3D extr = computeExtrinsics(snapshot.mainCameraPaper, snapshot.projectorPaper); Utils.addMatrices(sum, extr); } @@ -102,23 +85,25 @@ public void computeProjectorCameraExtrinsics(ArrayList snap saveProCamExtrinsics(sum); } - - public void saveProCamExtrinsics(PMatrix3D extr){ - papart.saveCalibration(Papart.cameraProjExtrinsics, extr); - projector.setExtrinsics(extr); + + public void saveProCamExtrinsics(PMatrix3D extr) { + papart.saveCalibration(Papart.cameraProjExtrinsics, extr); + projector.setExtrinsics(extr); } - public void calibrateKinect(ArrayList snapshots) { - if (this.kinectType == Type.ONE) { - calibrateKinectOne(snapshots); + public void calibrateKinect(ArrayList snapshots, boolean useExternal) { + if (depthCameraDevice == null) { + return; } - if (this.kinectType == Type.X360) { - calibrateKinect360(snapshots); + if (useExternal) { + calibrateDepthAndExternalCam(snapshots); + } else { + calibrateProjectorDepthCam(snapshots); } } - protected void calibrateKinectOne(ArrayList snapshots) { - PMatrix3D kinectExtr = kinectDevice.getStereoCalibration().get(); + protected void calibrateProjectorDepthCam(ArrayList snapshots) { + PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get(); kinectExtr.invert(); PlaneCalibration planeCalibCam = computeAveragePlaneCam(snapshots); @@ -136,21 +121,33 @@ protected void calibrateKinectOne(ArrayList snapshots) { return; } - // move the plane up a little. - planeCalibCam.moveAlongNormal(-7f); + // TODO: not sure here... ? + movePlaneAlongOffset(planeCalibCam); saveKinectPlaneCalibration(planeCalibCam, homography); saveKinectCameraExtrinsics(kinectCameraExtrinsics); } - protected void calibrateKinect360(ArrayList snapshots) { - calibrateKinect360Extr(snapshots); - calibrateKinect360Plane(snapshots); + private void movePlaneAlongOffset(PlaneCalibration planeCalib) { + + if (depthCameraDevice.type() == Camera.Type.OPEN_KINECT) { + System.out.println("Moving the plane along Z... " + OPEN_KINECT_Z_OFFSET); + planeCalib.moveAlongNormal(OPEN_KINECT_Z_OFFSET); + } + if (depthCameraDevice.type() == Camera.Type.REALSENSE) { + planeCalib.moveAlongNormal(REALSENSE_Z_OFFSET); + } + } - protected void calibrateKinect360Extr(ArrayList snapshots) { + protected void calibrateDepthAndExternalCam(ArrayList snapshots) { + calibrateDepthToExternalExtr(snapshots); + calibrateDepthCamPlane(snapshots); + } + + protected void calibrateDepthToExternalExtr(ArrayList snapshots) { // Depth -> color extrinsics - PMatrix3D kinectExtr = kinectDevice.getStereoCalibration().get(); + PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get(); // color -> depth extrinsics kinectExtr.invert(); @@ -165,9 +162,9 @@ protected void calibrateKinect360Extr(ArrayList snapshots) saveKinectCameraExtrinsics(kinectCameraExtr); } - public boolean calibrateKinect360Plane(ArrayList snapshots) { + public boolean calibrateDepthCamPlane(ArrayList snapshots) { // Depth -> color extrinsics - PMatrix3D kinectExtr = kinectDevice.getStereoCalibration().get(); + PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get(); // color -> depth extrinsics kinectExtr.invert(); @@ -189,16 +186,15 @@ public boolean calibrateKinect360Plane(ArrayList snapshots) // move the plane up a little. planeCalibKinect.flipNormal(); - planeCalibKinect.moveAlongNormal(-20f); + movePlaneAlongOffset(planeCalibKinect); saveKinectPlaneCalibration(planeCalibKinect, homography); return true; } - - - public boolean calibrateKinect360PlaneOnly(ArrayList snapshots) { + + public boolean calibrateDepthCamPlaneOnly(ArrayList snapshots) { // Depth -> color extrinsics - PMatrix3D kinectExtr = kinectDevice.getStereoCalibration().get(); + PMatrix3D kinectExtr = depthCameraDevice.getStereoCalibration().get(); // color -> depth extrinsics kinectExtr.invert(); @@ -220,7 +216,7 @@ public boolean calibrateKinect360PlaneOnly(ArrayList snapsh // move the plane up a little. planeCalibKinect.flipNormal(); - planeCalibKinect.moveAlongNormal(-20f); + movePlaneAlongOffset(planeCalibKinect); saveKinectPlaneCalibration(planeCalibKinect, homography); return true; @@ -244,7 +240,7 @@ private PMatrix3D computeKinectCamExtrinsics(ArrayList snap /// depth -> color -> color -> Paper boardFromDepth.preApply(stereoExtr); - PMatrix3D extr = computeExtrinsics(boardFromDepth, snapshot.cameraPaper); + PMatrix3D extr = computeExtrinsics(boardFromDepth, snapshot.mainCameraPaper); Utils.addMatrices(sum, extr); nbCalib++; @@ -298,12 +294,12 @@ private PlaneCalibration computeAveragePlaneCam(ArrayList s int nbPlanes = 0; for (CalibrationSnapshot snapshot : snapshots) { - if (snapshot.cameraPaper == null) { + if (snapshot.mainCameraPaper == null) { continue; } PlaneCalibration cam = PlaneCalibration.CreatePlaneCalibrationFrom( - snapshot.cameraPaper.get(), paperSize); + snapshot.mainCameraPaper.get(), paperSize); Utils.sumPlane(sumCam, cam.getPlane()); nbPlanes++; diff --git a/papart/src/fr/inria/papart/calibration/CalibrationPopup.java b/papart/src/fr/inria/papart/calibration/CalibrationPopup.java index 0ecc84d2..d13a5f76 100644 --- a/papart/src/fr/inria/papart/calibration/CalibrationPopup.java +++ b/papart/src/fr/inria/papart/calibration/CalibrationPopup.java @@ -1,6 +1,7 @@ /* * Part of the PapARt project - https://project.inria.fr/papart/ * + * Copyright (C) 2016 Jérémy Laviole * Copyright (C) 2014-2016 Inria * Copyright (C) 2011-2013 Bordeaux University * @@ -19,15 +20,17 @@ */ package fr.inria.papart.calibration; -import fr.inria.papart.depthcam.devices.KinectDevice; -import fr.inria.papart.depthcam.devices.KinectDevice.Type; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.procam.Papart; +import fr.inria.papart.procam.PaperScreen; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.camera.ProjectorAsCamera; +import fr.inria.papart.procam.camera.SubCamera; import fr.inria.papart.procam.camera.TrackedView; import fr.inria.papart.procam.display.ProjectorDisplay; import fr.inria.papart.tracking.DetectedMarker; +import fr.inria.papart.tracking.MarkerBoardARToolKitPlus; import fr.inria.skatolo.Skatolo; import fr.inria.skatolo.gui.controllers.Toggle; import fr.inria.skatolo.gui.group.Group; @@ -35,9 +38,6 @@ import fr.inria.skatolo.gui.group.Textarea; import java.util.ArrayList; import org.bytedeco.javacpp.ARToolKitPlus; -import static org.bytedeco.javacpp.ARToolKitPlus.MARKER_ID_BCH; -import static org.bytedeco.javacpp.ARToolKitPlus.PIXEL_FORMAT_LUM; -import static org.bytedeco.javacpp.ARToolKitPlus.UNDIST_NONE; import org.bytedeco.javacpp.opencv_core; import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U; import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY; @@ -80,8 +80,10 @@ public class CalibrationPopup extends PApplet { static final String PROJECTOR_ARTOOLKIT_NAME = "projectorCalibration.cal"; static final String KINECT_ARTOOLKIT_NAME = "kinectCalibration.cal"; + private ARToolKitPlus.MultiTracker projectorTracker = null; + // calibration App / board - private CalibrationApp calibrationApp; + private PaperScreen calibrationApp; private MarkerBoard board; // Matrices @@ -89,11 +91,12 @@ public class CalibrationPopup extends PApplet { // Cameras private Camera cameraTracking; - private Camera cameraKinect; + private Camera cameraFromDepthCam; // can be the same as cameraTracking. private TrackedView projectorView; // Kinect - private KinectDevice.Type kinectType; + private Camera.Type depthCameraType; + private boolean useExternalColorCamera = false; // calibrations private ArrayList snapshots = new ArrayList(); @@ -107,9 +110,9 @@ public class CalibrationPopup extends PApplet { private CalibrationExtrinsic calibrationExtrinsic; private PImage backgroundImg; - - public CalibrationPopup() { + public CalibrationPopup(PaperScreen screen) { super(); + this.calibrationApp = screen; PApplet.runSketch(new String[]{this.getClass().getName()}, this); } @@ -121,13 +124,18 @@ public void settings() { @Override public void setup() { + // Papart was created before, already with a camera, projector and Dcam. papart = Papart.getPapart(); cornersFileName = Papart.calibrationFolder + CORNERS_NAME; - calibrationApp = new CalibrationApp(); - calibrationApp.pre(); + + if (calibrationApp == null) { + calibrationApp = new CalibrationApp(); + calibrationApp.pre(); + } + board = calibrationApp.getBoard(); - cameraTracking = Papart.getPapart().getCameraTracking(); + cameraTracking = Papart.getPapart().getPublicCameraTracking(); projector = Papart.getPapart().getProjectorDisplay(); projector.setCalibrationMode(true); @@ -135,12 +143,35 @@ public void setup() { initProjectorAsCamera(); calibrationExtrinsic.setProjector(projector); - kinectType = papart.getKinectType(); - if (kinectType != Type.NONE) { - if (kinectType == Type.X360) { - initKinect360(papart.getKinectDevice()); + depthCameraType = papart.getDepthCameraType(); + DepthCameraDevice depthCameraDevice = papart.getDepthCameraDevice(); + + // There is a depth camera, and it is started. + if (depthCameraType != Camera.Type.FAKE && depthCameraDevice != null) { + + // There is a depth camera: + // - either the tracking is with the depth camera + // - or it is another camera + // 1. tracking camera is part of a depth camera + if (cameraTracking instanceof SubCamera + && cameraTracking == depthCameraDevice.getMainCamera().getActingCamera()) { + // tracking should be loaded already ! + System.out.println("Calibration with a Depth and color camera in the same device."); + cameraFromDepthCam = cameraTracking; + useExternalColorCamera = false; } - calibrationExtrinsic.setKinect(papart.getKinectDevice(), kinectType); + + // 2. Tracking camera is another camera. + if (cameraTracking != depthCameraDevice.getColorCamera() + && cameraTracking != depthCameraDevice.getIRCamera()) { + // the depth camera + initTrackingOn(papart.getDepthCameraDevice()); + System.out.println("Calibration with a Depth and color camera in DIFFERENT devices."); + useExternalColorCamera = true; + } + calibrationExtrinsic.setDepthCamera(depthCameraDevice); + } else { + System.out.println("Calibration with a color camera."); } initCorners(); @@ -162,42 +193,58 @@ private void initProjectorAsCamera() { projectorView = new TrackedView(); projectorView.setImageWidthPx(projector.getWidth()); projectorView.setImageHeightPx(projector.getHeight()); - projectorView.init(); - projectorAsCamera = new ProjectorAsCamera(); + if (cameraTracking.isPixelFormatGray()) { + projectorView.init(PApplet.GRAY); + } + if (cameraTracking.isPixelFormatColor()) { + projectorView.init(PApplet.RGB); + } + + projectorAsCamera = new ProjectorAsCamera(projector, cameraTracking, projectorView); projectorAsCamera.setCalibration(Papart.projectorCalib); projectorAsCamera.setParent(this); - String ARToolkitCalibFile = Papart.calibrationFolder + "projector.cal"; - ProjectorAsCamera.convertARProjParams(this, projectorAsCamera.getCalibrationFile(), - ARToolkitCalibFile); - projectorAsCamera.initMarkerDetection(ARToolkitCalibFile); + // if it uses gray images. + // All of this needs to be more explicit. + if (board.useGrayImages()) { + projectorAsCamera.setPixelFormat(Camera.PixelFormat.GRAY); + } + + if (board.getMarkerType() == MarkerBoard.MarkerType.ARTOOLKITPLUS) { + String ARToolkitCalibFile = Papart.calibrationFolder + "projector.cal"; + ProjectorAsCamera.convertARProjParams(this, projectorAsCamera.getCalibrationFile(), + ARToolkitCalibFile); + projectorAsCamera.setCalibrationARToolkit(ARToolkitCalibFile); + } + if (board.getMarkerType() == MarkerBoard.MarkerType.SVG) { + projectorTracker = DetectedMarker.createDetector(projector.getWidth(), projector.getHeight()); + } + + projectorAsCamera.trackSheets(true); projectorAsCamera.trackMarkerBoard(board); - initMarkerTrackingFromProjector(); - } - - private ARToolKitPlus.MultiTracker projectorTracker = null; - - private void initMarkerTrackingFromProjector() { - projectorTracker = DetectedMarker.createDetector(projector.getWidth(), projector.getHeight()); + + // warrning experimental + projectorAsCamera.setThread(); } - private void initKinect360(KinectDevice kinectDevice) { - cameraKinect = kinectDevice.getCameraRGB(); + private void initTrackingOn(DepthCameraDevice kinectDevice) { + kinectDevice.getMainCamera().actAsColorCamera(); + kinectDevice.getMainCamera().trackSheets(true); + + cameraFromDepthCam = kinectDevice.getColorCamera(); - String ARToolkitCalib = Papart.calibrationFolder + KINECT_ARTOOLKIT_NAME; - Camera.convertARParams(this, cameraKinect.getCalibrationFile(), ARToolkitCalib); - cameraKinect.initMarkerDetection(ARToolkitCalib); + if (board.getMarkerType() == MarkerBoard.MarkerType.ARTOOLKITPLUS) { + String ARToolkitCalib = Papart.calibrationFolder + KINECT_ARTOOLKIT_NAME; + Camera.convertARParams(this, cameraFromDepthCam.getProjectiveDevice(), ARToolkitCalib); + cameraFromDepthCam.setCalibrationARToolkit(ARToolkitCalib); + } // No display for now... -// arDisplayKinect = new ARDisplay(this, cameraKinect); -// arDisplayKinect.init(); -// arDisplayKinect.manualMode(); -// app.addDisplay(arDisplayKinect); - cameraKinect.trackSheets(true); + cameraFromDepthCam.trackSheets(true); // as it does not comes with the display: - cameraKinect.trackMarkerBoard(board); + cameraFromDepthCam.trackMarkerBoard(board); } void reset() { @@ -230,7 +277,7 @@ void initMainGui() { // .setCaptionLabel("Calibration ProCam") .plugTo(this, "calibrateProCam"); - if (kinectType != Type.NONE) { + if (depthCameraType != Camera.Type.FAKE) { skatolo.addBang("calibrateKinect") .setPosition(720, DO_CALIBRATION_HEIGHT) .setCaptionLabel("Plane Calibration"); @@ -243,7 +290,7 @@ public void addCalibration() { new CalibrationSnapshot( currentCamBoard(), currentProjBoard(), - (kinectType == Type.X360) ? currentKinect360Board() : null)); + currentDepthCameraBoard())); } public void clearCalibrations() { @@ -251,23 +298,26 @@ public void clearCalibrations() { reset(); } - public void calibrateProCam() { + public void calibrateProCam(boolean useExternal) { this.isProCamCalibrated = COMPUTING; calibrationExtrinsic.computeProjectorCameraExtrinsics(snapshots); - calibrationExtrinsic.calibrateKinect(snapshots); + calibrationExtrinsic.calibrateKinect(snapshots, useExternalColorCamera); this.isProCamCalibrated = OK; this.isKinectCalibrated = OK; } - public void calibrateKinect() { - boolean isCalibOK = calibrationExtrinsic.calibrateKinect360Plane(snapshots); + public void calibrateKinect(boolean useExternal) { + boolean isCalibOK = calibrationExtrinsic.calibrateDepthCamPlane(snapshots); if (isCalibOK) { this.isKinectCalibrated = OK; } } - private PMatrix3D currentKinect360Board() { - return board.getTransfoMat(cameraKinect).get(); + private PMatrix3D currentDepthCameraBoard() { + if (cameraFromDepthCam == null || cameraFromDepthCam == cameraTracking) { + return null; + } + return board.getTransfoMat(cameraFromDepthCam).get(); } private PMatrix3D currentCamBoard() { @@ -275,49 +325,10 @@ private PMatrix3D currentCamBoard() { } private PMatrix3D currentProjBoard() { - opencv_core.IplImage projImage = projectorImage(); - if (projImage == null) { - return new PMatrix3D(); - } - // Detection from Projector's view... - DetectedMarker[] markers = DetectedMarker.detect(this.projectorTracker, projImage); - - board.updateLocation(projectorAsCamera, projImage, markers); return board.getTransfoMat(projectorAsCamera); } - private opencv_core.IplImage grayImage = null; - - private opencv_core.IplImage projectorImage() { - projectorView.setCorners(corners); - opencv_core.IplImage projImage = projectorView.getIplViewOf(cameraTracking); - if(projImage == null) - return null; - - if (board.useGrayscaleImages()) { - projImage = greyProjectorImage(projImage); - } - return projImage; - } - - private opencv_core.IplImage greyProjectorImage(opencv_core.IplImage projImage) { - if (grayImage == null) { - grayImage = opencv_core.IplImage.create(projector.getWidth(), - projector.getHeight(), - IPL_DEPTH_8U, 1); - } - - System.out.println(projImage + " " + grayImage); - cvCvtColor(projImage, grayImage, CV_BGR2GRAY); - - // if(test){ - // cvSaveImage( sketchPath() + "/data/projImage.jpg", grayImage); - // cvSaveImage( sketchPath() + "/data/camImage.jpg", camera.getIplImage()); - // } - return grayImage; - } //// Calibrations - void initMatrixGui() { PFont arial = createFont("arial", 12); @@ -333,8 +344,8 @@ void initMatrixGui() { .setFont(arial) .setLineHeight(14); - if (this.kinectType == Type.X360) { - System.out.println("Kinect 360 OK..."); + if (useExternalColorCamera) { + System.out.println("Depth camera OK..."); kinectMatrixText = skatolo.addTextarea("Kinect") .setPosition(600, MATRICES_HEIGHT) .setSize(330, 100) @@ -342,7 +353,7 @@ void initMatrixGui() { .setLineHeight(14) //.setColor(color(128)) ; } else { - System.out.println("Kinect 360 NOT Activated !"); + System.out.println("External camera not activated."); } } @@ -491,6 +502,10 @@ public void draw() { } popMatrix(); + // Update the corners. + // TODO: move this when the corners are actally moved. + projectorView.setCorners(corners); + text(this.isProCamCalibrated, 100, DO_CALIBRATION_HEIGHT + 15); text(this.isKinectCalibrated, 300, DO_CALIBRATION_HEIGHT + 15); @@ -505,12 +520,12 @@ public void draw() { projectorMatrixText.setText(Utils.matToString(currentProjBoard())); } - if (this.kinectType == Type.X360) { + if (useExternalColorCamera) { if (this.isKinectCalibrated == OK) { cameraMatrixText.setColor(color(0, 255, 0)); cameraMatrixText.setText(Utils.matToString(calibrationExtrinsic.getKinectCamExtrinsics())); } else { - kinectMatrixText.setText(Utils.matToString(currentKinect360Board())); + kinectMatrixText.setText(Utils.matToString(currentDepthCameraBoard())); } } diff --git a/papart/src/fr/inria/papart/calibration/CalibrationSnapshot.java b/papart/src/fr/inria/papart/calibration/CalibrationSnapshot.java index a8a33376..7f0d0318 100644 --- a/papart/src/fr/inria/papart/calibration/CalibrationSnapshot.java +++ b/papart/src/fr/inria/papart/calibration/CalibrationSnapshot.java @@ -27,7 +27,7 @@ */ public class CalibrationSnapshot { - PMatrix3D cameraPaper = null; + PMatrix3D mainCameraPaper = null; PMatrix3D projectorPaper = null; PMatrix3D kinectPaper = null; @@ -36,7 +36,7 @@ public CalibrationSnapshot(PMatrix3D cameraPaperCalibration, PMatrix3D kinectPaperCalibration) { if (cameraPaperCalibration != null) { - cameraPaper = cameraPaperCalibration.get(); + mainCameraPaper = cameraPaperCalibration.get(); } if (projectorPaperCalibration != null) { projectorPaper = projectorPaperCalibration.get(); diff --git a/papart/src/fr/inria/papart/calibration/CalibrationVideoPopup.java b/papart/src/fr/inria/papart/calibration/CalibrationVideoPopup.java index 7c6c9de4..565cfa27 100644 --- a/papart/src/fr/inria/papart/calibration/CalibrationVideoPopup.java +++ b/papart/src/fr/inria/papart/calibration/CalibrationVideoPopup.java @@ -63,7 +63,7 @@ public void setSize() { frame.setUndecorated(true); frame.addNotify(); // surface.setLocation(screenOffsetX, screenOffsetY); - cameraTracking = Papart.getPapart().getCameraTracking(); + cameraTracking = Papart.getPapart().getPublicCameraTracking(); surface.setSize(cameraTracking.width(), cameraTracking.height()); } diff --git a/papart/src/fr/inria/papart/depthcam/PointCloud.java b/papart/src/fr/inria/papart/depthcam/PointCloud.java index b9cf3f0b..bc6fa070 100755 --- a/papart/src/fr/inria/papart/depthcam/PointCloud.java +++ b/papart/src/fr/inria/papart/depthcam/PointCloud.java @@ -67,7 +67,6 @@ public class PointCloud { protected static final int SIZEOF_FLOAT = Float.SIZE / 8; protected static final int SIZEOF_BYTE = Byte.SIZE / 8; protected boolean usePoints; - private int skip = 1; public PointCloud(PApplet parent, int size) { this.parentApplet = parent; diff --git a/papart/src/fr/inria/papart/depthcam/analysis/DepthAnalysis.java b/papart/src/fr/inria/papart/depthcam/analysis/DepthAnalysis.java index 37b5fef5..d932f707 100755 --- a/papart/src/fr/inria/papart/depthcam/analysis/DepthAnalysis.java +++ b/papart/src/fr/inria/papart/depthcam/analysis/DepthAnalysis.java @@ -20,16 +20,10 @@ package fr.inria.papart.depthcam.analysis; import fr.inria.papart.depthcam.devices.KinectDepthData; -import fr.inria.papart.calibration.HomographyCalibration; -import fr.inria.papart.calibration.PlaneAndProjectionCalibration; import fr.inria.papart.depthcam.PixelOffset; import org.bytedeco.javacpp.opencv_core.IplImage; -import fr.inria.papart.procam.ProjectiveDeviceP; -import java.nio.ByteBuffer; import processing.core.PApplet; -import processing.core.PMatrix3D; import processing.core.PVector; -import toxi.geom.Plane; import toxi.geom.Vec3D; /** @@ -38,8 +32,6 @@ * * @author jeremy */ -// TODO: -// use the Hardware calibration. public abstract class DepthAnalysis { protected int[] connexity; // TODO: check for Byte instead of int diff --git a/papart/src/fr/inria/papart/depthcam/analysis/KinectDepthAnalysis.java b/papart/src/fr/inria/papart/depthcam/analysis/KinectDepthAnalysis.java index 92ba65a3..128a2781 100755 --- a/papart/src/fr/inria/papart/depthcam/analysis/KinectDepthAnalysis.java +++ b/papart/src/fr/inria/papart/depthcam/analysis/KinectDepthAnalysis.java @@ -1,6 +1,7 @@ /* * Part of the PapARt project - https://project.inria.fr/papart/ * + * Copyright (C) 2016 Jérémy Laviole * Copyright (C) 2014-2016 Inria * Copyright (C) 2011-2013 Bordeaux University * @@ -19,21 +20,23 @@ */ package fr.inria.papart.depthcam.analysis; -import fr.inria.papart.calibration.HomographyCalibration; import fr.inria.papart.calibration.PlaneAndProjectionCalibration; import fr.inria.papart.depthcam.PixelOffset; import fr.inria.papart.depthcam.TouchAttributes; import fr.inria.papart.depthcam.devices.Kinect360; import fr.inria.papart.depthcam.devices.KinectDepthData; -import fr.inria.papart.depthcam.devices.KinectDevice; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.depthcam.devices.KinectOne; import static fr.inria.papart.depthcam.analysis.DepthAnalysis.INVALID_POINT; import static fr.inria.papart.depthcam.analysis.DepthAnalysis.papplet; +import fr.inria.papart.depthcam.devices.RealSense; import fr.inria.papart.procam.ProjectiveDeviceP; -import fr.inria.papart.procam.Utils; +import fr.inria.papart.utils.MathUtils; +import fr.inria.papart.utils.ARToolkitPlusUtils; import fr.inria.papart.procam.camera.Camera; -import fr.inria.papart.procam.camera.CameraOpenKinect; +import fr.inria.papart.procam.camera.CameraRealSense; import java.nio.ByteBuffer; +import java.nio.ShortBuffer; import java.util.ArrayList; import java.util.Iterator; import java.util.concurrent.Callable; @@ -44,7 +47,6 @@ import org.bytedeco.javacpp.opencv_core; import org.bytedeco.javacpp.opencv_core.IplImage; import processing.core.PApplet; -import processing.core.PMatrix3D; import processing.core.PVector; import toxi.geom.Vec3D; @@ -56,48 +58,88 @@ public class KinectDepthAnalysis extends DepthAnalysis { // Configuration private float closeThreshold = 300f, farThreshold = 12000f; - protected ProjectiveDeviceP calibIR, calibRGB; + protected ProjectiveDeviceP calibDepth, calibRGB; // private variables // Raw data from the Kinect Sensor + protected ShortBuffer depthRawShortBuffer; + protected ByteBuffer depthRawBuffer; protected byte[] depthRaw; protected byte[] colorRaw; // static values protected static final float INVALID_DEPTH = -1; - protected KinectDevice kinectDevice; + protected DepthCameraDevice depthCameraDevice; protected DepthComputation depthComputationMethod; - public KinectDevice kinectDevice() { - return this.kinectDevice; + protected Camera colorCamera; + + public DepthCameraDevice getDepthCameraDevice() { + return this.depthCameraDevice; } @Override public int getDepthSize() { - return kinectDevice().depthSize(); + return getDepthWidth() * getDepthHeight(); } @Override public int getDepthWidth() { - return kinectDevice().depthWidth(); + return getDepthCameraDevice().getDepthCamera().width(); } @Override public int getDepthHeight() { - return kinectDevice().depthHeight(); + return getDepthCameraDevice().getDepthCamera().height(); } - public KinectDepthAnalysis(PApplet parent, KinectDevice kinect) { - kinectDevice = kinect; - DepthAnalysis.papplet = parent; - calibRGB = kinect.getCameraRGB().getProjectiveDevice(); - calibIR = kinect.getCameraDepth().getProjectiveDevice(); - initMemory(); + public int getColorWidth() { + return colorCamera.width(); + } + + public int getColorHeight() { + return colorCamera.height(); + } + + public int getColorSize() { + return getColorWidth() * getColorHeight(); + } + + private boolean memoryInitialized = false; + public KinectDepthAnalysis(PApplet parent, DepthCameraDevice depthCamera) { + DepthAnalysis.papplet = parent; + this.depthCameraDevice = depthCamera; + + // DepthCamera sizes should be good here... (says TouchVisu) + // why not ? (calib?) + //----- + +// initMemory(); + updateCalibrations(depthCamera); // initThreadPool(); } + public void updateCalibrations(DepthCameraDevice depthCamera) { + depthCameraDevice = depthCamera; + + if (depthCamera.getMainCamera().isUseIR()) { + colorCamera = depthCamera.getIRCamera(); + } + if (depthCamera.getMainCamera().isUseColor()) { + colorCamera = depthCamera.getColorCamera(); + } + + calibRGB = colorCamera.getProjectiveDevice(); + calibDepth = depthCamera.getDepthCamera().getProjectiveDevice(); + + if (!memoryInitialized) { + initMemory(); + memoryInitialized = true; + } + } + // Thread version... No bonus whatsoever for now. private int nbThreads = 16; private ExecutorService threadPool; @@ -107,37 +149,26 @@ private void initThreadPool() { } private void initMemory() { - colorRaw = new byte[kinectDevice.colorSize() * 3]; - depthRaw = new byte[kinectDevice.rawDepthSize()]; + System.out.println("Allocations: " + getColorSize() + " " + depthCameraDevice.rawDepthSize()); - depthData = new KinectDepthData(this); - depthData.projectiveDevice = this.calibIR; + colorRaw = new byte[getColorSize() * 3]; + depthRaw = new byte[depthCameraDevice.rawDepthSize()]; - if (kinectDevice instanceof Kinect360) { + depthData = new KinectDepthData(this); + depthData.projectiveDevice = this.calibDepth; + + if (depthCameraDevice instanceof Kinect360) { depthComputationMethod = new Kinect360Depth(); - } else { - if (kinectDevice instanceof KinectOne) { - depthComputationMethod = new KinectOneDepth(); - } + } + if (depthCameraDevice instanceof KinectOne) { + depthComputationMethod = new KinectOneDepth(); + } + if (depthCameraDevice instanceof RealSense) { + float depthScale = ((CameraRealSense) ((RealSense) depthCameraDevice).getMainCamera()).getDepthScale(); + depthComputationMethod = new RealSenseDepth(depthScale); } - PixelOffset.initStaticMode(kinectDevice.depthWidth(), kinectDevice.depthHeight()); - } - - public PVector findDepthAtRGB(PVector v){ - return findDepthAtRGB(v.x, v.y, v.z); - } - - public PVector findDepthAtRGB(float x, float y, float z){ - PVector v = new PVector(x, y, z); - PVector v2 = new PVector(); - - kinectDevice.getStereoCalibrationInv().mult(v, v2); - // v2 is now the location in KinectDepth instead of KinectRGB coordinates. - - int worldToPixel = kinectDevice().getCameraDepth().getProjectiveDevice().worldToPixel(v2); - - return Utils.toPVector(depthData.depthPoints[worldToPixel]); + PixelOffset.initStaticMode(getDepthWidth(), getDepthHeight()); } public void update(IplImage depth) { @@ -213,7 +244,7 @@ public void computeDepthAndDo(int precision, DepthPointManiplation manip) { // Vec3D pKinect = calibIR.pixelToWorld(px.x, px.y, d); // depthData.depthPoints[px.offset] = pKinect; - calibIR.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); + calibDepth.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); // System.out.println("Depth " + depthData.depthPoints[px.offset]); manip.execute(depthData.depthPoints[px.offset], px); } @@ -232,7 +263,7 @@ protected void computeDepthAndDo(int precision, DepthPointManiplation manip, Inv // depthData.depthPoints[px.offset] = pKinect; // manip.execute(pKinect, px); - calibIR.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); + calibDepth.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); manip.execute(depthData.depthPoints[px.offset], px); } else { @@ -285,13 +316,40 @@ protected void doForEachValid3DPoint(int precision, DepthPointManiplation manip) } } - protected void updateRawDepth(opencv_core.IplImage depthImage) { -// ByteBuffer depthBuff = depthImage.imageData().asBuffer(); -// System.out.println("depthRaw size " + depthRaw.length + " image data size " + depthImage.getByteBuffer().capacity()); -// depthBuff.get(depthRaw); + public PVector findDepthAtRGB(PVector v) { + return findDepthAtRGB(v.x, v.y, v.z); + } - depthImage.getByteBuffer().get(depthRaw); -// depthImage.imageData().get(depthRaw); + public PVector findDepthAtRGB(float x, float y, float z) { + PVector v = new PVector(x, y, z); + PVector v2 = new PVector(); + + // Point is now in the Depth coordinates + depthCameraDevice.getStereoCalibrationInv().mult(v, v2); + + // v2 is now the location in KinectDepth instead of KinectRGB coordinates. + + // Point is now in pixel coordinates + int worldToPixel = getDepthCameraDevice().getDepthCamera().getProjectiveDevice().worldToPixel(v2); + + // Point viewed in the depth camera point of view. + PVector pointDepth = MathUtils.toPVector(depthData.depthPoints[worldToPixel]); + + return pointDepth; + // get it back in the RGB point of view. +// PVector out = new PVector(); +// depthCameraDevice.getStereoCalibration().mult(pointDepth, out); +// return out; +// return Utils.toPVector(depthData.depthPoints[worldToPixel]); + } + + protected void updateRawDepth(opencv_core.IplImage depthImage) { + if (getDepthCameraDevice().type() == Camera.Type.REALSENSE) { + depthRawBuffer = depthImage.getByteBuffer(); + depthRawShortBuffer = depthRawBuffer.asShortBuffer(); + } else { + depthImage.getByteBuffer().get(depthRaw); + } } protected void updateRawColor(opencv_core.IplImage colorImage) { @@ -325,18 +383,33 @@ public float findDepth(int offset) { } public static final float KINECT_ONE_DEPTH_RATIO = 10f; - + class KinectOneDepth implements DepthComputation { @Override public float findDepth(int offset) { - float d = (depthRaw[offset * 3 + 1] & 0xFF) * 256 + - (depthRaw[offset * 3] & 0xFF); - + float d = (depthRaw[offset * 3 + 1] & 0xFF) * 256 + + (depthRaw[offset * 3] & 0xFF); + return d / KINECT_ONE_DEPTH_RATIO; // / 65535f * 10000f; } } + class RealSenseDepth implements DepthComputation { + + private float depthRatio; + + public RealSenseDepth(float depthRatio) { + this.depthRatio = depthRatio; + } + + @Override + public float findDepth(int offset) { + float d = depthRawShortBuffer.get(offset) * depthRatio * 1000f; + return d; + } + } + public void setNearFarValue(float near, float far) { this.closeThreshold = near; this.farThreshold = far; @@ -452,7 +525,7 @@ public void execute(Vec3D p, PixelOffset px) { } protected int getPixelColor(int offset) { - int colorOffset = kinectDevice.findColorOffset(depthData.depthPoints[offset]) * 3; + int colorOffset = depthCameraDevice.findColorOffset(depthData.depthPoints[offset]) * 3; int c = (colorRaw[colorOffset + 2] & 0xFF) << 16 | (colorRaw[colorOffset + 1] & 0xFF) << 8 | (colorRaw[colorOffset + 0] & 0xFF); @@ -469,7 +542,7 @@ public class PixelList implements Iterable { public PixelList(int precision) { this.precision = precision; this.begin = 0; - this.end = calibIR.getHeight(); + this.end = calibDepth.getHeight(); } /** @@ -492,7 +565,7 @@ public Iterator iterator() { private int x = 0; private int y = begin; private int offset = 0; - private final int width = calibIR.getWidth(); + private final int width = calibDepth.getWidth(); @Override public boolean hasNext() { @@ -567,12 +640,12 @@ public DepthPixelTask(int part, int nbThreads, int precision, DepthPointManiplat public Object call() { int nbParts = nbThreads; - int partSize = nbParts / calibIR.getHeight(); + int partSize = nbParts / calibDepth.getHeight(); int begin = partSize * part; int end; if (part == nbThreads - 1) { - end = calibIR.getHeight(); + end = calibDepth.getHeight(); } else { end = partSize * (part + 1); } @@ -585,7 +658,7 @@ public Object call() { // Vec3D pKinect = calibIR.pixelToWorld(px.x, px.y, d); // depthData.depthPoints[px.offset] = pKinect; - calibIR.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); + calibDepth.pixelToWorld(px.x, px.y, d, depthData.depthPoints[px.offset]); manip.execute(depthData.depthPoints[px.offset], px); } } @@ -606,7 +679,7 @@ public void undistortRGB(opencv_core.IplImage rgb, opencv_core.IplImage out) { * @param out */ public void undistortIR(opencv_core.IplImage ir, opencv_core.IplImage out) { - calibIR.getDevice().undistort(ir, out); + calibDepth.getDevice().undistort(ir, out); } public ProjectiveDeviceP getColorProjectiveDevice() { @@ -614,7 +687,7 @@ public ProjectiveDeviceP getColorProjectiveDevice() { } public ProjectiveDeviceP getDepthProjectiveDevice() { - return calibIR; + return calibDepth; } public byte[] getColorBuffer() { diff --git a/papart/src/fr/inria/papart/depthcam/analysis/KinectOpenCV.java b/papart/src/fr/inria/papart/depthcam/analysis/KinectOpenCV.java index 1ceeecd0..ab2e357d 100755 --- a/papart/src/fr/inria/papart/depthcam/analysis/KinectOpenCV.java +++ b/papart/src/fr/inria/papart/depthcam/analysis/KinectOpenCV.java @@ -20,7 +20,7 @@ package fr.inria.papart.depthcam.analysis; import fr.inria.papart.depthcam.PixelOffset; -import fr.inria.papart.depthcam.devices.KinectDevice; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.procam.camera.CameraOpenKinect; import java.nio.ByteBuffer; import java.util.Arrays; @@ -39,16 +39,16 @@ public class KinectOpenCV extends KinectDepthAnalysis { public IplImage validPointsIpl; public byte[] validPointsRaw; - public KinectOpenCV(PApplet parent, KinectDevice kinect) { + public KinectOpenCV(PApplet parent, DepthCameraDevice kinect) { super(parent, kinect); init(); } private void init() { - validPointsIpl = IplImage.create(cvSize(kinectDevice().depthWidth(), - kinectDevice().depthHeight()), + validPointsIpl = IplImage.create(cvSize(getDepthWidth(), + getDepthHeight()), IPL_DEPTH_8U, 3); - validPointsRaw = new byte[kinectDevice().depthSize() * 3]; + validPointsRaw = new byte[getDepthSize()* 3]; } public IplImage update(IplImage depth, IplImage color) { @@ -83,7 +83,7 @@ class setImageData implements DepthPointManiplation { public void execute(Vec3D p, PixelOffset px) { depthData.validPointsMask[px.offset] = true; int outputOffset = px.offset * 3; - int colorOffset = kinectDevice.findColorOffset(p) * 3; + int colorOffset = depthCameraDevice.findColorOffset(p) * 3; validPointsRaw[outputOffset + 2] = colorRaw[colorOffset + 2]; validPointsRaw[outputOffset + 1] = colorRaw[colorOffset + 1]; validPointsRaw[outputOffset + 0] = colorRaw[colorOffset + 0]; diff --git a/papart/src/fr/inria/papart/depthcam/analysis/KinectProcessing.java b/papart/src/fr/inria/papart/depthcam/analysis/KinectProcessing.java index 675730a8..59781818 100755 --- a/papart/src/fr/inria/papart/depthcam/analysis/KinectProcessing.java +++ b/papart/src/fr/inria/papart/depthcam/analysis/KinectProcessing.java @@ -1,6 +1,7 @@ /* * Part of the PapARt project - https://project.inria.fr/papart/ * + * Copyright (C) 2016 Jérémy Laviole * Copyright (C) 2014-2016 Inria * Copyright (C) 2011-2013 Bordeaux University * @@ -19,23 +20,18 @@ */ package fr.inria.papart.depthcam.analysis; -import static fr.inria.papart.depthcam.analysis.DepthAnalysis.papplet; -import fr.inria.papart.calibration.HomographyCalibration; import fr.inria.papart.calibration.PlaneAndProjectionCalibration; -import fr.inria.papart.calibration.PlaneCalibration; import fr.inria.papart.depthcam.PixelOffset; -import fr.inria.papart.depthcam.devices.KinectDevice; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.depthcam.devices.KinectOne; import static fr.inria.papart.depthcam.analysis.DepthAnalysis.papplet; -import fr.inria.papart.procam.camera.CameraOpenKinect; +import fr.inria.papart.procam.camera.Camera; import java.util.ArrayList; import java.util.Arrays; -import org.bytedeco.javacpp.indexer.Indexer; import org.bytedeco.javacpp.indexer.UByteIndexer; import org.bytedeco.javacpp.opencv_core; import static org.bytedeco.javacpp.opencv_core.*; import static org.bytedeco.javacpp.opencv_imgproc.*; -import org.bytedeco.javacpp.opencv_core.CvSize; import org.bytedeco.javacpp.opencv_core.IplImage; import processing.core.PApplet; import processing.core.PConstants; @@ -53,7 +49,7 @@ public class KinectProcessing extends KinectDepthAnalysis { UByteIndexer erosionIndexer; boolean[] validCopy; - public KinectProcessing(PApplet parent, KinectDevice kinect) { + public KinectProcessing(PApplet parent, DepthCameraDevice kinect) { super(parent, kinect); init(); } @@ -64,8 +60,8 @@ public KinectProcessing(PApplet parent, KinectOne kinectOne) { } private void init() { - validPointsPImage = papplet.createImage(kinectDevice().depthWidth(), kinectDevice().depthHeight(), PConstants.RGB); - nativeArrayToErode = IplImage.create(kinectDevice.depthWidth(), kinectDevice.depthHeight(), IPL_DEPTH_8U, 1); + validPointsPImage = papplet.createImage(getDepthWidth(), getDepthHeight(), PConstants.RGB); + nativeArrayToErode = IplImage.create(getDepthWidth(), getDepthHeight(), IPL_DEPTH_8U, 1); erosionIndexer = (UByteIndexer) nativeArrayToErode.createIndexer(); validCopy = Arrays.copyOf(depthData.validPointsMask, depthData.validPointsMask.length); @@ -129,9 +125,9 @@ private void erodePoints2(ArrayList validList, boolean[] arrayToErode, int x = po.x; int y = po.y; - for (int j = y * kinectDevice.depthWidth() - skip; - j <= y * kinectDevice.depthWidth() + skip; - j += kinectDevice.depthWidth() * skip) { + for (int j = y * getDepthWidth() - skip; + j <= y * getDepthWidth() + skip; + j += getDepthWidth() * skip) { for (int i = x - skip; i <= x + skip; i += skip) { int currentIdx = i + j; @@ -149,11 +145,11 @@ private void erodePoints2(ArrayList validList, boolean[] arrayToErode, private void erodePoints(boolean[] arrayToErode) { - for (int i = 0; i < kinectDevice.depthWidth() * kinectDevice.depthHeight(); i++) { + for (int i = 0; i < getDepthWidth() * getDepthHeight(); i++) { erosionIndexer.put(i, arrayToErode[i] ? 1 : 0); } cvErode(nativeArrayToErode, nativeArrayToErode); - for (int i = 0; i < kinectDevice.depthWidth() * kinectDevice.depthHeight(); i++) { + for (int i = 0; i < getDepthWidth() * getDepthHeight(); i++) { arrayToErode[i] = erosionIndexer.get(i) == 1; } @@ -231,7 +227,14 @@ public PImage update(IplImage depth, IplImage color, int skip) { // computeDepthAndDo(skip, new DoNothing()); // TODO: get the color with Kinect2... - computeDepthAndDo(skip, new SetImageData()); + + System.out.println("PixelFormat " + colorCamera.getPixelFormat().name()); + if(this.colorCamera.getPixelFormat() == Camera.PixelFormat.RGB){ + computeDepthAndDo(skip, new SetImageDataRGB()); + } + if(this.colorCamera.getPixelFormat() == Camera.PixelFormat.BGR){ + computeDepthAndDo(skip, new SetImageData()); + } // computeDepthAndDo(skip, new Select2DPointOverPlane()); validPointsPImage.updatePixels(); @@ -251,13 +254,25 @@ public void execute(Vec3D p, PixelOffset px) { } class SetImageData implements DepthPointManiplation { - + public SetImageData(){ + super(); + } @Override public void execute(Vec3D p, PixelOffset px) { depthData.validPointsMask[px.offset] = true; setPixelColor(px.offset); } } + class SetImageDataRGB implements DepthPointManiplation { + public SetImageDataRGB(){ + super(); + } + @Override + public void execute(Vec3D p, PixelOffset px) { + depthData.validPointsMask[px.offset] = true; + setPixelColorRGB(px.offset); + } + } private void setFakeColor(int offset, int r, int g, int b) { int c = (r & 0xFF) << 16 @@ -266,14 +281,27 @@ private void setFakeColor(int offset, int r, int g, int b) { validPointsPImage.pixels[offset] = c; } + // TODO: Generalization here, same functions as those to convert the pixels for OpenGL. private void setPixelColor(int offset) { - int colorOffset = kinectDevice.findColorOffset(depthData.depthPoints[offset]) * 3; + + // TODO: Get a cleaner way go obtain the color... + int colorOffset = depthCameraDevice.findColorOffset(depthData.depthPoints[offset]) * 3; int c = (colorRaw[colorOffset + 2] & 0xFF) << 16 | (colorRaw[colorOffset + 1] & 0xFF) << 8 | (colorRaw[colorOffset + 0] & 0xFF); validPointsPImage.pixels[offset] = c; } + private void setPixelColorRGB(int offset) { + + // TODO: Get a cleaner way go obtain the color... + int colorOffset = depthCameraDevice.findColorOffset(depthData.depthPoints[offset]) * 3; + int c = (colorRaw[colorOffset + 0] & 0xFF) << 16 + | (colorRaw[colorOffset + 1] & 0xFF) << 8 + | (colorRaw[colorOffset + 2] & 0xFF); + + validPointsPImage.pixels[offset] = c; + } public PImage getColouredDepthImage() { return validPointsPImage; diff --git a/papart/src/fr/inria/papart/depthcam/devices/DepthCameraDevice.java b/papart/src/fr/inria/papart/depthcam/devices/DepthCameraDevice.java index 6080b755..9a7ee106 100644 --- a/papart/src/fr/inria/papart/depthcam/devices/DepthCameraDevice.java +++ b/papart/src/fr/inria/papart/depthcam/devices/DepthCameraDevice.java @@ -19,17 +19,144 @@ */ package fr.inria.papart.depthcam.devices; +import fr.inria.papart.calibration.HomographyCalibration; +import fr.inria.papart.multitouch.KinectTouchInput; +import fr.inria.papart.procam.Papart; +import fr.inria.papart.utils.ARToolkitPlusUtils; +import fr.inria.papart.procam.camera.Camera; +import fr.inria.papart.procam.camera.CameraFactory; +import fr.inria.papart.procam.camera.CameraRGBIRDepth; +import fr.inria.papart.procam.camera.SubCamera; +import fr.inria.papart.procam.camera.SubDepthCamera; +import org.bytedeco.javacpp.opencv_core.IplImage; +import processing.core.PApplet; +import processing.core.PMatrix3D; +import processing.core.PVector; +import toxi.geom.Vec3D; + /** * * @author Jérémy Laviole - jeremy.laviole@inria.fr */ -public interface DepthCameraDevice { - - public int colorWidth(); - public int colorHeight(); - public int colorSize(); - - public int depthWidth(); - public int depthHeight(); - public int depthSize(); +public abstract class DepthCameraDevice { + + private final PMatrix3D KinectRGBIRCalibration = new PMatrix3D(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + private PMatrix3D KinectRGBIRCalibrationInv = new PMatrix3D(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + + protected final PApplet parent; + protected CameraRGBIRDepth camera; + protected Camera anotherCamera = Camera.INVALID_CAMERA; + + public DepthCameraDevice(PApplet parent) { + this.parent = parent; + } + + public CameraRGBIRDepth getMainCamera() { + return camera; + } + + public Camera getOtherCamera() { + return anotherCamera; + } + + public SubCamera getColorCamera() { + return camera.getColorCamera(); + } + + public SubCamera getIRCamera() { + return camera.getIRCamera(); + } + + public SubDepthCamera getDepthCamera() { + return camera.getDepthCamera(); + } + + abstract public int rawDepthSize(); + + abstract public Camera.Type type(); + + /** + * * + * init a depth camera, depth only as there is another color camera. + */ + protected final void initDefaultCamera() { + String id = Papart.getDefaultDepthCameraConfiguration(parent).getCameraName(); + camera = (CameraRGBIRDepth) CameraFactory.createCamera(type(), id); + camera.setUseDepth(true); + camera.setUseColor(true); + camera.setParent(parent); + } + + public void close() { + camera.close(); + } + + public void setTouch(KinectTouchInput kinectTouchInput) { + camera.getDepthCamera().setTouchInput(kinectTouchInput); + } + + public void setStereoCalibration(String fileName) { + HomographyCalibration calib = new HomographyCalibration(); + calib.loadFrom(parent, fileName); + setStereoCalibration(calib.getHomography()); + } + + public void setStereoCalibration(PMatrix3D matrix) { + KinectRGBIRCalibration.set(matrix); + KinectRGBIRCalibrationInv = KinectRGBIRCalibration.get(); + KinectRGBIRCalibrationInv.invert(); + } + + /** + * Depth to color extrinsics + */ + public PMatrix3D getStereoCalibration() { + return KinectRGBIRCalibration; + } + + /** + * Color to Depth extrinsics + */ + public PMatrix3D getStereoCalibrationInv() { + return KinectRGBIRCalibrationInv; + } + + public int findColorOffset(Vec3D v) { + return findColorOffset(v.x, v.y, v.z); + } + + public int findColorOffset(PVector v) { + return findColorOffset(v.x, v.y, v.z); + } + + private PVector vt = new PVector(); + private PVector vt2 = new PVector(); + + // TODO: this must take into account if we use another camera for tracking. + /** + * Warning not thread safe. + * + * @param x + * @param y + * @param z + * @return + */ + public int findColorOffset(float x, float y, float z) { + vt.set(x, y, z); + vt2.set(0, 0, 0); + // Ideally use a calibration... +// kinectCalibRGB.getExtrinsics().mult(vt, vt2); + getStereoCalibration().mult(vt, vt2); + + // TODO: find a solution for this... + return getColorCamera().getProjectiveDevice().worldToPixel(vt2.x, vt2.y, vt2.z); +// return getColorCamera.getProjectiveDevice().worldToPixel(vt2.x, vt2.y, vt2.z); + } + } diff --git a/papart/src/fr/inria/papart/depthcam/devices/Kinect360.java b/papart/src/fr/inria/papart/depthcam/devices/Kinect360.java index 4b826cc3..8fa56781 100644 --- a/papart/src/fr/inria/papart/depthcam/devices/Kinect360.java +++ b/papart/src/fr/inria/papart/depthcam/devices/Kinect360.java @@ -19,73 +19,53 @@ */ package fr.inria.papart.depthcam.devices; -import fr.inria.papart.multitouch.KinectTouchInput; import fr.inria.papart.procam.Papart; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.camera.CameraFactory; import fr.inria.papart.procam.camera.CameraOpenKinect; +import fr.inria.papart.procam.camera.CameraRGBIRDepth; import processing.core.PApplet; -import processing.core.PMatrix3D; /** * * @author Jeremy Laviole */ -public class Kinect360 extends KinectDevice { +public class Kinect360 extends DepthCameraDevice { - public static final int KINECT_MM = 1; - public static final int KINECT_10BIT = 0; - private final CameraOpenKinect camera; +// public Kinect360(PApplet parent) { +// this.parent = parent; +// camera = (CameraOpenKinect) CameraFactory.createCamera(Camera.Type.OPEN_KINECT, "0"); +// camera.setParent(parent); +// camera.setCalibration(Papart.kinectRGBCalib); +// camera.getDepthCamera().setCalibration(Papart.kinectIRCalib); +// setStereoCalibration(Papart.kinectStereoCalib); +// camera.start(); +// } + public Kinect360(PApplet parent, Camera anotherCamera) { + super(parent); - public static final int CAMERA_WIDTH = 640; - public static final int CAMERA_HEIGHT = 480; - - public Kinect360(PApplet parent) { - initSizes(parent); - camera = (CameraOpenKinect) CameraFactory.createCamera(Camera.Type.OPEN_KINECT, 0); - camera.setParent(parent); - camera.setCalibration(Papart.kinectRGBCalib); + if (anotherCamera instanceof CameraOpenKinect) { + this.camera = (CameraOpenKinect) anotherCamera; + this.anotherCamera = camera.getActingCamera(); + } else { + initDefaultCamera(); + System.out.println("init a default Kinect camera"); + this.anotherCamera = anotherCamera; + } + this.camera.setUseDepth(true); camera.getDepthCamera().setCalibration(Papart.kinectIRCalib); + camera.getColorCamera().setCalibration(Papart.kinectRGBCalib); + setStereoCalibration(Papart.kinectStereoCalib); camera.start(); } - private void initSizes(PApplet parent) { - this.parent = parent; - WIDTH = 640; - HEIGHT = 480; - SIZE = WIDTH * HEIGHT; - RGB_WIDTH = 640; - RGB_HEIGHT = 480; - RGB_SIZE = WIDTH * HEIGHT; - } - - @Override - public Camera getCameraRGB() { - return camera; - } - - @Override - public Camera getCameraIR() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Camera getCameraDepth() { - return camera.getDepthCamera(); - } - @Override public int rawDepthSize() { - return SIZE * 2; - } - - @Override - public void setTouch(KinectTouchInput kinectTouchInput) { - ((CameraOpenKinect) this.getCameraRGB()).setTouch(kinectTouchInput); + return getDepthCamera().width() * getDepthCamera().height() * 2; } @Override - public Type type() { - return Type.X360; + public Camera.Type type() { + return Camera.Type.OPEN_KINECT; } } diff --git a/papart/src/fr/inria/papart/depthcam/devices/KinectDevice.java b/papart/src/fr/inria/papart/depthcam/devices/KinectDevice.java deleted file mode 100644 index 4b6f46ea..00000000 --- a/papart/src/fr/inria/papart/depthcam/devices/KinectDevice.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.depthcam.devices; - -import fr.inria.papart.calibration.HomographyCalibration; -import fr.inria.papart.multitouch.KinectTouchInput; -import fr.inria.papart.procam.HasExtrinsics; -import fr.inria.papart.procam.camera.Camera; -import processing.core.PApplet; -import processing.core.PMatrix3D; -import processing.core.PVector; -import toxi.geom.Vec3D; - -/** - * - * @author Jérémy Laviole - jeremy.laviole@inria.fr - */ -public abstract class KinectDevice implements DepthCameraDevice { - - public enum Type { - ONE, X360, NONE - } - // IR and Depth image size - public static int WIDTH; - public static int HEIGHT; - public static int SIZE; - - // RGB image size - public static int RGB_WIDTH; - public static int RGB_HEIGHT; - public static int RGB_SIZE; - private final PMatrix3D KinectRGBIRCalibration = new PMatrix3D(1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); - private PMatrix3D KinectRGBIRCalibrationInv = new PMatrix3D(1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1); - - protected PApplet parent; - - abstract public Camera getCameraRGB(); - - abstract public Camera getCameraIR(); - - abstract public Camera getCameraDepth(); - - abstract public int rawDepthSize(); - - abstract public Type type(); - - abstract public void setTouch(KinectTouchInput kinectTouchInput); - - public void close() { - getCameraDepth().close(); - getCameraRGB().close(); - } - - public static KinectDevice createKinect360(PApplet parent) { - return new Kinect360(parent); - } - - public static KinectDevice createKinectOne(PApplet parent) { - return new KinectOne(parent); - } - - public void setStereoCalibration(String fileName) { - HomographyCalibration calib = new HomographyCalibration(); - calib.loadFrom(parent, fileName); - setStereoCalibration(calib.getHomography()); - } - - public void setStereoCalibration(PMatrix3D matrix) { - KinectRGBIRCalibration.set(matrix); - KinectRGBIRCalibrationInv = KinectRGBIRCalibration.get(); - KinectRGBIRCalibrationInv.invert(); - } - - /** - * Depth to color extrinsics - */ - public PMatrix3D getStereoCalibration() { - return KinectRGBIRCalibration; - } - - /** - * Color to Depth extrinsics - */ - public PMatrix3D getStereoCalibrationInv() { - return KinectRGBIRCalibrationInv; - } - - public void setExtrinsics(PMatrix3D extr) { - getCameraRGB().setExtrinsics(extr); - - // Get color -> Depth - PMatrix3D stereo = getStereoCalibrationInv(); - PMatrix3D tmp = extr.get(); - tmp.apply(stereo); - getCameraDepth().setExtrinsics(tmp); - } - - public int findColorOffset(Vec3D v) { - return findColorOffset(v.x, v.y, v.z); - } - - public int findColorOffset(PVector v) { - return findColorOffset(v.x, v.y, v.z); - } - - private PVector vt = new PVector(); - private PVector vt2 = new PVector(); - - /** - * Warning not thread safe. - * - * @param x - * @param y - * @param z - * @return - */ - public int findColorOffset(float x, float y, float z) { - vt.set(x, y, z); - vt2.set(0, 0, 0); - // Ideally use a calibration... -// kinectCalibRGB.getExtrinsics().mult(vt, vt2); - getStereoCalibration().mult(vt, vt2); - return getCameraRGB().getProjectiveDevice().worldToPixel(vt2.x, vt2.y, vt2.z); - } - - @Override - public int colorWidth() { - return RGB_WIDTH; - } - - @Override - public int colorHeight() { - return RGB_HEIGHT; - } - - @Override - public int colorSize() { - return RGB_SIZE; - } - - @Override - public int depthWidth() { - return WIDTH; - } - - @Override - public int depthHeight() { - return HEIGHT; - } - - @Override - public int depthSize() { - return SIZE; - } - -} diff --git a/papart/src/fr/inria/papart/depthcam/devices/KinectOne.java b/papart/src/fr/inria/papart/depthcam/devices/KinectOne.java index e588d307..941ca3cd 100644 --- a/papart/src/fr/inria/papart/depthcam/devices/KinectOne.java +++ b/papart/src/fr/inria/papart/depthcam/devices/KinectOne.java @@ -19,118 +19,44 @@ */ package fr.inria.papart.depthcam.devices; -import fr.inria.papart.multitouch.KinectTouchInput; import fr.inria.papart.procam.Papart; import fr.inria.papart.procam.camera.Camera; -import fr.inria.papart.procam.camera.CameraFactory; -import fr.inria.papart.procam.camera.CameraOpenCVDepth; -import fr.inria.papart.procam.camera.CameraOpenKinectDepth; +import fr.inria.papart.procam.camera.CameraOpenKinect2; import processing.core.PApplet; /** * * @author Jeremy Laviole */ -public final class KinectOne extends KinectDevice { - - protected Camera cameraRGB, cameraIR, cameraDepth; - - public KinectOne(PApplet parent) { - - initSize(); - this.parent = parent; - initRGB(); - initIR(); - initDepth(); - +public final class KinectOne extends DepthCameraDevice { + + public KinectOne(PApplet parent, Camera incomingCamera) { + super(parent); + if (incomingCamera instanceof CameraOpenKinect2) { + this.camera = (CameraOpenKinect2) incomingCamera; + this.anotherCamera = camera.getActingCamera(); + } else { + initDefaultCamera(); + this.anotherCamera = incomingCamera; + } + this.camera.setUseDepth(true); + +// getColorCamera().setCalibration(Papart.calibrationFolder + "camera-kinect2-RGB.yaml"); +// getIRCamera().setCalibration(Papart.calibrationFolder + "camera-kinect2-IR.yaml"); + getDepthCamera().setCalibration(Papart.calibrationFolder + "camera-kinect2-IR.yaml"); setStereoCalibration(Papart.kinectStereoCalib); - } - - public KinectOne(PApplet parent, Camera cameraRGB) { - initSize(); - this.parent = parent; - this.cameraRGB = cameraRGB; - initIR(); - initDepth(); - setStereoCalibration(Papart.kinectStereoCalib); - } - - public static final int CAMERA_WIDTH = 512; - public static final int CAMERA_WIDTH_RGB = 1920; - public static final int CAMERA_HEIGHT = 424; - public static final int CAMERA_HEIGHT_RGB = 1080; - - private void initSize() { - // IR and Depth image size - WIDTH = 512; - HEIGHT = 424; - SIZE = WIDTH * HEIGHT; - - // RGB image size - RGB_WIDTH = 1920; - RGB_HEIGHT = 1080; - RGB_SIZE = RGB_WIDTH * RGB_HEIGHT; - } - - public void close() { - cameraRGB.close(); - cameraIR.close(); - cameraDepth.close(); - } - - final void initRGB() { - cameraRGB = CameraFactory.createCamera(Camera.Type.OPENCV, 0); - cameraRGB.setParent(parent); -// cameraRGB.setSize(RGB_WIDTH, RGB_HEIGHT); - cameraRGB.setCalibration(Papart.calibrationFolder + "camera-kinect2-rgb.yaml"); - cameraRGB.start(); - } - - final void initIR() { - cameraIR = CameraFactory.createCamera(Camera.Type.OPENCV, 1); - cameraIR.setParent(parent); -// cameraIR.setSize(WIDTH, HEIGHT); - cameraIR.setCalibration(Papart.calibrationFolder + "camera-kinect2-IR.yaml"); - cameraIR.start(); - } - - final void initDepth() { - cameraDepth = CameraFactory.createCamera(Camera.Type.OPENCV_DEPTH, 2); - cameraDepth.setParent(parent); -// cameraDepth.setSize(WIDTH, HEIGHT); - cameraDepth.setCalibration(Papart.calibrationFolder + "camera-kinect2-IR.yaml"); - ((CameraOpenCVDepth) cameraDepth).setColorCamera(cameraRGB); - - cameraDepth.start(); - } - - @Override - public Camera getCameraRGB() { - return cameraRGB; - } - - public Camera getCameraIR() { - return cameraIR; - } - - public Camera getCameraDepth() { - return cameraDepth; + camera.start(); } @Override public int rawDepthSize() { - return SIZE * 3; - } - - @Override - public void setTouch(KinectTouchInput kinectTouchInput) { - ((CameraOpenCVDepth) cameraDepth).setTouchInput(kinectTouchInput); + return getDepthCamera().width() * getDepthCamera().height() * 2; } @Override - public Type type() { - return Type.ONE; + public Camera.Type type() { + return Camera.Type.OPEN_KINECT_2; } } diff --git a/papart/src/fr/inria/papart/depthcam/devices/KinectPointCloud.java b/papart/src/fr/inria/papart/depthcam/devices/KinectPointCloud.java index e03337ec..3275c29c 100755 --- a/papart/src/fr/inria/papart/depthcam/devices/KinectPointCloud.java +++ b/papart/src/fr/inria/papart/depthcam/devices/KinectPointCloud.java @@ -36,12 +36,18 @@ */ public class KinectPointCloud extends PointCloud implements PConstants { + private KinectDepthAnalysis depthAnalysis; + private int precision = 1; + public KinectPointCloud(PApplet parent, KinectDepthAnalysis depthAnalysis, int skip) { super(parent, depthAnalysis.getDepthSize() / (skip * skip)); + this.depthAnalysis = depthAnalysis; + precision = skip; } public KinectPointCloud(PApplet parent, KinectDepthAnalysis depthAnalysis) { this(parent, depthAnalysis, 1); + this.depthAnalysis = depthAnalysis; } public void updateWith(KinectProcessing kinect) { @@ -52,26 +58,34 @@ public void updateWith(KinectProcessing kinect) { nbVertices = 0; nbColors = 0; - int k = 0; - for (int i = 0; i < kinect.getDepthSize(); i++) { +// for (int i = 0; i < kinect.getDepthSize(); i++) { + + int k = 0; // k is the 3D point cloud memory. + for (int y = 0; y < depthAnalysis.getDepthHeight(); y += precision) { + for (int x = 0; x < depthAnalysis.getDepthWidth(); x += precision) { - if (valid[i]) { - Vec3D p = points[i]; - int c = colorsImg.pixels[i]; + int i = x + y * depthAnalysis.getDepthWidth(); + + if (valid[i]) { + Vec3D p = points[i]; + int c = colorsImg.pixels[i]; - verticesJava[k++] = p.x; - verticesJava[k++] = p.y; - verticesJava[k++] = -p.z; - verticesJava[k++] = 1; + verticesJava[k++] = p.x; + verticesJava[k++] = p.y; + verticesJava[k++] = -p.z; + verticesJava[k++] = 1; - int c2 = javaToNativeARGB(c); + int c2 = javaToNativeARGB(c); - nbVertices++; + nbVertices++; + + colorsJava[nbColors++] = c2; + // Think about dividing the color intensity by 255 in the shader... + } - colorsJava[nbColors++] = c2; - // Think about dividing the color intensity by 255 in the shader... } } + verticesNative.rewind(); verticesNative.put(verticesJava, 0, nbVertices * 4); diff --git a/papart/src/fr/inria/papart/depthcam/devices/RealSense.java b/papart/src/fr/inria/papart/depthcam/devices/RealSense.java new file mode 100644 index 00000000..935caa76 --- /dev/null +++ b/papart/src/fr/inria/papart/depthcam/devices/RealSense.java @@ -0,0 +1,73 @@ +/* + * Part of the PapARt project - https://project.inria.fr/papart/ + * + * Copyright (C) 2016 Jérémy Laviole + * Copyright (C) 2014-2016 Inria + * Copyright (C) 2011-2013 Bordeaux University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; If not, see + * . + */ +package fr.inria.papart.depthcam.devices; + +import fr.inria.papart.procam.camera.Camera; +import fr.inria.papart.procam.camera.CameraRealSense; +import processing.core.PApplet; + +/** + * + * @author Jeremy Laviole + */ +public final class RealSense extends DepthCameraDevice { + + private final CameraRealSense cameraRS; + + public RealSense(PApplet parent, Camera anotherCam) { + super(parent); + + if (anotherCam instanceof CameraRealSense) { + this.camera = (CameraRealSense) anotherCam; + this.camera.setUseDepth(true); + } else { + initDefaultCamera(); + this.anotherCamera = anotherCam; + } + + if (this.anotherCamera == null) { + this.anotherCamera = getColorCamera(); + } + + cameraRS = (CameraRealSense) camera; +// setStereoCalibration(Papart.kinectStereoCalib); + setStereoCalibration(cameraRS.getHardwareExtrinsics()); + + // TODO: Hacks to try to handle the SR300 distorsions +// camera.getDepthCamera().setCalibration(Papart.SR300IRCalib); +// camera.getIRCamera().setCalibration(Papart.SR300IRCalib); + } + + public CameraRealSense getMainCamera() { + return cameraRS; + } + + @Override + public int rawDepthSize() { + return getDepthCamera().width() * getDepthCamera().height() * 2; + } + + @Override + public Camera.Type type() { + return Camera.Type.REALSENSE; + } + +} diff --git a/papart/src/fr/inria/papart/graph/Displayable.java b/papart/src/fr/inria/papart/graph/Displayable.java deleted file mode 100755 index 9be300f8..00000000 --- a/papart/src/fr/inria/papart/graph/Displayable.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.graph; - -import processing.core.PApplet; -import processing.core.PImage; - -/** - * - * @author Jeremy Laviole - */ -public interface Displayable { - - public abstract void prepareToDisplayOn(PApplet display); - - public abstract boolean canBeDisplayedOn(PApplet display); - - public abstract PImage getDisplayedOn(PApplet display); - -} diff --git a/papart/src/fr/inria/papart/graph/Node.java b/papart/src/fr/inria/papart/graph/Node.java deleted file mode 100755 index 3cc9fe76..00000000 --- a/papart/src/fr/inria/papart/graph/Node.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.graph; - -import java.util.ArrayList; -import java.util.Collection; -import processing.core.PMatrix3D; - -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -/** - * - * @author Jeremy Laviole - */ -public abstract class Node { - - private Node root; - private final ArrayList children = new ArrayList(); - private Node parent; - private final PMatrix3D transform = new PMatrix3D(); - - public Node getRoot() { - return root; - } - - public Node getParent() { - return this.parent; - } - - public boolean isRoot() { - return this == root; - } - - protected void updateRootOf(Node n) { - n.root = this.root; - } - - public void setRoot(){ - this.root = this; - } - - /** - * - * @return all the children - */ - public Collection getChildren() { - return children; - } - - /** - * - * @param child to add - */ - public void addChild(Node child) { - children.add(child); - updateRootOf(child); - } - - public void setTransform(PMatrix3D mat) { - this.transform.set(mat); - } - - public PMatrix3D getTransform() { - return this.transform.get(); - } - - public PMatrix3D getAbsoluteTrasform() { - Node currentNode = this; - PMatrix3D currentMat = new PMatrix3D(); - currentMat.set(this.transform); - - while (!currentNode.isRoot()) { - currentNode = currentNode.getParent(); - currentMat.apply(currentNode.transform); - } - - return currentMat; - } - -} diff --git a/papart/src/fr/inria/papart/graph/NodeTransform.java b/papart/src/fr/inria/papart/graph/NodeTransform.java deleted file mode 100755 index 2474ff3e..00000000 --- a/papart/src/fr/inria/papart/graph/NodeTransform.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.graph; - -import processing.core.PMatrix3D; - -/** - * - * @author Jeremy Laviole - */ -public class NodeTransform extends Node{ - - -} diff --git a/papart/src/fr/inria/papart/multitouch/KinectTouchInput.java b/papart/src/fr/inria/papart/multitouch/KinectTouchInput.java index d506c80d..a12ac655 100755 --- a/papart/src/fr/inria/papart/multitouch/KinectTouchInput.java +++ b/papart/src/fr/inria/papart/multitouch/KinectTouchInput.java @@ -30,7 +30,7 @@ import fr.inria.papart.depthcam.analysis.DepthAnalysis; import fr.inria.papart.calibration.PlaneAndProjectionCalibration; import fr.inria.papart.depthcam.analysis.KinectDepthAnalysis; -import fr.inria.papart.depthcam.devices.KinectDevice; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.procam.display.BaseDisplay; import fr.inria.papart.procam.ProjectiveDeviceP; import fr.inria.papart.procam.camera.CameraOpenKinect; @@ -62,57 +62,80 @@ public class KinectTouchInput extends TouchInput { private final Semaphore depthDataSem = new Semaphore(1); // List of TouchPoints, given to the user - private final KinectDevice kinectDevice; + private final DepthCameraDevice kinectDevice; private PlaneAndProjectionCalibration planeAndProjCalibration; // List of TouchPoints, given to the user private final ArrayList touchPoints2D = new ArrayList<>(); private final ArrayList touchPoints3D = new ArrayList<>(); - private final TouchDetectionSimple2D touchDetection2D; - private final TouchDetectionSimple3D touchDetection3D; + private TouchDetectionSimple2D touchDetection2D; + private TouchDetectionSimple3D touchDetection3D; + + private PlanarTouchCalibration touchCalib2D; + private PlanarTouchCalibration touchCalib3D; public KinectTouchInput(PApplet applet, - KinectDevice kinectDevice, + DepthCameraDevice kinectDevice, KinectDepthAnalysis depthAnalysis, PlaneAndProjectionCalibration calibration) { this.parent = applet; this.depthAnalysis = depthAnalysis; this.kinectDevice = kinectDevice; this.planeAndProjCalibration = calibration; - this.touchDetection2D = new TouchDetectionSimple2D(depthAnalysis.getDepthSize()); - this.touchDetection3D = new TouchDetectionSimple3D(depthAnalysis.getDepthSize()); } - - public void setPlaneAndProjCalibration(PlaneAndProjectionCalibration papc){ + + public void setPlaneAndProjCalibration(PlaneAndProjectionCalibration papc) { this.planeAndProjCalibration = papc; } public void setTouchDetectionCalibration(PlanarTouchCalibration touchCalib) { - this.touchDetection2D.setCalibration(touchCalib); + touchCalib2D = touchCalib; } public void setTouchDetectionCalibration3D(PlanarTouchCalibration touchCalib) { - this.touchDetection3D.setCalibration(touchCalib); +// this.touchDetection3D.setCalibration(touchCalib); + touchCalib3D = touchCalib; } @Override public void update() { try { - - IplImage depthImage = kinectDevice.getCameraDepth().getIplImage(); - IplImage colImage = kinectDevice.getCameraRGB().getIplImage(); + IplImage depthImage; + IplImage colImage = null; - depthDataSem.acquire(); - if (colImage == null || depthImage == null) { - System.out.println("No Image."); + // TODO: to only once ? + if (kinectDevice.getMainCamera().isUseColor()) { + colImage = kinectDevice.getColorCamera().getIplImage(); + } + if (kinectDevice.getMainCamera().isUseIR()) { + colImage = kinectDevice.getIRCamera().getIplImage(); + } + + depthImage = kinectDevice.getDepthCamera().getIplImage(); + + if (depthImage == null) { +// System.out.println("No Image. " + colImage + " " + depthImage); return; } + depthDataSem.acquire(); + + // Allocate the data when everything else is ready. + // TODO: all the time ?... + if (touchDetection2D == null) { + int depthSize = kinectDevice.getDepthCamera().width() * kinectDevice.getDepthCamera().height(); + touchDetection2D = new TouchDetectionSimple2D(depthSize); + touchDetection3D = new TouchDetectionSimple3D(depthSize); + + touchDetection2D.setCalibration(touchCalib2D); + touchDetection3D.setCalibration(touchCalib3D); + depthAnalysis.updateCalibrations(kinectDevice); + } + touch2DPrecision = touchDetection2D.getPrecision(); touch3DPrecision = touchDetection3D.getPrecision(); if (touch2DPrecision > 0 && touch3DPrecision > 0) { - depthAnalysis.updateMT(depthImage, colImage, planeAndProjCalibration, touch2DPrecision, touch3DPrecision); findAndTrack2D(); findAndTrack3D(); @@ -250,9 +273,8 @@ public ArrayList getDepthData() { return null; } } - + // TODO: Do the same without the Display, use the extrinsics instead!  - // TODO: Do the same with DepthDataElement instead of DepthPoint ? public ArrayList projectDepthData(ARDisplay display, Screen screen) { ArrayList list = projectDepthData2D(display, screen); @@ -324,6 +346,7 @@ public PVector projectPointToScreen(Screen screen, return out; } + // PaperScreen coordinates as computed here. private PVector projectPointToScreen(Screen screen, BaseDisplay display, Vec3D pKinect, Vec3D pNorm) { @@ -336,9 +359,18 @@ private PVector projectPointToScreen(Screen screen, // paperScreenCoord = project(screen, display, // p.x / (float) pdp.getWidth(), // p.y / (float) pdp.getHeight()); + // This works well in the best of worlds, where the depth information is + // reliable. paperScreenCoord = new PVector(); PVector pKinectP = new PVector(pKinect.x, pKinect.y, pKinect.z); + // maybe not here... + // TODO: maybe a better way to this, or to tweak the magic numbers. +// // yOffset difference ? 1cm -> surface view. +// // zOffset difference ? 1cm -> surface view. + pKinectP.y -= 10; + pKinectP.z += 10; + // TODO: Here change the display.getCamera() to // another way to get the screen location... PMatrix3D transfo = screen.getLocation(display.getCamera()); @@ -347,7 +379,29 @@ private PVector projectPointToScreen(Screen screen, // TODO: check bounds too ?! } else { - paperScreenCoord = project(screen, display, + +// // other possib, we know the 3D Point -> screen transfo... +// PMatrix3D kinectExtrinsics = kinectDevice.getDepthCamera().getExtrinsics().get(); +// kinectExtrinsics.invert(); +// PMatrix3D paperLocation = screen.getLocation(display.getCamera()).get(); +// paperLocation.invert(); +// Vec3D depthPoint = pKinect; +// PVector pointPosExtr = new PVector(); +// PVector pointPosDisplay = new PVector(); +// kinectExtrinsics.mult(new PVector(depthPoint.x, +// depthPoint.y, +// depthPoint.z), +// pointPosExtr); +// paperLocation.mult(pointPosExtr, +// pointPosDisplay); +// System.out.println("new: " + pointPosDisplay); +// return pointPosDisplay; + // Not ready yet... + +// This is not working with raw Depth, because the coordinates + // of pNorm is not in display Space, but in a custom space + // defined for the touch surface... + paperScreenCoord = display.project(screen, pNorm.x, pNorm.y); @@ -383,13 +437,25 @@ public void getTouchColors(IplImage colorImage, } ByteBuffer cBuff = colorImage.getByteBuffer(); - for (TouchPoint tp : touchPointList) { - int offset = 3 * depthAnalysis.kinectDevice().findColorOffset(tp.getPositionKinect()); - - tp.setColor((255 & 0xFF) << 24 - | (cBuff.get(offset + 2) & 0xFF) << 16 - | (cBuff.get(offset + 1) & 0xFF) << 8 - | (cBuff.get(offset) & 0xFF)); + if (colorImage.nChannels() == 1) { + for (TouchPoint tp : touchPointList) { + int offset = depthAnalysis.getDepthCameraDevice().findColorOffset(tp.getPositionKinect()); + int c = cBuff.get(offset); + tp.setColor((255 & 0xFF) << 24 + | (c & 0xFF) << 16 + | (c & 0xFF) << 8 + | (c & 0xFF)); + } + } + if (colorImage.nChannels() == 3) { + for (TouchPoint tp : touchPointList) { + int offset = 3 * depthAnalysis.getDepthCameraDevice().findColorOffset(tp.getPositionKinect()); + + tp.setColor((255 & 0xFF) << 24 + | (cBuff.get(offset + 2) & 0xFF) << 16 + | (cBuff.get(offset + 1) & 0xFF) << 8 + | (cBuff.get(offset) & 0xFF)); + } } } diff --git a/papart/src/fr/inria/papart/multitouch/SkatoloLink.java b/papart/src/fr/inria/papart/multitouch/SkatoloLink.java index cd5ec6fd..8a21f52b 100644 --- a/papart/src/fr/inria/papart/multitouch/SkatoloLink.java +++ b/papart/src/fr/inria/papart/multitouch/SkatoloLink.java @@ -1,6 +1,7 @@ /* * Part of the PapARt project - https://project.inria.fr/papart/ * + * Copyright (C) 2016 RealityTech * Copyright (C) 2014-2016 Inria * Copyright (C) 2011-2013 Bordeaux University * @@ -19,28 +20,52 @@ */ package fr.inria.papart.multitouch; +import fr.inria.papart.procam.Papart; +import fr.inria.papart.procam.PaperScreen; +import fr.inria.papart.procam.PaperTouchScreen; import fr.inria.skatolo.Skatolo; import fr.inria.skatolo.gui.Pointer; import java.util.ArrayList; import java.util.HashMap; +import processing.core.PApplet; import processing.core.PVector; /** * - * @author Jérémy Laviole - jeremy.laviole@inria.fr + * @author Jérémy Laviole */ public class SkatoloLink { public static HashMap> pointersMap = new HashMap(); + // Warning -> Must be linked to a physical screen // a Renderer. + // Warning -> the mouse must be "displayed" ... + + public static Touch mouseTouch = new Touch(); + + public static void addMouseTo(TouchList touchList, Skatolo skatolo, PaperScreen paperScreen) { + PApplet applet = Papart.getPapart().getApplet(); + + float normX = (float) applet.mouseX / (float) applet.width; + float normY = (float) applet.mouseY / (float) applet.height; +// PVector pointer = paperScreen.getDisplay().projectPointer(paperScreen.getScreen(), normX, normY); + PVector pointer = paperScreen.getDisplay().project(paperScreen.getScreen(), normX, normY); + + System.out.println("Pointer: " + pointer); + + mouseTouch.setPosition(pointer.x * paperScreen.getDrawingSize().x, + pointer.y * paperScreen.getDrawingSize().y, 0); + touchList.add(mouseTouch); + } + public static void updateTouch(TouchList touchList, Skatolo skatolo) { // TODO: Full integration ! // TODO: use the pointerList ? ArrayList pointers; - if(pointersMap.containsKey(skatolo)){ + if (pointersMap.containsKey(skatolo)) { pointers = pointersMap.get(skatolo); - }else { + } else { pointers = new ArrayList<>(); pointersMap.put(skatolo, pointers); } diff --git a/papart/src/fr/inria/papart/multitouch/TUIOTouchInput.java b/papart/src/fr/inria/papart/multitouch/TUIOTouchInput.java index 8b003049..3a86f99b 100755 --- a/papart/src/fr/inria/papart/multitouch/TUIOTouchInput.java +++ b/papart/src/fr/inria/papart/multitouch/TUIOTouchInput.java @@ -78,7 +78,7 @@ private Touch getCursor(Screen screen, BaseDisplay display, TuioCursor tcur) thr Touch touch = touchPoint.getTouch(); TuioPoint tuioPoint = tcur.getPosition(); - PVector v = project(screen, display, tuioPoint.getX(), tuioPoint.getY()); + PVector v = display.project(screen, tuioPoint.getX(), tuioPoint.getY()); touch.setPosition(v); return touch; } @@ -89,7 +89,7 @@ private Touch getObject(Screen screen, BaseDisplay display, TuioObject tobj) thr Touch touch = tp.getTouch(); TuioPoint tuioPoint = tobj.getPosition(); - PVector v = project(screen, display, tuioPoint.getX(), tuioPoint.getY()); + PVector v = display.project(screen, tuioPoint.getX(), tuioPoint.getY()); touch.setPosition(v); // // TODO: implement this ? diff --git a/papart/src/fr/inria/papart/multitouch/TouchDetection.java b/papart/src/fr/inria/papart/multitouch/TouchDetection.java index 2113fd77..d1d884e6 100755 --- a/papart/src/fr/inria/papart/multitouch/TouchDetection.java +++ b/papart/src/fr/inria/papart/multitouch/TouchDetection.java @@ -67,6 +67,7 @@ public TouchDetection(int size) { public abstract ArrayList compute(KinectDepthData dData); protected void allocateMemory(int size) { + System.out.println("Allocating touch memory: " + size); assignedPoints = new boolean[size]; connectedComponentImage = new byte[size]; this.calib = new PlanarTouchCalibration(); diff --git a/papart/src/fr/inria/papart/multitouch/TouchInput.java b/papart/src/fr/inria/papart/multitouch/TouchInput.java index 6bd6b598..aefa1f2a 100755 --- a/papart/src/fr/inria/papart/multitouch/TouchInput.java +++ b/papart/src/fr/inria/papart/multitouch/TouchInput.java @@ -39,24 +39,6 @@ public abstract class TouchInput { abstract public TouchList projectTouchToScreen(Screen screen, BaseDisplay display); - public PVector project(Screen screen, BaseDisplay display, float x, float y) { - boolean isProjector = display instanceof ProjectorDisplay; - boolean isARDisplay = display instanceof ARDisplay; - - // check that the correct method is called ! - PVector paperScreenCoord; - if (isProjector) { - paperScreenCoord = ((ProjectorDisplay) display).projectPointer(screen, x, y); - } else { - if (isARDisplay) { - paperScreenCoord = ((ARDisplay) display).projectPointer(screen, x, y); - } else { - paperScreenCoord = display.projectPointer(screen, x, y); - } - } - return paperScreenCoord; - } - protected boolean computeOutsiders = false; public void computeOutsiders(boolean outsiders) { diff --git a/papart/src/fr/inria/papart/panel/PGraphicsOpenGLExtension.java b/papart/src/fr/inria/papart/panel/PGraphicsOpenGLExtension.java deleted file mode 100755 index cfcbb351..00000000 --- a/papart/src/fr/inria/papart/panel/PGraphicsOpenGLExtension.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.panel; - -import processing.opengl.PGL; -import processing.opengl.PGraphicsOpenGL; - -/** - * - * @author Jeremy Laviole - */ -public class PGraphicsOpenGLExtension extends PGraphicsOpenGL { - - public static PGraphicsOpenGL mainContext; - - public PGraphicsOpenGLExtension() { - super(); - this.pgl = mainContext.pgl; - -// inGeo = newInGeometry(this, IMMEDIATE); -// tessGeo = newTessGeometry(this, IMMEDIATE); -// texCache = newTexCache(this); -// -// initialized = false; - } - -} diff --git a/papart/src/fr/inria/papart/panel/Panel.java b/papart/src/fr/inria/papart/panel/Panel.java deleted file mode 100755 index 373c96ee..00000000 --- a/papart/src/fr/inria/papart/panel/Panel.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.panel; - -import fr.inria.papart.depthcam.analysis.DepthAnalysis; -import fr.inria.papart.procam.Papart; -import fr.inria.papart.procam.camera.Camera; -import fr.inria.papart.procam.camera.CameraOpenKinect; -import javax.swing.JFrame; -import processing.core.PApplet; -import processing.core.PImage; -import processing.opengl.PGraphicsOpenGL; - -/** - * TEST CODE. - * @author Jeremy Laviole - */ -public class Panel { - - SecondApplet secondApplet; - int w, h; - - PGraphicsOpenGL mainGL; - - public Panel(PApplet parent) { - - this.w = 800; - this.h = 600; - PFrame f = new PFrame(800, 600); - -// parent.frame.setTitle("first window"); -// f.setTitle("second window"); - } - - /** - * Broken WITH PROCESSING 3 - */ - public class PFrame extends JFrame { - - public PFrame(int width, int height) { - setBounds(100, 100, width, height); - secondApplet = new SecondApplet(); -// add(secondApplet); -// secondApplet.init(); - this.setVisible(true); - } - } - - public class SecondApplet extends PApplet { - - PImage localImage, localImage2; - - public void setup() { -// size(800, 600, "fr.inria.papart.panel.PGraphicsOpenGLExtension"); - size(800, 600, OPENGL); - } - - public void drawKinectRGB() { - try { - if (Papart.getPapart() != null - && Papart.getPapart().getKinectCamera() != null) { - - Camera kinectRGB = Papart.getPapart().getKinectCamera(); -// if (!kinectRGB.canBeDisplayedOn(this)) { -// kinectRGB.prepareToDisplayOn(this); -// } -// -// PImage img = kinectRGB.getDisplayedOn(this); -// image(img, 0, 0, 320, 240); - } - } catch (Exception e) { - } - } - - public void draw() { - background(100, random(50) + 50, 100); - println("draw in second.."); - -// DepthAnalysis kinect = Papart.getPapart().getKinect(); - - // Camera OK ! -// try { -// if (Papart.getPapart() != null -// && Papart.getPapart().getCameraTracking() != null -// && Papart.getPapart().getCameraTracking().getImage() != null) { -// -// println("Image ready.."); -// -// if (localImage == null) { -// localImage = Papart.getPapart().getCameraTracking().getPImageCopy(this); -// } else { -// Papart.getPapart().getCameraTracking().getPImageCopyTo(localImage); -// } -// image(localImage, 0, 0, 200, 200); -// } -// } catch (Exception e) { -// System.out.println("Exception " + e); -// e.printStackTrace(); -// } - // Base Display OK ! -// try { -// if (Papart.getPapart() != null -// && Papart.getPapart().getDisplay() != null -// && Papart.getPapart().getDisplay().getGraphics() != null) { -// -// println("Image ready.."); -// -// PImage sourceImage = Papart.getPapart().getDisplay().graphics; -// if (localImage2 == null) { -// println("create local image.."); -// localImage2 = createImage(sourceImage.width, sourceImage.height, sourceImage.format); -// } -// println("Get px copy.."); -//// int[] pxCopy = Papart.getPapart().getDisplay().getPixelsCopy(); -// int[] pxCopy = Papart.getPapart().getDisplay().pxCopy; -// if(pxCopy == null) -// return; -// -// // get a copy before ? -//// sourceImage = sourceImage.get(); -//// sourceImage.loadPixels(); -// localImage2.loadPixels(); -// println("Copy pixels.."); -// System.arraycopy(pxCopy, 0, localImage2.pixels, 0, pxCopy.length); -// println("Draw pixels.."); -// image(localImage2, 0, 200, 200, 200); -// } -// } catch (Exception e) { -// System.out.println("Exception " + e); -// e.printStackTrace(); -// } - } - - } - -} diff --git a/papart/src/fr/inria/papart/panel/SketchTest.java b/papart/src/fr/inria/papart/panel/SketchTest.java deleted file mode 100755 index bfc0f929..00000000 --- a/papart/src/fr/inria/papart/panel/SketchTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.panel; - -import processing.core.PApplet; -import processing.opengl.*; - -/** - * TEST CODE - * @author Jeremy Laviole - */ -public class SketchTest extends PApplet { - - @Override - public void setup() { - size(200, 200); - stroke(155, 0, 0); - } - - @Override - public void draw() { - background(0); - line(mouseX, mouseY, width / 2, height / 2); - } - - public static void main(String args[]) { -// PApplet.main(new String[]{"--present", "fr.inria.papart.panel.SketchTest"}); - PApplet.main(new String[]{"fr.inria.papart.panel.SketchTest"}); - } - -} diff --git a/papart/src/fr/inria/papart/procam/ColorDetection.java b/papart/src/fr/inria/papart/procam/ColorDetection.java index d151775c..f1c5c6ce 100755 --- a/papart/src/fr/inria/papart/procam/ColorDetection.java +++ b/papart/src/fr/inria/papart/procam/ColorDetection.java @@ -19,6 +19,8 @@ */ package fr.inria.papart.procam; +import fr.inria.papart.utils.MathUtils; +import fr.inria.papart.utils.ARToolkitPlusUtils; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.camera.TrackedView; import processing.core.PApplet; @@ -54,25 +56,21 @@ public ColorDetection(PaperScreen paperScreen) { } public void initialize() { - boardView = new TrackedView(paperScreen); - setPosition(pos); boardView.setCaptureSizeMM(captureSize); boardView.setImageWidthPx(picWidth); boardView.setImageHeightPx(picHeight); boardView.init(); - } public void setPosition(PVector pos) { this.pos.set(pos); - if (boardView != null) { if (invY) { boardView.setBottomLeftCorner(new PVector(pos.x, paperScreen.drawingSize.y - pos.y)); } else { - boardView.setBottomLeftCorner(pos); + boardView.setBottomLeftCorner(new PVector(pos.x, pos.y)); } } } @@ -84,13 +82,23 @@ public void update() { public void drawSelf() { computeColor(); + drawCaptureZone(); + paperScreen.pushMatrix(); paperScreen.translate(pos.x, pos.y, 1); - drawCaptureZonePriv(); - drawCapturedColor(); + if (!invY) { +// paperScreen.translate(0, captureSize.y, 0); + } + +// drawCaptureZonePriv(); + paperScreen.translate(captureSize.x + 20, 0); drawCapturedImage(); + + paperScreen.translate(20, 0); + drawCapturedColor(); + paperScreen.popMatrix(); } @@ -101,14 +109,14 @@ public PVector getPosition() { public void drawCapturedImage() { PImage out = getImage(); if (out != null) { - paperScreen.image(out, 0, -picHeight - 5, picWidth, picHeight); + paperScreen.image(out, 0, 0, captureSize.x, captureSize.y); } } public void drawCapturedColor() { paperScreen.fill(this.col); paperScreen.noStroke(); - paperScreen.ellipse(0, -picWidth - 5, picHeight, picHeight); + paperScreen.ellipse(0, 0, 10, 10); } public void drawCaptureZonePriv() { @@ -122,12 +130,18 @@ public void drawCaptureZonePriv() { public void drawCaptureZone() { paperScreen.pushMatrix(); paperScreen.translate(pos.x, - pos.y, 1); + pos.y, + 0.2f); + + if (!invY) { + paperScreen.translate(0, captureSize.y, 0); + } + paperScreen.strokeWeight(2); paperScreen.noFill(); paperScreen.stroke(80); paperScreen.rectMode(PApplet.CORNER); - paperScreen.rect(0, 0, captureSize.x, captureSize.y); + paperScreen.rect(0, -captureSize.y, captureSize.x, captureSize.y); paperScreen.popMatrix(); } @@ -188,7 +202,7 @@ public int computeOccurencesOfColor(int c, int threshold) { for (int k = 0; k < pxNb; k++) { int c2 = out.pixels[k]; - boolean isClose = Utils.colorDist(c, c2, threshold); + boolean isClose = MathUtils.colorDistRGB(c, c2, threshold); if (isClose) { nbSameColor++; } @@ -208,23 +222,38 @@ public void setCaptureOffset(PVector captureOffset) { this.captureOffset = captureOffset; } + public void setCaptureOffset(float x, float y) { + this.captureOffset.set(x, y); + } + public PVector getCaptureSize() { return captureSize.copy(); } /** - * Set the capture size in millimeters. + * Set the capture size in millimeters. + * * @param x - * @param y + * @param y */ public void setCaptureSize(float x, float y) { this.captureSize.set(x, y); } + /** + * Set the capture size in millimeters. + * + * @param size in mm. + */ + public void setCaptureSize(PVector size) { + setCaptureSize(size.x, size.y); + } + /** * Set the picture size for analysis in pixels. + * * @param picWidth - * @param picHeight + * @param picHeight */ public void setPicSize(int picWidth, int picHeight) { this.picWidth = picWidth; diff --git a/papart/src/fr/inria/papart/procam/Papart.java b/papart/src/fr/inria/papart/procam/Papart.java index 9d472858..587a6da8 100755 --- a/papart/src/fr/inria/papart/procam/Papart.java +++ b/papart/src/fr/inria/papart/procam/Papart.java @@ -34,15 +34,24 @@ import fr.inria.papart.calibration.ScreenConfiguration; import fr.inria.papart.depthcam.devices.Kinect360; import fr.inria.papart.depthcam.analysis.KinectDepthAnalysis; -import fr.inria.papart.depthcam.devices.KinectDevice; +import fr.inria.papart.depthcam.devices.DepthCameraDevice; import fr.inria.papart.depthcam.devices.KinectOne; +import fr.inria.papart.depthcam.devices.RealSense; import fr.inria.papart.multitouch.TouchInput; import fr.inria.papart.multitouch.TUIOTouchInput; import fr.inria.papart.multitouch.KinectTouchInput; +import fr.inria.papart.utils.LibraryUtils; import fr.inria.papart.procam.camera.CameraFactory; +import fr.inria.papart.procam.camera.CameraOpenKinect; +import fr.inria.papart.procam.camera.CameraRGBIRDepth; +import fr.inria.papart.procam.camera.CameraRealSense; +import fr.inria.papart.procam.camera.SubCamera; import java.io.File; import java.lang.reflect.Constructor; import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bytedeco.javacv.CameraDevice; import org.reflections.Reflections; import processing.core.PApplet; import processing.core.PFont; @@ -56,11 +65,13 @@ */ public class Papart { - public final static String folder = fr.inria.papart.procam.Utils.getPapartFolder() + "/data/"; + public final static String folder = LibraryUtils.getPapartFolder() + "/data/"; public final static String calibrationFolder = folder + "calibration/"; public final static String markerFolder = folder + "markers/"; - public static String calibrationFileName = "big-calib.svg"; + public static boolean isInria = false; + public static boolean isReality= true; + public static String calibrationFileName = "A4-calib.svg"; public static String cameraCalibName = "camera.yaml"; public static String projectorCalibName = "projector.yaml"; @@ -70,6 +81,7 @@ public class Papart { public static String camCalibARtoolkit = calibrationFolder + "camera-projector.cal"; public static String kinectIRCalib = calibrationFolder + "calibration-kinect-IR.yaml"; + public static String SR300IRCalib = calibrationFolder + "calibration-SR300-IR.yaml"; public static String kinectRGBCalib = calibrationFolder + "calibration-kinect-RGB.yaml"; public static String kinectStereoCalib = calibrationFolder + "calibration-kinect-Stereo.xml"; @@ -78,7 +90,7 @@ public class Papart { public static String screenConfig = calibrationFolder + "screenConfiguration.xml"; public static String cameraConfig = calibrationFolder + "cameraConfiguration.xml"; - public static String cameraKinectConfig = calibrationFolder + "cameraKinectConfiguration.xml"; + public static String depthCameraConfig = calibrationFolder + "depthCameraConfiguration.xml"; public static String tablePosition = calibrationFolder + "tablePosition.xml"; public static String planeCalib = calibrationFolder + "PlaneCalibration.xml"; @@ -86,7 +98,6 @@ public class Papart { public static String planeAndProjectionCalib = calibrationFolder + "PlaneProjectionCalibration.xml"; public static String touchCalib = calibrationFolder + "Touch2DCalibration.xml"; public static String touchCalib3D = calibrationFolder + "Touch3DCalibration.xml"; - public static String defaultFont = folder + "Font/" + "GentiumBookBasic-48.vlw"; public int defaultFontSize = 12; protected static Papart singleton = null; @@ -112,16 +123,9 @@ public class Papart { private PVector frameSize = new PVector(); private boolean isWithoutCamera = false; - public KinectDevice kinectDevice; + public DepthCameraDevice depthCameraDevice; - public CameraConfiguration cameraConfiguration; - public ScreenConfiguration screenConfiguration; // TODO: find what to do with these... -// private final int depthFormat = freenect.FREENECT_DEPTH_10BIT; -// private final int kinectFormat = Kinect.KINECT_10BIT; - private final int depthFormat = freenect.FREENECT_DEPTH_MM; - private final int kinectFormat = Kinect360.KINECT_MM; - /** * Create the main PapARt object, look at the examples for how to use it. * @@ -133,15 +137,11 @@ public Papart(Object applet) { this.touchInitialized = false; this.applet = (PApplet) applet; - cameraConfiguration = getDefaultCameraConfiguration(this.applet); - screenConfiguration = getDefaultScreenConfiguration(this.applet); - this.appletClass = applet.getClass(); - PFont font = this.applet.loadFont(defaultFont); // TODO: singleton -> Better implementation. if (Papart.singleton == null) { Papart.singleton = this; - fr.inria.papart.drawingapp.DrawUtils.applet = (PApplet) applet; + fr.inria.papart.utils.DrawUtils.applet = (PApplet) applet; } } @@ -151,9 +151,9 @@ public static CameraConfiguration getDefaultCameraConfiguration(PApplet applet) return config; } - public static CameraConfiguration getDefaultKinectConfiguration(PApplet applet) { + public static CameraConfiguration getDefaultDepthCameraConfiguration(PApplet applet) { CameraConfiguration config = new CameraConfiguration(); - config.loadFrom(applet, cameraKinectConfig); + config.loadFrom(applet, depthCameraConfig); return config; } @@ -165,9 +165,9 @@ public static ScreenConfiguration getDefaultScreenConfiguration(PApplet applet) private CalibrationPopup calibrationPopup = null; - public void calibration() { + public void calibration(PaperScreen screen) { if (calibrationPopup == null) { - calibrationPopup = new CalibrationPopup(); + calibrationPopup = new CalibrationPopup(screen); } else if (calibrationPopup.isHidden()) { calibrationPopup.show(); } else { @@ -204,7 +204,15 @@ public static Papart projection(PApplet applet, float quality) { papart.shouldSetWindowLocation = true; papart.shouldSetWindowSize = true; papart.registerPost(); - papart.initProjectorCamera(quality); + + papart.initProjectorDisplay(quality); + papart.initCamera(); + + papart.tryLoadExtrinsics(); + papart.projector.setCamera(papart.getPublicCameraTracking()); + + papart.checkInitialization(); + papart.registerKey(); return papart; @@ -252,22 +260,24 @@ public static Papart seeThrough(PApplet applet) { */ public static Papart seeThrough(PApplet applet, float quality) { - CameraConfiguration cameraConfiguration = getDefaultCameraConfiguration(applet); - - Camera cameraTracking = CameraFactory.createCamera( - cameraConfiguration.getCameraType(), - cameraConfiguration.getCameraName(), - cameraConfiguration.getCameraFormat()); - cameraTracking.setParent(applet); - cameraTracking.setCalibration(cameraCalib); + ProjectiveDeviceP pdp = null; + try { + pdp = ProjectiveDeviceP.loadCameraDevice(applet, cameraCalib); + } catch (Exception ex) { + Logger.getLogger(Papart.class.getName()).log(Level.SEVERE, null, ex); + } Papart papart = new Papart(applet); - papart.frameSize.set(cameraTracking.width(), cameraTracking.height()); - papart.shouldSetWindowSize = true; - papart.registerPost(); + if (pdp != null) { + papart.frameSize.set(pdp.getWidth(), pdp.getHeight()); + papart.shouldSetWindowSize = true; + papart.registerPost(); + } - papart.initCamera(quality); + papart.initCamera(); + papart.initARDisplay(quality); + papart.checkInitialization(); return papart; } @@ -292,23 +302,9 @@ public static Papart projection2D(PApplet applet) { papart.shouldSetWindowSize = true; papart.registerPost(); -// Panel panel = new Panel(applet); return papart; } - public static KinectDevice loadDefaultKinectDevice(PApplet applet) { - CameraConfiguration kinectConfiguration = Papart.getDefaultKinectConfiguration(applet); - - if (kinectConfiguration.getCameraType() == Camera.Type.OPEN_KINECT) { - return new Kinect360(applet); - } - if (kinectConfiguration.getCameraType() == Camera.Type.KINECT2_RGB) { - return new KinectOne(applet); - } - System.err.println("Papart: Could not identify default Kinect Device."); - return null; - } - private boolean shouldSetWindowLocation = false; private boolean shouldSetWindowSize = false; @@ -333,8 +329,8 @@ public void forceCameraSize() { } public void forceDepthCameraSize() { - forceWindowSize(kinectDevice.depthWidth(), - kinectDevice.depthHeight()); + forceWindowSize(depthCameraDevice.getDepthCamera().width(), + depthCameraDevice.getDepthCamera().height()); } public void forceWindowSize(int w, int h) { @@ -412,6 +408,7 @@ public void post() { */ public void defaultFrameLocation() { System.out.println("Setting the frame location..."); + ScreenConfiguration screenConfiguration = getDefaultScreenConfiguration(this.applet); this.applet.frame.setLocation(screenConfiguration.getProjectionScreenOffsetX(), screenConfiguration.getProjectionScreenOffsetY()); @@ -537,7 +534,7 @@ public PlaneCalibration getTablePlane() { */ public void moveToTablePosition(PaperScreen paperScreen) { paperScreen.useManualLocation(true); - paperScreen.screen.setMainLocation(HomographyCalibration.getMatFrom(applet, tablePosition), cameraTracking); + paperScreen.screen.setMainLocation(HomographyCalibration.getMatFrom(applet, tablePosition), getPublicCameraTracking()); } @Deprecated @@ -551,45 +548,6 @@ public void initDebug() { initDebugDisplay(); } - public void initProjectorCamera() { - initProjectorCamera(cameraConfiguration.getCameraName(), - cameraConfiguration.getCameraType(), - cameraConfiguration.getCameraFormat(), - 1); - } - - public void initProjectorCamera(float quality) { - initProjectorCamera(cameraConfiguration.getCameraName(), - cameraConfiguration.getCameraType(), - cameraConfiguration.getCameraFormat(), - quality); - } - - public void initProjectorCamera(String cameraNo, Camera.Type cameraType, String cameraFormat) { - initProjectorCamera(cameraNo, cameraType, cameraFormat, 1); - } - - /** - * Load a projector - camera couple. Default configuration files are used. - * - * @param quality - * @param cameraNo - * @param cameraType - */ - public void initProjectorCamera(String cameraNo, Camera.Type cameraType, String cameraFormat, float quality) { - assert (!cameraInitialized); - initProjectorDisplay(quality); - tryLoadExtrinsics(); - cameraTracking = CameraFactory.createCamera(cameraType, cameraNo, cameraFormat); - cameraTracking.setParent(applet); - cameraTracking.setCalibration(cameraCalib); - cameraTracking.start(); - loadTracking(cameraCalib); - cameraTracking.setThread(); - projector.setCamera(cameraTracking); - checkInitialization(); - } - private void tryLoadExtrinsics() { PMatrix3D extrinsics = loadCalibration(cameraProjExtrinsics); if (extrinsics == null) { @@ -599,41 +557,19 @@ private void tryLoadExtrinsics() { } } - public void initKinectCamera(float quality) { - assert (!cameraInitialized); - kinectDevice = loadDefaultCameraKinect(); - cameraTracking = kinectDevice.getCameraRGB(); - loadTracking(kinectRGBCalib); - cameraTracking.setThread(); - initARDisplay(quality); - checkInitialization(); - } - - public void startDefaultKinectCamera() { - assert (!cameraInitialized); - kinectDevice = loadDefaultCameraKinect(); - cameraTracking = kinectDevice.getCameraRGB(); - } - /** * Initialize the default camera for object tracking. * */ public void initCamera() { - initCamera(1); + CameraConfiguration cameraConfiguration = getDefaultCameraConfiguration(applet); + initCamera(cameraConfiguration); } - /** - * Initialize the default camera for object tracking. - * - * @param quality default is 1, to downscale go below 1, try 0.8, for better - * quality go higher like 2. - */ - public void initCamera(float quality) { + public void initCamera(CameraConfiguration cameraConfiguration) { initCamera(cameraConfiguration.getCameraName(), cameraConfiguration.getCameraType(), - cameraConfiguration.getCameraFormat(), - quality); + cameraConfiguration.getCameraFormat()); } /** @@ -641,21 +577,17 @@ public void initCamera(float quality) { * */ public void initCamera(String cameraNo, Camera.Type cameraType, String cameraFormat) { - initCamera(cameraNo, cameraType, cameraFormat, 1); - } - - public void initCamera(String cameraNo, Camera.Type cameraType, String cameraFormat, float quality) { assert (!cameraInitialized); cameraTracking = CameraFactory.createCamera(cameraType, cameraNo, cameraFormat); cameraTracking.setParent(applet); cameraTracking.setCalibration(cameraCalib); - cameraTracking.start(); - loadTracking(cameraCalib); - cameraTracking.setThread(); - initARDisplay(quality); - checkInitialization(); + System.out.println("Starting First tracking camera: " + cameraTracking); + // TEST: no more start here... +// cameraTracking.start(); +// loadTracking(cameraCalib); +// cameraTracking.setThread(); } private void initProjectorDisplay(float quality) { @@ -673,7 +605,7 @@ private void initProjectorDisplay(float quality) { private void initARDisplay(float quality) { assert (this.cameraTracking != null && this.applet != null); - arDisplay = new ARDisplay(this.applet, cameraTracking); + arDisplay = new ARDisplay(this.applet, getPublicCameraTracking()); arDisplay.setZNearFar(zNear, zFar); arDisplay.setQuality(quality); arDisplay.init(); @@ -702,38 +634,20 @@ private void checkInitialization() { this.applet.registerMethod("stop", this); } - private void loadTracking(String calibrationPath) { - // TODO: check if file exists ! - Camera.convertARParams(this.applet, calibrationPath, camCalibARtoolkit); - cameraTracking.initMarkerDetection(camCalibARtoolkit); - - // The camera view is handled in another thread; - cameraInitialized = true; - } - /** - * Touch input when the camera tracking the markers is a Kinect. - * + * Only for .cfg marker tracking. */ - public void loadTouchInputKinectOnly() { - - if (this.kinectDevice == null) { - kinectDevice = loadDefaultCameraKinect(); - cameraTracking = kinectDevice.getCameraRGB(); - kinectDevice.getCameraRGB().setThread(); - kinectDevice.getCameraDepth().setThread(); - cameraInitialized = true; - - checkInitialization(); - } - - loadDefaultTouchKinect(); - - PMatrix3D extr = kinectDevice.getStereoCalibration(); - kinectDevice.setExtrinsics(extr); - - ((KinectTouchInput) this.touchInput).useRawDepth(); - } +// private void setARToolkitCalib() { +// // TODO: warning −> used only for .cfg files. +// // try to get the params from the camera, instead of the files! +// if (cameraTracking.isCalibrated()) { +// Camera.convertARParams(this.applet, getPublicCameraTracking().getProjectiveDevice(), camCalibARtoolkit); +// getPublicCameraTracking().setCalibrationARToolkit(camCalibARtoolkit); +// } else { +// Camera.convertARParams(this.applet, cameraCalib, camCalibARtoolkit); +// getPublicCameraTracking().setCalibrationARToolkit(camCalibARtoolkit); +// } +// } /** * * @@ -741,15 +655,33 @@ public void loadTouchInputKinectOnly() { * */ public void loadTouchInput() { - kinectDevice = loadDefaultCameraKinect(); - kinectDevice.getCameraRGB().setThread(); - kinectDevice.getCameraDepth().setThread(); - + loadDefaultDepthCamera(); loadDefaultTouchKinect(); - - // setExtrinsics must after the kinect stereo calibration is loaded - PMatrix3D extr = (Papart.getPapart()).loadCalibration(Papart.kinectTrackingCalib); - kinectDevice.setExtrinsics(extr); + updateDepthCameraDeviceExtrinsics(); + } + + private void updateDepthCameraDeviceExtrinsics(){ + // Check if depthCamera is the same as the camera ! + if (projector == null && + cameraTracking instanceof CameraRGBIRDepth && + cameraTracking == depthCameraDevice.getMainCamera()) { + + // No extrinsic used, it is already in the camera... + depthCameraDevice.getDepthCamera().setExtrinsics(depthCameraDevice.getStereoCalibration()); + + // Specific + // Important to use it for now ! Used in KinectTouchInput.projectPointToScreen + ((KinectTouchInput) this.touchInput).useRawDepth(); + +// System.out.println("Papart: Using Touchextrinsics from the device."); + } else { + // Two different cameras + // setExtrinsics must after the kinect stereo calibration is loaded + PMatrix3D extr = (Papart.getPapart()).loadCalibration(Papart.kinectTrackingCalib); + extr.invert(); + depthCameraDevice.getDepthCamera().setExtrinsics(extr); +// System.out.println("Papart: Using Touchextrinsics from the calibrated File."); + } } private boolean useKinectOne = true; @@ -759,42 +691,48 @@ public void useKinectOne(boolean kinectOne) { } /** - * WORK IN PROGRESS - * - * @return */ - public KinectDevice loadDefaultCameraKinect() { - CameraConfiguration kinectConfiguration = Papart.getDefaultKinectConfiguration(applet); + public DepthCameraDevice loadDefaultDepthCamera() { + + // Two cases, either the other camera running of the same type + CameraConfiguration kinectConfiguration = Papart.getDefaultDepthCameraConfiguration(applet); + + // If the camera is not instanciated, we use depth + color from the camera. +// if (cameraTracking == null) { +// System.err.println("You must choose a camera to create a DepthCamera."); +// } + if (kinectConfiguration.getCameraType() == Camera.Type.REALSENSE) { + depthCameraDevice = new RealSense(applet, cameraTracking); + } if (kinectConfiguration.getCameraType() == Camera.Type.OPEN_KINECT) { - return new Kinect360(applet); + depthCameraDevice = new Kinect360(applet, cameraTracking); } - if (kinectConfiguration.getCameraType() == Camera.Type.KINECT2_RGB) { - if (this.cameraTracking == null) { - return new KinectOne(applet); - } else { - return new KinectOne(applet, cameraTracking); - } + if (kinectConfiguration.getCameraType() == Camera.Type.OPEN_KINECT_2) { + depthCameraDevice = new KinectOne(applet, cameraTracking); } - System.err.println("Could not load the Kinect !" + "Camera Type " + kinectConfiguration.getCameraType()); - return null; + + if (depthCameraDevice == null) { + System.err.println("Could not load the depth camera !" + "Camera Type " + kinectConfiguration.getCameraType()); + } + + // At this point, cameraTracking & depth Camera are ready. + return depthCameraDevice; } private void loadDefaultTouchKinect() { - - kinectDevice.setStereoCalibration(kinectStereoCalib); - kinectDepthAnalysis = new KinectDepthAnalysis(this.applet, kinectDevice); + kinectDepthAnalysis = new KinectDepthAnalysis(this.applet, depthCameraDevice); PlaneAndProjectionCalibration calibration = new PlaneAndProjectionCalibration(); calibration.loadFrom(this.applet, planeAndProjectionCalib); KinectTouchInput kinectTouchInput = new KinectTouchInput(this.applet, - kinectDevice, + depthCameraDevice, kinectDepthAnalysis, calibration); - kinectDevice.setTouch(kinectTouchInput); + depthCameraDevice.setTouch(kinectTouchInput); kinectTouchInput.setTouchDetectionCalibration(getDefaultTouchCalibration()); kinectTouchInput.setTouchDetectionCalibration3D(getDefaultTouchCalibration3D()); @@ -857,12 +795,55 @@ public void loadSketches() { } + /** + * Start the tracking without a thread. + */ + public void startTrackingWithoutThread() { + if (this.cameraTracking == null) { + System.err.println("Start Tracking requires a Camera..."); + return; + } +// setARToolkitCalib(); + this.getPublicCameraTracking().trackSheets(true); + } + + /** + * Start the camera thread, and the tracking. it calls automaticall + * startCameraThread(). + */ public void startTracking() { if (this.cameraTracking == null) { System.err.println("Start Tracking requires a Camera..."); return; } - this.cameraTracking.trackSheets(true); +// setARToolkitCalib(); + this.getPublicCameraTracking().trackSheets(true); + startCameraThread(); + } + + public void startCameraThread() { + + System.out.println("Starting thread for camera: " + cameraTracking); + cameraTracking.start(); + + // Calibration might be loaded from the device and require an update. + if (arDisplay != null && !(arDisplay instanceof ProjectorDisplay)) { + System.out.println("Papart: Reload calibration!"); + arDisplay.reloadCalibration(); + } + + cameraTracking.setThread(); + + if (depthCameraDevice != null + && cameraTracking != depthCameraDevice.getMainCamera()) { + depthCameraDevice.getMainCamera().start(); + depthCameraDevice.getMainCamera().setThread(); + } + } + + public void startDepthCameraThread() { + depthCameraDevice.getMainCamera().start(); + depthCameraDevice.getMainCamera().setThread(); } public void stop() { @@ -870,8 +851,8 @@ public void stop() { } public void dispose() { - if (touchInitialized && kinectDevice != null) { - kinectDevice.close(); + if (touchInitialized && depthCameraDevice != null) { + depthCameraDevice.close(); } if (cameraInitialized && cameraTracking != null) { try { @@ -917,7 +898,16 @@ public ARDisplay getARDisplay() { } public Camera getCameraTracking() { -// assert (cameraInitialized); + return this.cameraTracking; + } + + public Camera getPublicCameraTracking() { + if (cameraTracking instanceof CameraRGBIRDepth) { + if (((CameraRGBIRDepth) cameraTracking).getActingCamera() == null) { + throw new RuntimeException("Papart: Impossible to use the mainCamera, use a subCamera or set the ActAsX methods."); + } + return ((CameraRGBIRDepth) cameraTracking).getActingCamera(); + } return this.cameraTracking; } @@ -936,23 +926,22 @@ public boolean isWithoutCamera() { } public Camera getKinectCamera() { - return this.kinectDevice.getCameraRGB(); + return this.depthCameraDevice.getColorCamera(); } - public KinectDevice getKinectDevice() { - return kinectDevice; + public DepthCameraDevice getDepthCameraDevice() { + return depthCameraDevice; } public KinectDepthAnalysis getKinectAnalysis() { return this.kinectDepthAnalysis; } - public KinectDevice.Type getKinectType() { - if (kinectDevice == null) { - return KinectDevice.Type.NONE; - + public Camera.Type getDepthCameraType() { + if (depthCameraDevice == null) { + return Camera.Type.FAKE; } - return kinectDevice.type(); + return depthCameraDevice.type(); } public PApplet getApplet() { diff --git a/papart/src/fr/inria/papart/procam/PaperScreen.java b/papart/src/fr/inria/papart/procam/PaperScreen.java index b4b987be..b622e34a 100755 --- a/papart/src/fr/inria/papart/procam/PaperScreen.java +++ b/papart/src/fr/inria/papart/procam/PaperScreen.java @@ -26,8 +26,6 @@ import fr.inria.papart.calibration.HomographyCalibration; import fr.inria.papart.procam.display.BaseDisplay; import fr.inria.papart.procam.display.ARDisplay; -import fr.inria.papart.drawingapp.DrawUtils; -import static fr.inria.papart.procam.Papart.tablePosition; import fr.inria.papart.tracking.ObjectFinder; import java.awt.Image; import java.util.ArrayList; @@ -102,7 +100,7 @@ public PaperScreen() { this.parent = papart.getApplet(); this.isWithoutCamera = papart.isWithoutCamera(); if (!this.isWithoutCamera) { - this.cameraTracking = papart.getCameraTracking(); + this.cameraTracking = papart.getPublicCameraTracking(); } mainDisplay = papart.getDisplay(); displays.add(papart.getDisplay()); @@ -198,6 +196,10 @@ public void pre() { isInitialized = true; } + + // Needed for touch and projection operations + screen.computeScreenPosTransform(cameraTracking); + // assert (isInitialized); // if (this.isWithoutCamera || useManualLocation) { // return; @@ -271,6 +273,7 @@ private void trackCurrentMarkerBoard() { if (!cameraTracking.tracks(markerBoard)) { cameraTracking.trackMarkerBoard(markerBoard); +// System.out.println("Camera. " + cameraTracking + " now tracks " + markerBoard); } } diff --git a/papart/src/fr/inria/papart/procam/PaperTouchScreen.java b/papart/src/fr/inria/papart/procam/PaperTouchScreen.java index 10843ca6..0c70c8ff 100755 --- a/papart/src/fr/inria/papart/procam/PaperTouchScreen.java +++ b/papart/src/fr/inria/papart/procam/PaperTouchScreen.java @@ -19,6 +19,7 @@ */ package fr.inria.papart.procam; +import fr.inria.papart.utils.ARToolkitPlusUtils; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.display.BaseDisplay; import fr.inria.papart.multitouch.TouchInput; @@ -27,6 +28,7 @@ import fr.inria.papart.multitouch.TUIOTouchInput; import fr.inria.papart.multitouch.TouchList; import fr.inria.papart.multitouch.TouchPoint; +import fr.inria.papart.utils.MathUtils; import fr.inria.papart.procam.display.ProjectorDisplay; import java.nio.ByteBuffer; import java.util.ArrayList; @@ -50,7 +52,7 @@ public PaperTouchScreen() { } public PaperTouchScreen(Papart papart) { - this(papart.getCameraTracking(), + this(papart.getPublicCameraTracking(), papart.getDisplay(), papart.getTouchInput()); } @@ -82,6 +84,7 @@ public void setLocation(PVector v) { @Override public void setLocation(float x, float y, float z) { super.setLocation(x, y, z); + screen.computeScreenPosTransform(cameraTracking); updateTouch(); } @@ -91,8 +94,6 @@ public void updateTouch() { return; } } - screen.computeScreenPosTransform(cameraTracking); - // Warning TODO: Hack.. V_V // Touch in 2D  mode has boundaries. // Touch in 3D mode has no boundaries. @@ -115,6 +116,7 @@ public void updateTouch() { } + // TODO: cleaning of this static private final int DEFAULT_TOUCH_SIZE = 15; protected void drawTouch() { @@ -124,18 +126,11 @@ protected void drawTouch() { protected void drawTouch(int ellipseSize) { for (Touch t : touchList) { if (t.is3D) { - fill(185, 142, 62); + // fill(185, 142, 62); } else { fill(58, 71, 198); + ellipse(t.position.x, t.position.y, ellipseSize, ellipseSize); } - ellipse(t.position.x, t.position.y, ellipseSize, ellipseSize); - -// ellipse(t.pposition.x, t.pposition.y, ellipseSize /2 , ellipseSize /2); -// pushMatrix(); -// translate(t.position.x, t.position.y); -// ellipse(0, 0, ellipseSize, ellipseSize); -// line(0, 0, t.speed.x * 4, t.speed.y *4); -// popMatrix(); } } @@ -211,68 +206,6 @@ public PImage getImageFrom(PVector coord, PImage src, PImage dst, int radius) { return dst; } - /** - * Unsafe do not use unless you are sure. - */ - public int getColorOccurencesFrom(PVector coord, PImage cameraImage, int radius, int col, int threshold) { - int x = (int) coord.x; - int y = (int) coord.y; - int minX = PApplet.constrain(x - radius, 0, cameraTracking.width() - 1); - int maxX = PApplet.constrain(x + radius, 0, cameraTracking.width() - 1); - int minY = PApplet.constrain(y - radius, 0, cameraTracking.height() - 1); - int maxY = PApplet.constrain(y + radius, 0, cameraTracking.height() - 1); - int k = 0; - for (int j = minY; j <= maxY; j++) { - for (int i = minX; i <= maxX; i++) { - int offset = i + j * cameraTracking.width(); - int pxCol = cameraImage.pixels[offset]; - if (colorDist(col, pxCol) < threshold) { - k++; - } - } - } - return k; - } - - /** - * Unsafe do not use unless you are sure. - */ - public int getColorOccurencesFrom(PVector coord, int radius, int col, int threshold) { - int x = (int) coord.x; - int y = (int) coord.y; - int minX = PApplet.constrain(x - radius, 0, cameraTracking.width() - 1); - int maxX = PApplet.constrain(x + radius, 0, cameraTracking.width() - 1); - int minY = PApplet.constrain(y - radius, 0, cameraTracking.height() - 1); - int maxY = PApplet.constrain(y + radius, 0, cameraTracking.height() - 1); - - ByteBuffer buff = cameraTracking.getIplImage().getByteBuffer(); - - int k = 0; - for (int j = minY; j <= maxY; j++) { - for (int i = minX; i <= maxX; i++) { - int offset = i + j * cameraTracking.width(); - int pxCol = getColor(buff, offset); - if (Utils.colorDist(col, pxCol, threshold)) { - k++; - } - } - } - return k; - } - - public int getColorFrom3D(PVector point){ - return getColorAt(getPxCoordinates(point)); - } - - /** - * Unsafe do not use unless you are sure. - */ - public PVector getPxCoordinates(PVector cameraTracking3DCoord) { - ProjectiveDeviceP pdp = cameraTracking.getProjectiveDevice(); - PVector coord = pdp.worldToPixelCoord(cameraTracking3DCoord); - return coord; - } - public int getColorAt(PVector coord) { int x = (int) coord.x; int y = (int) coord.y; @@ -288,21 +221,17 @@ private int getColor(ByteBuffer buff, int offset) { | (buff.get(offset) & 0xFF); } - // TODO: move this to image analysis module - private int colorDist(int c1, int c2) { - int r1 = c1 >> 16 & 0xFF; - int g1 = c1 >> 8 & 0xFF; - int b1 = c1 >> 0 & 0xFF; - - int r2 = c2 >> 16 & 0xFF; - int g2 = c2 >> 8 & 0xFF; - int b2 = c2 >> 0 & 0xFF; - - int dr = PApplet.abs(r1 - r2); - int dg = PApplet.abs(g1 - g2); - int db = PApplet.abs(b1 - b2); + public int getColorFrom3D(PVector point) { + return getColorAt(getPxCoordinates(point)); + } - return dr + dg + db; + /** + * Unsafe do not use unless you are sure. + */ + public PVector getPxCoordinates(PVector cameraTracking3DCoord) { + ProjectiveDeviceP pdp = cameraTracking.getProjectiveDevice(); + PVector coord = pdp.worldToPixelCoord(cameraTracking3DCoord); + return coord; } /** diff --git a/papart/src/fr/inria/papart/procam/ProjectiveDeviceP.java b/papart/src/fr/inria/papart/procam/ProjectiveDeviceP.java index 6ca371e4..18590810 100755 --- a/papart/src/fr/inria/papart/procam/ProjectiveDeviceP.java +++ b/papart/src/fr/inria/papart/procam/ProjectiveDeviceP.java @@ -430,7 +430,21 @@ public void saveCameraTo(PApplet applet, String filename) { public void saveProjectorTo(PApplet applet, String filename) { saveTo(applet, filename, false); } - + + public static ProjectiveDeviceP createSimpleDevice(float fx, float fy, float cx, float cy, int w, int h) { + ProjectiveDeviceP p = new ProjectiveDeviceP(); + // Do not update the handle distorsions ? +// p.handleDistorsion = false; + p.w = w; + p.h = h; + p.intrinsics = new PMatrix3D(fx, 0, cx, 0, + 0, fy, cy, 0, + 0, 0, 0, 0, + 0, 0, 0, 0); + p.updateFromIntrinsics(); + p.device = null; + return p; + } public static ProjectiveDeviceP loadCameraDevice(PApplet parent, String filename) throws Exception { return loadCameraDevice(parent, filename, 0); } @@ -565,6 +579,8 @@ public void updateFromIntrinsics() { public String toString() { return "intr " + intrinsics.toString() + (extrinsics != null ? " extr " + extrinsics.toString() : " ") + " " - + " width " + w + " height " + h; + + " width " + w + " height " + h + + " fx " + fx + " fy " + fy + + " cx " + cx + " cy " + cy; } } diff --git a/papart/src/fr/inria/papart/procam/Screen.java b/papart/src/fr/inria/papart/procam/Screen.java index 4bce55bb..f05f1dfe 100755 --- a/papart/src/fr/inria/papart/procam/Screen.java +++ b/papart/src/fr/inria/papart/procam/Screen.java @@ -23,9 +23,9 @@ import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.calibration.HomographyCalibration; import fr.inria.papart.calibration.HomographyCreator; +import fr.inria.papart.utils.MathUtils; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.display.ProjectorDisplay; -import static fr.inria.papart.procam.Utils.toVec; import processing.core.PApplet; import processing.core.PMatrix3D; import processing.core.PVector; @@ -109,28 +109,6 @@ public PGraphicsOpenGL getGraphics() { return thisGraphics; } - // The board must be registered with the camera. - /** - * ** - * @deprecated - * - */ -// public void setAutoUpdatePos(Camera camera, MarkerBoard board) { -// if (!camera.tracks(board)) { -// camera.trackMarkerBoard(board); -// } -// -// isFloatArrayUpdating = board.useFloatArray(); -// if (this.isFloatArrayUpdating) { -// posFloat = board.getTransfo(camera); -// transformation = new PMatrix3D(); -// } else { -//// System.out.println("Getting the original transfo"); -// -// transformation = board.getTransfoMat(camera); -// posFloat = new float[12]; -// } -// } public boolean isOpenGL() { return isOpenGL; } @@ -229,19 +207,6 @@ public float getScale() { return this.scale; } - /** - * update the internals of the screen to match the tracking. - */ - @Deprecated - public void updatePos(Camera camera, MarkerBoard board) { - System.err.println("ERROR Depracted call updatePos. "); -// transformation.set(board.getTransfoMat(camera)); - } - - protected void updatePos() { - - } - public void computeScreenPosTransform(Camera camera) { ///////////////////// PLANE COMPUTATION ////////////////// @@ -255,7 +220,7 @@ public void computeScreenPosTransform(Camera camera) { mat.translate(-size.x, 0, 0); paperPosCorners3D[3] = new PVector(mat.m03, mat.m13, mat.m23); - plane = new Plane(new Triangle3D(toVec(paperPosCorners3D[0]), toVec(paperPosCorners3D[1]), toVec(paperPosCorners3D[2]))); + plane = new Plane(new Triangle3D(MathUtils.toVec(paperPosCorners3D[0]), MathUtils.toVec(paperPosCorners3D[1]), MathUtils.toVec(paperPosCorners3D[2]))); homography.addPoint(paperPosCorners3D[0], new PVector(0, 0)); homography.addPoint(paperPosCorners3D[1], new PVector(1, 0)); diff --git a/papart/src/fr/inria/papart/procam/Utils.java b/papart/src/fr/inria/papart/procam/Utils.java deleted file mode 100755 index f747d10a..00000000 --- a/papart/src/fr/inria/papart/procam/Utils.java +++ /dev/null @@ -1,884 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.procam; - -import fr.inria.papart.procam.camera.Camera.PixelFormat; - -import org.bytedeco.javacv.CameraDevice; -import org.bytedeco.javacv.ProjectorDevice; -import org.bytedeco.javacpp.opencv_imgproc; -import static org.bytedeco.javacpp.opencv_core.*; -import static org.bytedeco.javacpp.opencv_calib3d.*; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.net.URL; -import java.nio.ByteBuffer; -import processing.core.*; -import static processing.core.PConstants.ARGB; -import static processing.core.PConstants.RGB; -import processing.opengl.Texture; -import toxi.geom.Matrix4x4; -import toxi.geom.Vec3D; -import java.io.*; - -/** - * - * @author jeremy - */ -public class Utils { - - static public final String LibraryName = "PapARt"; - - static public Process runExample(String exampleName, boolean silent) { - - try { - StringBuilder commandLine = new StringBuilder(); - String papartFolder = getPapartFolder(); - String sketchFolder = "/examples/" + exampleName + "/"; - - // On linux only - commandLine.append("nohup "); - - // TODO: find processing-java even when not installed ! - // Or make an easy install... - commandLine.append("processing-java "); - - commandLine.append("--sketch=") - .append(papartFolder) - .append(sketchFolder) - .append(" --output=") - .append(papartFolder) - .append(sketchFolder) - .append("build") - .append(" --force --run"); - -// commandLine.append("\""); -// processing-java --sketch=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/ --output=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/build --force --run -// println("Starting... \n" + commandLine.toString()); - // TODO: Alternative on Windows... when /bin/sh is not installed. - Process p = Runtime.getRuntime().exec(commandLine.toString()); -// Process p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", commandLine.toString()}); -// Process p = Runtime.getRuntime().exec(new String[]{"nohup", commandLine.toString()}); - - if (!silent) { - String line; - BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); - BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); - while ((line = bri.readLine()) != null) { - System.out.println(line); - } - bri.close(); - while ((line = bre.readLine()) != null) { - System.out.println(line); - } - bre.close(); - } - - return p; - // p.waitFor(); - } catch (Exception e) { - System.out.println("Could not start the Papart example : " - + exampleName - + "\n" + e); - }; - return null; - - } -// sketchbook - -// processing-java --sketch=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/ --output=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/build --force --run - static public String getSketchbookFolder() { - - String sketchbook = java.lang.System.getenv("SKETCHBOOK"); - if (sketchbook != null) { - return sketchbook; - } - - URL main = Matrix4x4.class.getResource("Matrix4x4.class"); - String tmp = main.getPath(); - - tmp = tmp.substring(0, tmp.indexOf('!')); - tmp = tmp.replace("file:", ""); -// tmp = tmp.replace("file:/", ""); TODO: OS check ? - - File f = new File(tmp); - if (!f.exists()) { - System.err.println("Error in loading the Sketchbook folder."); - } - - // if the file is within a library/lib folder - if (f.getParentFile().getAbsolutePath().endsWith(("/lib"))) { - // pathToSketchbook/libraries/myLib/library/lib/myLib.jar - f = f.getParentFile().getParentFile().getParentFile().getParentFile().getParentFile(); - } else { - // pathToSketchbook/libraries/myLib/library/myLib.jar - f = f.getParentFile().getParentFile().getParentFile().getParentFile(); - } - - return f.getAbsolutePath(); - } - - static public String getLibraryFolder(String libname) { - return getLibrariesFolder() + "/libraries/" + libname; - } - - static public String getLibrariesFolder() { - - // This is used, as Papart classes are often linked to another folder... - URL main = Matrix4x4.class.getResource("Matrix4x4.class"); -// URL main = ARDisplay.class.getResource("ARDisplay.class"); - String tmp = main.getPath(); - - System.out.println("path " + tmp); - - // its in a jar - if (tmp.contains("!")) { - tmp = tmp.substring(0, tmp.indexOf('!')); - tmp = tmp.replace("file:", ""); -// tmp = tmp.replace("file:/", ""); TODO: OS check ? - } - - File f = new File(tmp); - if (!f.exists()) { - System.err.println("Error in loading the Sketchbook folder."); - } - - // if the file is within a library/lib folder - if (f.getParentFile().getAbsolutePath().endsWith(("/lib"))) { - // pathToSketchbook/libraries/myLib/library/lib/myLib.jar - f = f.getParentFile().getParentFile().getParentFile().getParentFile(); - } else { - // pathToSketchbook/libraries/myLib/library/myLib.jar - f = f.getParentFile().getParentFile().getParentFile(); - } - - return f.getAbsolutePath(); - } - - static public String getPapartFolder() { - - String sketchbook = java.lang.System.getenv("SKETCHBOOK"); - if (sketchbook != null) { - System.out.println("Found SKETCHBOOK environment variable."); - return sketchbook + "/libraries/" + LibraryName; - } - - return getLibrariesFolder() + "/" + LibraryName; - } - - static public PVector mult(PMatrix3D mat, PVector source, PVector target) { - if (target == null) { - target = new PVector(); - } - target.x = mat.m00 * source.x + mat.m01 * source.y + mat.m02 * source.z + mat.m03; - target.y = mat.m10 * source.x + mat.m11 * source.y + mat.m12 * source.z + mat.m13; - target.z = mat.m20 * source.x + mat.m21 * source.y + mat.m22 * source.z + mat.m23; - float tw = mat.m30 * source.x + mat.m31 * source.y + mat.m32 * source.z + mat.m33; - if (tw != 0 && tw != 1) { - target.div(tw); - } - return target; - } - - static public Vec3D toVec(PVector p) { - return new Vec3D(p.x, p.y, p.z); - } - - static public PVector toPVector(Vec3D p) { - return new PVector(p.x, p.y, p.z); - } - - static public boolean colorDist(int c1, int c2, int threshold) { - int r1 = c1 >> 16 & 0xFF; - int g1 = c1 >> 8 & 0xFF; - int b1 = c1 >> 0 & 0xFF; - - int r2 = c2 >> 16 & 0xFF; - int g2 = c2 >> 8 & 0xFF; - int b2 = c2 >> 0 & 0xFF; - - int dr = PApplet.abs(r1 - r2); - int dg = PApplet.abs(g1 - g2); - int db = PApplet.abs(b1 - b2); - return dr < threshold && dg < threshold && db < threshold; - } - - // TODO: throws ... - public static void savePMatrix3D(PApplet pa, PMatrix3D mat, String filename) { - String[] lines = new String[16]; - - lines[0] = Float.toString(mat.m00); - lines[1] = Float.toString(mat.m01); - lines[2] = Float.toString(mat.m02); - lines[3] = Float.toString(mat.m03); - lines[4] = Float.toString(mat.m10); - lines[5] = Float.toString(mat.m11); - lines[6] = Float.toString(mat.m12); - lines[7] = Float.toString(mat.m13); - lines[8] = Float.toString(mat.m20); - lines[9] = Float.toString(mat.m21); - lines[10] = Float.toString(mat.m22); - lines[11] = Float.toString(mat.m23); - lines[12] = Float.toString(mat.m30); - lines[13] = Float.toString(mat.m31); - lines[14] = Float.toString(mat.m32); - lines[15] = Float.toString(mat.m33); - - pa.saveStrings(filename, lines); - } - - public static void addPMatrix3D(PMatrix3D src, PMatrix3D toAdd) { - src.m00 += toAdd.m00; - src.m01 += toAdd.m01; - src.m02 += toAdd.m02; - src.m03 += toAdd.m03; - - src.m10 += toAdd.m10; - src.m11 += toAdd.m11; - src.m12 += toAdd.m12; - src.m13 += toAdd.m13; - - src.m20 += toAdd.m20; - src.m21 += toAdd.m21; - src.m22 += toAdd.m22; - src.m23 += toAdd.m23; - - src.m30 += toAdd.m30; - src.m31 += toAdd.m31; - src.m32 += toAdd.m32; - src.m33 += toAdd.m33; - - } - - static public void scaleMat(PMatrix3D mat, float scale) { - //applscale(scale, 0, 0, 0, 0, scale, 0, 0, 0, 0, scale, 0, 0, 0, 0, 1); - mat.m00 *= scale; - mat.m01 *= scale; - mat.m02 *= scale; - mat.m03 *= scale; - mat.m10 *= scale; - mat.m11 *= scale; - mat.m12 *= scale; - mat.m13 *= scale; - mat.m20 *= scale; - mat.m21 *= scale; - mat.m22 *= scale; - mat.m23 *= scale; - mat.m30 *= scale; - mat.m31 *= scale; - mat.m32 *= scale; - mat.m33 *= scale; - } - - public static PMatrix3D loadPMatrix3D(PApplet pa, String filename) throws FileNotFoundException { - String[] lines = pa.loadStrings(filename); - if (lines == null) { - throw new FileNotFoundException(filename); - } - - PMatrix3D mat = new PMatrix3D(Float.parseFloat(lines[0]), Float.parseFloat(lines[1]), Float.parseFloat(lines[2]), Float.parseFloat(lines[3]), - Float.parseFloat(lines[4]), Float.parseFloat(lines[5]), Float.parseFloat(lines[6]), Float.parseFloat(lines[7]), - Float.parseFloat(lines[8]), Float.parseFloat(lines[9]), Float.parseFloat(lines[10]), Float.parseFloat(lines[11]), - Float.parseFloat(lines[12]), Float.parseFloat(lines[13]), Float.parseFloat(lines[14]), Float.parseFloat(lines[15])); - return mat; - } - - static public IplImage createImageFrom(IplImage imgIn, PImage Pout) { - // TODO: avoid this creation !! - CvSize outSize = new CvSize(); - outSize.width(Pout.width); - outSize.height(Pout.height); - IplImage imgOut = cvCreateImage(outSize, // size - imgIn.depth(), // depth - imgIn.nChannels()); -// imgIn.w - return imgOut; - } - - static public IplImage createImageFrom(IplImage imgIn) { - // TODO: avoid this creation !! - CvSize outSize = new CvSize(); - outSize.width(imgIn.width()); - outSize.height(imgIn.height()); - IplImage imgOut = cvCreateImage(outSize, // size - imgIn.depth(), // depth - imgIn.nChannels()); -// imgIn.w - return imgOut; - } - - static public IplImage createImageFrom(PImage in) { - // TODO: avoid this creation !! - CvSize outSize = new CvSize(); - outSize.width(in.width); - outSize.height(in.height); - - IplImage imgOut = null; - if (in.format == RGB) { - imgOut = cvCreateImage(outSize, // size - IPL_DEPTH_8U, // depth - 3); - } - - if (in.format == ARGB) { - imgOut = cvCreateImage(outSize, // size - IPL_DEPTH_8U, // depth - 4); - } - -// imgIn.w - return imgOut; - } - - static public void createAnaglyph(PImage imgL, PImage imgR, PImage imgOut) { - - imgL.loadPixels(); - imgR.loadPixels(); - imgOut.loadPixels(); - - int[] pL = imgL.pixels; - int[] pR = imgR.pixels; - int[] pO = imgOut.pixels; - for (int i = 0; i < pL.length; i++) { - pO[i] = (pR[i] >> 16) << 16 - | (pL[i] >> 8) & 0xFF << 8 - | pL[i] & 0xFF; - -// pO[i] = pL[i]; - } - imgOut.updatePixels(); -// imgL.updatePixels(); - - } - - static public CvMat createHomography(PVector[] in, PVector[] out) { - - CvMat srcPoints; - CvMat dstPoints; - int nbPoints = in.length; - CvMat homography; - - // TODO: no create map - srcPoints = cvCreateMat(2, in.length, CV_32FC1); - dstPoints = cvCreateMat(2, in.length, CV_32FC1); - homography = cvCreateMat(3, 3, CV_32FC1); - - for (int i = 0; i < in.length; i++) { - srcPoints.put(i, in[i].x); - srcPoints.put(i + nbPoints, in[i].y); - dstPoints.put(i, out[i].x); - dstPoints.put(i + nbPoints, out[i].y); - } - - cvFindHomography(srcPoints, dstPoints, homography); -// It is better to use : GetPerspectiveTransform - return homography; - } - - // TODO: finish this, find another source... -// http://planning.cs.uiuc.edu/node103.html - static public PVector getRotations(PMatrix3D mat) { - - PVector r = new PVector(); - - r.z = PApplet.atan(mat.m10 / mat.m00); - r.y = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22)); - r.x = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22)); - - return null; - } - - // TO USE INSIDE THE DRAW FUNCTION - // TODO: Experimental -> To validate... -// static public Texture createTextureFrom(PApplet parent, IplImage img) { -// Texture tex = null; -// -// // We suppose... Depth = 3 : BGR and Depth = 4 : RGBA (even though it is written ARGB for Processing...) -// if (img.nChannels() == 3) { -// tex = new Texture(img.width(), img.height(), PApplet.RGB); -// } -// if (img.nChannels() == 4) { -// tex = new Texture(img.width(), img.height(), PApplet.ARGB); -// } -// return tex; -// } - static public void updateTexture(IplImage img, Texture tex) { - - System.out.println("Update Texture broken ? May Require CustomTexture..."); - -// if (img.nChannels() == 3) { -// tex.putBuffer(GL.GL_BGR, GL.GL_UNSIGNED_BYTE, img.getIntBuffer()); -// } -// if (img.nChannels() == 4) { -// tex.putBuffer(GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, img.getIntBuffer()); -// } - } - - static public void remapImage(PVector[] in, PVector[] out, IplImage imgIn, IplImage imgTmp, PImage Pout) { - - CvMat srcPoints; - CvMat dstPoints; - int nbPoints = in.length; - CvMat homography; - - // TODO: no create map - srcPoints = cvCreateMat(2, in.length, CV_32FC1); - dstPoints = cvCreateMat(2, in.length, CV_32FC1); - homography = cvCreateMat(3, 3, CV_32FC1); - - for (int i = 0; i < in.length; i++) { - srcPoints.put(i, in[i].x); - srcPoints.put(i + nbPoints, in[i].y); - dstPoints.put(i, out[i].x); - dstPoints.put(i + nbPoints, out[i].y); - } - - cvFindHomography(srcPoints, dstPoints, homography); -// It is better to use : GetPerspectiveTransform - - opencv_imgproc.cvWarpPerspective(imgIn, imgTmp, homography); - // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); -// getFillColor()); - IplImageToPImage(imgTmp, false, Pout); - - } - - static public void remapImage(CvMat homography, IplImage imgIn, IplImage imgTmp, PImage Pout) { - - opencv_imgproc.cvWarpPerspective(imgIn, imgTmp, homography); - // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); -// getFillColor()); - IplImageToPImage(imgTmp, false, Pout); - - } - - static public void remapImageIpl(CvMat homography, IplImage imgIn, IplImage imgOut) { - - opencv_imgproc.cvWarpPerspective(imgIn, imgOut, homography); - // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); -// getFillColor()); - } - - static public int getColor(IplImage img, int x, int y, boolean RGB) { - - if (img.nChannels() == 3) { - - ByteBuffer buff = img.getByteBuffer(); - int offset = (img.width() * y + x) * 3; - - if (RGB) { - - return (buff.get(offset) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset + 2) & 0xFF); - } else { - return (buff.get(offset + 2) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset) & 0xFF); - } - } - - // Operation not supported - return 0; - } - - // TODO: clean all this ! - static public void IplImageToPImage(IplImage img, PApplet applet, boolean RGB, PImage ret) { - IplImageToPImage(img, RGB, ret); - } - - static public void IplImageToPImage(IplImage img, PixelFormat format, PImage ret) { - if (format == PixelFormat.RGB) { - IplImageToPImage(img, true, ret); - } - if (format == PixelFormat.BGR) { - IplImageToPImage(img, false, ret); - } - } - - static public void IplImageToPImage(IplImage img, PImage ret) { - IplImageToPImage(img, true, ret); - } - static int conversionCount = 0; - - static public void IplImageToPImage(IplImage img, boolean RGB, PImage ret) { - -// conversionCount++; -// if (conversionCount % 600 == 0) { -// System.gc(); -// } - assert (img.width() == ret.width); - assert (img.height() == ret.height); - //= new BufferedImage(); - - if (img.nChannels() == 3) { - ByteBuffer buff = img.getByteBuffer(); - - // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); - ret.loadPixels(); - if (RGB) { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; - ret.pixels[i] = (buff.get(offset) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset + 2) & 0xFF); - - } - } else { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; - ret.pixels[i] = (buff.get(offset + 2) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset) & 0xFF); - - } - } - } - - if (img.nChannels() == 4) { - ByteBuffer buff = img.getByteBuffer(); - // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); - ret.loadPixels(); - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 4; -// ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); - - ret.pixels[i] = (0xFF) << 24 - | (buff.get(offset) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset + 2) & 0xFF); - - } - } - - if (img.nChannels() == 1) { - // TODO: no more allocations. - ByteBuffer buff = img.getByteBuffer(); - byte[] arr = new byte[img.width() * img.height()]; - buff.get(arr); - - for (int i = 0; i < img.width() * img.height(); i++) { - int d = (arr[i] & 0xFF); - ret.pixels[i] = d; - } - - } - ret.updatePixels(); - } - - static public void byteBufferBRGtoARGB(ByteBuffer bgr, ByteBuffer argb) { - byte[] tmpArr = new byte[3]; - - for (int i = 0; i < bgr.capacity(); i += 3) { - bgr.get(tmpArr); - - argb.put(tmpArr[2]); - argb.put(tmpArr[1]); - argb.put(tmpArr[0]); - argb.put((byte) 255); - } - argb.rewind(); - } - - // TODO - private static byte[] kinectByteArray = null; - - static public void IplImageToPImageKinect(IplImage img, boolean RGB, PImage ret) { - -// conversionCount++; -// if (conversionCount % 30 == 0) { -// System.gc(); -// } - assert (img.width() == ret.width); - assert (img.height() == ret.height); -// BufferedImage bimg = new BufferedImage(); - - if (img.nChannels() == 3) { - - System.out.println("3 channels"); - ByteBuffer buff = img.getByteBuffer(); - - // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); - ret.loadPixels(); - if (RGB) { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; -// ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); - - ret.pixels[i] = (buff.get(offset) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset + 2) & 0xFF); - - } - } else { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; -// ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); - - ret.pixels[i] = (buff.get(offset + 2) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset) & 0xFF); - - } - - } - } else if (img.nChannels() == 1) { - - ////////////// Kinect Depth ////////////// - ByteBuffer buff = img.getByteBuffer(); - - if (Utils.kinectByteArray == null) { - kinectByteArray = new byte[2 * img.width() * img.height()]; - } -// else { -// Arrays.fill(kinectByteArray, (byte) 0); -// } - - buff.get(kinectByteArray); - - for (int i = 0; i < img.width() * img.height() * 2; i += 2) { - int d = (kinectByteArray[i] & 0xFF) << 8 - | (kinectByteArray[i + 1] & 0xFF); - - ret.pixels[i / 2] = d; -// ret.pixels[i] = -// (buff.get(i) & 0xFF) << 16 -// | (buff.get(i) & 0xFF) << 8 -// | (buff.get(i) & 0xFF); - } - - } - -// buff = null; - ret.updatePixels(); - } - - /** - * - * Deprecated - */ -// static public void PImageToIplImage(PImage src, IplImage dst) { -// dst.copyFrom((BufferedImage) src.getImage()); -// } - static public void PImageToIplImage2(IplImage img, boolean RGB, PImage ret) { - - ByteBuffer buff = img.getByteBuffer(); - - ret.loadPixels(); - if (RGB) { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; - ret.pixels[i] = (buff.get(offset) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset + 2) & 0xFF); - - } - } else { - for (int i = 0; i < img.width() * img.height(); i++) { - int offset = i * 3; - ret.pixels[i] = (buff.get(offset + 2) & 0xFF) << 16 - | (buff.get(offset + 1) & 0xFF) << 8 - | (buff.get(offset) & 0xFF); - - } - - } - ret.updatePixels(); - } - - static public void convertARParam2(PApplet pa, String inputYAML, String outputDAT) throws Exception { - - CameraDevice cam = null; - - // Hack - if (inputYAML.endsWith(".xml")) { - convertARParamXML(pa, inputYAML, outputDAT); - return; - } - - CameraDevice[] c = CameraDevice.read(inputYAML); - if (c.length > 0) { - cam = c[0]; - } - CameraDevice.Settings camSettings = (org.bytedeco.javacv.CameraDevice.Settings) cam.getSettings(); - int w = camSettings.getImageWidth(); - int h = camSettings.getImageHeight(); - - double[] proj = cam.cameraMatrix.get(); - - PrintWriter pw = pa.createWriter(outputDAT); - - StringBuffer sb = new StringBuffer(); - -// byte[] buf = new byte[SIZE_OF_PARAM_SET]; -// ByteBuffer bb = ByteBuffer.wrap(buf); -// bb.order(ByteOrder.BIG_ENDIAN); -// bb.putInt(w); -// bb.putInt(h); - // From ARToolkitPlus... -//http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html - sb.append("ARToolKitPlus_CamCal_Rev02\n"); - sb.append(w).append(" ").append(h).append(" "); - - // cx cy fx fy - sb.append(proj[2]).append(" ").append(proj[5]) - .append(" ").append(proj[0]). - append(" ").append(proj[4]).append(" "); - - // alpha_c // skew factor  - sb.append("0 ").append(" "); - - if (cam.distortionCoeffs != null) { - double[] distort = cam.distortionCoeffs.get(); - // alpha_c ?  -// sb.append("0 "); - // kc(1 - x) -> 6 values - for (int i = 0; i < distort.length; i++) { - sb.append(distort[i]).append(" "); - } - for (int i = distort.length; i < 6; i++) { - sb.append("0 "); - } - } else { - for (int i = 0; i < 6; i++) { - sb.append("0 "); - } - } - // undist iterations - sb.append("10\n"); - - pw.print(sb); - pw.flush(); - pw.close(); - } - - static public void convertProjParam(PApplet pa, String inputYAML, String outputDAT) throws Exception { - - ProjectorDevice cam = null; - - ProjectorDevice[] c = ProjectorDevice.read(inputYAML); - if (c.length > 0) { - cam = c[0]; - } - ProjectorDevice.Settings projSettings = (org.bytedeco.javacv.ProjectorDevice.Settings) cam.getSettings(); - int w = projSettings.getImageWidth(); - int h = projSettings.getImageHeight(); - - double[] mat = cam.cameraMatrix.get(); - double[] distort = cam.distortionCoeffs.get(); - - OutputStream os = pa.createOutput(outputDAT); - - PrintWriter pw = pa.createWriter(outputDAT); - - StringBuffer sb = new StringBuffer(); - -// byte[] buf = new byte[SIZE_OF_PARAM_SET]; -// ByteBuffer bb = ByteBuffer.wrap(buf); -// bb.order(ByteOrder.BIG_ENDIAN); -// bb.putInt(w); -// bb.putInt(h); - // From ARToolkitPlus... -//http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html - sb.append("ARToolKitPlus_CamCal_Rev02\n"); - sb.append(w).append(" ").append(h).append(" "); - - // cx cy fx fy - sb.append(mat[2]).append(" ").append(mat[5]) - .append(" ").append(mat[0]). - append(" ").append(mat[4]).append(" "); - - // alpha_c // skew factor  - sb.append("0 ").append(" "); - - // alpha_c ?  -// sb.append("0 "); - // kc(1 - x) -> 6 values - for (int i = 0; i < distort.length; i++) { - sb.append(distort[i]).append(" "); - } - for (int i = distort.length; i < 6; i++) { - sb.append("0 "); - } - - // undist iterations - sb.append("10\n"); - - pw.print(sb); - pw.flush(); - pw.close(); - } - - static public void convertARParamXML(PApplet pa, String fileName, String outputDAT) throws Exception { - - System.out.println("Convert AR Param XML"); - CameraDevice cam = null; - - ProjectiveDeviceP pdp = ProjectiveDeviceP.loadCameraDevice(pa, fileName); - -// CameraDevice[] c = CameraDevice.read(fileName); -// if (c.length > 0) { -// cam = c[0]; -// } - OutputStream os = pa.createOutput(outputDAT); - PrintWriter pw = pa.createWriter(outputDAT); - StringBuffer sb = new StringBuffer(); - - // From ARToolkitPlus... - //http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html - sb.append("ARToolKitPlus_CamCal_Rev02\n"); - sb.append(pdp.getWidth()).append(" ").append(pdp.getHeight()).append(" "); - - // cx cy fx fy - sb.append(pdp.getCx()).append(" ").append(pdp.getCy()) - .append(" ").append(pdp.getFx()). - append(" ").append(pdp.getFy()).append(" "); - - // alpha_c // skew factor  - sb.append("0 ").append(" "); - - // kc(1 - x) -> 6 values - if (pdp.handleDistorsions()) { - double[] distort = ((CameraDevice) pdp.getDevice()).distortionCoeffs.get(); - - for (int i = 0; i < distort.length; i++) { - sb.append(distort[i]).append(" "); - } - // fill with 0s the end. - for (int i = distort.length; i < 5; i++) { - sb.append("0 "); - } - } else { - for (int i = 0; i < 5; i++) { - sb.append("0 "); - } - } - - // undist iterations - sb.append("10\n"); - - pw.print(sb); - pw.flush(); - pw.close(); - } - -} diff --git a/papart/src/fr/inria/papart/procam/camera/CamImage.java b/papart/src/fr/inria/papart/procam/camera/CamImage.java index dcda5203..b7da58a0 100755 --- a/papart/src/fr/inria/papart/procam/camera/CamImage.java +++ b/papart/src/fr/inria/papart/procam/camera/CamImage.java @@ -19,6 +19,7 @@ */ package fr.inria.papart.procam.camera; +import fr.inria.papart.procam.camera.Camera.PixelFormat; import java.awt.Image; import java.nio.ByteBuffer; import org.bytedeco.javacpp.opencv_core.IplImage; @@ -33,10 +34,15 @@ public abstract class CamImage extends PImage { protected Object bufferSink = null; protected ByteBuffer natBuffer = null; + protected Camera.PixelFormat incomingFormat; - protected CamImage(PApplet parent, int width, int height, int format) { + protected CamImage(PApplet parent, int width, int height, int format, PixelFormat incomingFormat) { super(width, height, format); + System.out.println("CamImage: create..."); + this.incomingFormat = incomingFormat; + System.out.println("CamImage: Creating a CamImage " + width + " " + height + " " + format + " " + incomingFormat.name()); camInit(parent); + System.out.println("CamImage: done."); } public CamImage(PApplet parent, Image img) { diff --git a/papart/src/fr/inria/papart/procam/camera/CamImageColor.java b/papart/src/fr/inria/papart/procam/camera/CamImageColor.java index b4041968..a4ad3204 100755 --- a/papart/src/fr/inria/papart/procam/camera/CamImageColor.java +++ b/papart/src/fr/inria/papart/procam/camera/CamImageColor.java @@ -19,7 +19,8 @@ */ package fr.inria.papart.procam.camera; -import fr.inria.papart.procam.Utils; +import fr.inria.papart.utils.ImageUtils; +import fr.inria.papart.utils.ARToolkitPlusUtils; import java.awt.Image; import java.nio.ByteBuffer; import org.bytedeco.javacpp.opencv_core.IplImage; @@ -36,19 +37,17 @@ public class CamImageColor extends CamImage { protected ByteBuffer argbBuffer; - public CamImageColor(PApplet parent, Image img) { super(parent, img); } - - public CamImageColor(PApplet parent, int width, int height) { - super(parent, width, height, ARGB); + + public CamImageColor(PApplet parent, int width, int height, Camera.PixelFormat format) { + super(parent, width, height, ARGB, format); } @Override protected final void camInit(PApplet parent) { this.parent = parent; - Texture tex = ((PGraphicsOpenGL) parent.g).getTexture(this); if (tex == null) { throw new RuntimeException("CamImage: Impossible to get the Processing Texture. " @@ -57,16 +56,27 @@ protected final void camInit(PApplet parent) { tex.setBufferSource(this); // Second time with bufferSource. tex = ((PGraphicsOpenGL) parent.g).getTexture(this); - - argbBuffer = ByteBuffer.allocateDirect(this.pixels.length * 4); + if (this.incomingFormat != Camera.PixelFormat.ARGB) { + argbBuffer = ByteBuffer.allocateDirect(this.pixels.length * 4); + } } @Override public void update(IplImage iplImage) { Texture tex = ((PGraphicsOpenGL) parent.g).getTexture(this); - ByteBuffer bgrBuffer = iplImage.getByteBuffer(); - Utils.byteBufferBRGtoARGB(bgrBuffer, argbBuffer); + ByteBuffer imageBuffer = iplImage.getByteBuffer(); + + if (this.incomingFormat == Camera.PixelFormat.BGR) { + ImageUtils.byteBufferBRGtoARGB(imageBuffer, argbBuffer); + } + if (this.incomingFormat == Camera.PixelFormat.RGB) { + ImageUtils.byteBufferRGBtoARGB(imageBuffer, argbBuffer); + } + if (this.incomingFormat == Camera.PixelFormat.ARGB) { + argbBuffer = iplImage.getByteBuffer(); + } tex.copyBufferFromSource(null, argbBuffer, width, height); + argbBuffer.rewind(); } } diff --git a/papart/src/fr/inria/papart/procam/camera/CamImageGray.java b/papart/src/fr/inria/papart/procam/camera/CamImageGray.java index 08a34682..3afaf465 100755 --- a/papart/src/fr/inria/papart/procam/camera/CamImageGray.java +++ b/papart/src/fr/inria/papart/procam/camera/CamImageGray.java @@ -1,6 +1,7 @@ /* * Part of the PapARt project - https://project.inria.fr/papart/ * + * Copyright (C) 2016 Jérémy Laviole * Copyright (C) 2014-2016 Inria * Copyright (C) 2011-2013 Bordeaux University * @@ -19,6 +20,9 @@ */ package fr.inria.papart.procam.camera; +import fr.inria.papart.utils.ImageUtils; +import fr.inria.papart.utils.ARToolkitPlusUtils; +import fr.inria.papart.procam.camera.Camera.PixelFormat; import java.awt.Image; import java.nio.ByteBuffer; import org.bytedeco.javacpp.opencv_core; @@ -32,12 +36,14 @@ */ public class CamImageGray extends CamImage { + protected ByteBuffer argbBuffer; + public CamImageGray(PApplet parent, Image img) { super(parent, img); } - public CamImageGray(PApplet parent, int width, int height) { - super(parent, width, height, GRAY); + public CamImageGray(PApplet parent, int width, int height, PixelFormat incomingFormat) { + super(parent, width, height, GRAY, incomingFormat); } @Override @@ -52,18 +58,34 @@ protected final void camInit(PApplet parent) { // Second time with bufferSource. tex = ((PGraphicsOpenGL) parent.g).getTexture(this); -// imageBuffer = ByteBuffer.allocateDirect(this.pixels.length); + argbBuffer = ByteBuffer.allocateDirect(this.pixels.length * 4); } @Override public void update(opencv_core.IplImage iplImage) { Texture tex = ((PGraphicsOpenGL) parent.g).getTexture(this); - ByteBuffer buffer = iplImage.getByteBuffer(); - + ByteBuffer imageBuffer = iplImage.getByteBuffer(); + + if (incomingFormat == PixelFormat.GRAY) { + ImageUtils.byteBufferGRAYtoARGB(imageBuffer, argbBuffer); + } + if (incomingFormat == PixelFormat.GRAY_32) { + ImageUtils.byteBufferGRAY32toARGB(imageBuffer, argbBuffer); + } + if (incomingFormat == PixelFormat.FLOAT_DEPTH_KINECT2) { + ImageUtils.byteBufferDepthK2toARGB(imageBuffer, argbBuffer); + } + if (incomingFormat == PixelFormat.DEPTH_KINECT_MM) { + ImageUtils.byteBufferDepthK1MMtoARGB(imageBuffer, argbBuffer); + } + if (incomingFormat == PixelFormat.REALSENSE_Z16) { + ImageUtils.byteBufferZ16toARGB(imageBuffer, argbBuffer); + } + // Utils.byteBufferBRGtoARGB(bgrBuffer, argbBuffer); - tex.copyBufferFromSource(null, buffer, width, height); - buffer.rewind(); + tex.copyBufferFromSource(null, argbBuffer, width, height); + imageBuffer.rewind(); } } diff --git a/papart/src/fr/inria/papart/procam/camera/Camera.java b/papart/src/fr/inria/papart/procam/camera/Camera.java index e8a17157..e498da20 100755 --- a/papart/src/fr/inria/papart/procam/camera/Camera.java +++ b/papart/src/fr/inria/papart/procam/camera/Camera.java @@ -23,14 +23,11 @@ * * @author jeremylaviole */ -import fr.inria.papart.graph.Node; import fr.inria.papart.procam.HasExtrinsics; +import fr.inria.papart.utils.ImageUtils; import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.procam.ProjectiveDeviceP; -import fr.inria.papart.procam.Utils; -import fr.inria.papart.procam.camera.CamImage; -import fr.inria.papart.procam.camera.CamImageColor; -import fr.inria.papart.procam.camera.CamImageGray; +import fr.inria.papart.utils.ARToolkitPlusUtils; import fr.inria.papart.tracking.DetectedMarker; import fr.inria.papart.tracking.MarkerList; import org.bytedeco.javacpp.opencv_core.CvMat; @@ -48,7 +45,7 @@ import processing.core.PMatrix3D; import processing.core.PVector; -public abstract class Camera extends Node implements PConstants, HasExtrinsics { +public abstract class Camera implements PConstants, HasExtrinsics { public static Camera INVALID_CAMERA = new CameraOpenCV(-1); @@ -65,13 +62,13 @@ public abstract class Camera extends Node implements PConstants, HasExtrinsics { private boolean hasExtrinsics = false; public enum Type { - - OPENCV, FFMPEG, OPENCV_DEPTH, PROCESSING, OPEN_KINECT, FLY_CAPTURE, KINECT2_RGB, KINECT2_IR, FAKE + OPENCV, FFMPEG, PROCESSING, REALSENSE, OPEN_KINECT, OPEN_KINECT_2, FLY_CAPTURE, + FAKE } public enum PixelFormat { - RGB, BGR, ARGB, RGBA, GRAY, DEPTH_KINECT_MM, DEPTH_KINECT_RAW + RGB, BGR, ARGB, RGBA, GRAY, GRAY_32, FLOAT_DEPTH_KINECT2, DEPTH_KINECT_MM, REALSENSE_Z16 } protected PixelFormat format; @@ -84,7 +81,7 @@ public enum PixelFormat { protected int width, height; protected int frameRate; protected boolean trackSheets = false; - private boolean isClosing = false; + protected boolean isClosing = false; protected boolean isConnected = false; protected boolean undistort = false; @@ -99,14 +96,16 @@ public enum PixelFormat { // Instance variables protected PApplet parent = null; - private List sheets = null; - - protected final Semaphore sheetsSemaphore = new Semaphore(1); + private final List sheets = Collections.synchronizedList(new ArrayList()); + private final Semaphore sheetsSemaphore = new Semaphore(1); // ARToolkit protected String calibrationARToolkit; + protected CameraThread thread = null; - private CameraThread thread = null; + protected List getSheets() { + return sheets; + } abstract public void start(); @@ -118,6 +117,16 @@ public String toString() { public PImage getImage() { return getPImage(); } + + public static Camera checkActingCamera(Camera camera) { + if (camera instanceof CameraRGBIRDepth) { + Camera acting = ((CameraRGBIRDepth) camera).getActingCamera(); + if (acting != null) { + camera = acting; + } + } + return camera; + } public abstract PImage getPImage(); @@ -139,29 +148,44 @@ protected void checkParameters() { if (this.systemNumber == -1 && cameraDescription == null) { throw new RuntimeException("Camera: initalization failed"); } + } + public void setSimpleCalibration(float fx, float fy, float cx, float cy) { + setSimpleCalibration(fx, fy, cx, cy, width(), height()); + } + public void setSimpleCalibration(float fx, float fy, float cx, float cy, int w, int h) { + this.calibrationFile = "manual calibration"; + pdp = ProjectiveDeviceP.createSimpleDevice(fx, fy, cx, cy, w, h); + updateCalibration(); } public void setCalibration(String fileName) { try { this.calibrationFile = fileName; - pdp = ProjectiveDeviceP.loadCameraDevice(parent, fileName); - camIntrinsicsP3D = pdp.getIntrinsics(); - this.width = pdp.getWidth(); - this.height = pdp.getHeight(); - this.undistort = pdp.handleDistorsions(); + updateCalibration(); } catch (Exception e) { e.printStackTrace(); - System.err.println("Camera: error reading the calibration " + pdp + "file" + fileName + " \n" + e); } } + private void updateCalibration() { + System.out.println("updateCalibrationcalled:"); + camIntrinsicsP3D = pdp.getIntrinsics(); + this.width = pdp.getWidth(); + this.height = pdp.getHeight(); + this.undistort = pdp.handleDistorsions(); + } + public PImage getPImageCopy() { PImage out = parent.createImage(this.width, this.height, RGB); - Utils.IplImageToPImage(currentImage, false, out); + if(currentImage == null){ + System.err.println("Error in PImageCopy(): no current image. "); + return out; + } + ImageUtils.IplImageToPImage(currentImage, false, out); return out; } @@ -173,12 +197,16 @@ public PImage getPImageCopy() { */ public PImage getPImageCopy(PApplet context) { PImage out = context.createImage(this.width, this.height, RGB); - Utils.IplImageToPImage(currentImage, this.format == PixelFormat.RGB, out); + + if(currentImage.nChannels() == 1){ + + } + ImageUtils.IplImageToPImage(currentImage, this.format == PixelFormat.RGB, out); return out; } public PImage getPImageCopyTo(PImage out) { - Utils.IplImageToPImage(currentImage, this.format, out); + ImageUtils.IplImageToPImage(currentImage, this.format, out); return out; } @@ -242,22 +270,18 @@ public String getCalibrationFile() { return this.calibrationFile; } - /** - * Initialize the tracking with ARToolkit plus. - * - * @param calibrationARToolkit - */ - public void initMarkerDetection(String calibrationARToolkit) { - // Marker Detection and view + public void setCalibrationARToolkit(String calibrationARToolkit) { this.calibrationARToolkit = calibrationARToolkit; - this.sheets = Collections.synchronizedList(new ArrayList()); - System.out.println("Init MARKER DETECTION " + this + " " + this.sheets); } public String getCalibrationARToolkit() { return calibrationARToolkit; } + protected Semaphore getSheetSemaphore() { + return sheetsSemaphore; + } + /** * Add a markerboard to track with this camera. * @@ -266,9 +290,9 @@ public String getCalibrationARToolkit() { public void trackMarkerBoard(MarkerBoard sheet) { sheet.addTracker(parent, this); try { - sheetsSemaphore.acquire(); + getSheetSemaphore().acquire(); this.sheets.add(sheet); - sheetsSemaphore.release(); + getSheetSemaphore().release(); } catch (InterruptedException ex) { System.out.println("Interrupted !"); Logger.getLogger(Camera.class.getName()).log(Level.SEVERE, null, ex); @@ -288,8 +312,6 @@ public void trackSheets(boolean auto) { if (thread != null) { thread.setCompute(auto); - } else { - System.err.println("Camera: Error AutoCompute only if threaded."); } } @@ -339,9 +361,7 @@ public void forceCurrentImage(IplImage img) { * @param img */ protected void updateCurrentImage(IplImage img) { - if (undistort) { - if (pdp == null || !pdp.handleDistorsions()) { System.err.println("I cannot distort the image for processing. The " + "calibration did not contain information. "); @@ -368,24 +388,29 @@ protected void updateCurrentImage(IplImage img) { */ protected void checkCamImage() { if (camImage == null) { - if (this.isPixelFormatGray()) { - camImage = new CamImageGray(parent, width(), height()); + camImage = new CamImageGray(parent, width(), height(), this.format); } if (this.isPixelFormatColor()) { - camImage = new CamImageColor(parent, width(), height()); + camImage = new CamImageColor(parent, width(), height(), this.format); + } + + if (!this.isPixelFormatColor() && !this.isPixelFormatGray()) { + System.out.println("Error: No pixel format set for the camera!"); } } } - protected boolean isPixelFormatGray() { + public boolean isPixelFormatGray() { PixelFormat pixelFormat = getPixelFormat(); return pixelFormat == PixelFormat.GRAY - || pixelFormat == PixelFormat.DEPTH_KINECT_MM - || pixelFormat == PixelFormat.DEPTH_KINECT_RAW; + || pixelFormat == PixelFormat.GRAY_32 + || pixelFormat == PixelFormat.REALSENSE_Z16 + || pixelFormat == PixelFormat.FLOAT_DEPTH_KINECT2 + || pixelFormat == PixelFormat.DEPTH_KINECT_MM; } - protected boolean isPixelFormatColor() { + public boolean isPixelFormatColor() { PixelFormat pixelFormat = getPixelFormat(); return pixelFormat == PixelFormat.ARGB || pixelFormat == PixelFormat.BGR @@ -480,7 +505,16 @@ static public void convertARParams(PApplet parent, String calibrationFile, // ARToolkit Plus 2.1.1 // fr.inria.papart.procam.Utils.convertARParam(parent, calibrationYAML, calibrationData, width, height); // ARToolkit Plus 2.3.0 - fr.inria.papart.procam.Utils.convertARParam2(parent, calibrationFile, calibrationARtoolkit); + fr.inria.papart.utils.ARToolkitPlusUtils.convertARParam2(parent, calibrationFile, calibrationARtoolkit); + } catch (Exception e) { + PApplet.println("Conversion error. " + e); + } + } + + static public void convertARParams(PApplet parent, ProjectiveDeviceP projectiveDevice, + String calibrationARtoolkit) { + try { + fr.inria.papart.utils.ARToolkitPlusUtils.convertARParamFromDevice(parent, projectiveDevice, calibrationARtoolkit); } catch (Exception e) { PApplet.println("Conversion error. " + e); } diff --git a/papart/src/fr/inria/papart/procam/camera/CameraFFMPEG.java b/papart/src/fr/inria/papart/procam/camera/CameraFFMPEG.java index c9079d11..00a51e9a 100644 --- a/papart/src/fr/inria/papart/procam/camera/CameraFFMPEG.java +++ b/papart/src/fr/inria/papart/procam/camera/CameraFFMPEG.java @@ -44,7 +44,7 @@ public class CameraFFMPEG extends Camera { protected CameraFFMPEG(String description, String imFormat) { this.cameraDescription = description; - this.setPixelFormat(Camera.PixelFormat.BGR); +// this.setPixelFormat(Camera.PixelFormat.RGB); this.imageFormat = imFormat; converter = new OpenCVFrameConverter.ToIplImage(); } @@ -52,17 +52,17 @@ protected CameraFFMPEG(String description, String imFormat) { @Override public void start() { FFmpegFrameGrabber grabberFF = new FFmpegFrameGrabber(this.cameraDescription); - grabberFF.setImageWidth(width()); - grabberFF.setImageHeight(height()); -// grabberCV.setFrameRate(60); - -// grabberFF.setImageMode(FrameGrabber.ImageMode.COLOR); - grabberFF.setImageMode(FrameGrabber.ImageMode.RAW); + + grabberFF.setImageMode(FrameGrabber.ImageMode.COLOR); - this.setPixelFormat(PixelFormat.RGB); + this.setPixelFormat(PixelFormat.BGR); grabberFF.setFormat(this.imageFormat); + grabberFF.setImageWidth(width()); + grabberFF.setImageHeight(height()); + grabberFF.setFrameRate(frameRate); + try { grabberFF.start(); this.grabber = grabberFF; @@ -85,28 +85,9 @@ public void grab() { return; } try { - - if(parent.millis() > 5000){ - Frame frame = grabber.grab(); - Buffer b = frame.image[0]; -// byte[] arr = ((ByteBuffer) b).array(); -// System.out.println("Data: " + arr[0]); -// System.out.println("Data: " + arr[1]); - } -// IplImage img = converter.convertToIplImageDepth(grabber.grab()); -// -// -// if (img != null) { -// System.out.println(img.asByteBuffer().get(100)); -// System.out.println(img.asByteBuffer().get(101)); -// -// System.out.println("ipl depth: " + img.depth()); -// System.out.println("ipl channels: " + img.nChannels()); -// -// this.updateCurrentImage(img); -// } + this.updateCurrentImage(converter.convertToIplImage(grabber.grab())); } catch (Exception e) { - System.err.println("Camera: OpenCV Grab() Error ! " + e); + System.err.println("Camera: FFMPEG Grab() Error ! " + e); e.printStackTrace(); } } diff --git a/papart/src/fr/inria/papart/procam/camera/CameraFactory.java b/papart/src/fr/inria/papart/procam/camera/CameraFactory.java index e5c0ad33..21b71327 100755 --- a/papart/src/fr/inria/papart/procam/camera/CameraFactory.java +++ b/papart/src/fr/inria/papart/procam/camera/CameraFactory.java @@ -19,49 +19,14 @@ */ package fr.inria.papart.procam.camera; -import fr.inria.papart.procam.camera.Camera.Type; - /** * * @author Jeremy Laviole */ public class CameraFactory { - /** - * - * @param type either OPENCV_VIDEO or KINECT_VIDEO - * @param cameraNo id of the Camera starting from 0. - * @return - */ - public static Camera createCamera(Camera.Type type, int cameraNo) { - if (type == Type.PROCESSING) { - throw new RuntimeException("PROCESSING_VIDEO requires a String describing the camera."); - } - - Camera camera; - switch (type) { - case OPENCV: - camera = new CameraOpenCV(cameraNo); - break; - case KINECT2_RGB: // Hack for now with V4L loopback. - camera = new CameraOpenCV(0); - break; - case KINECT2_IR: // Hack for now with V4L loopback. - camera = new CameraOpenCV(2); - break; - case OPENCV_DEPTH: - camera = new CameraOpenCVDepth(cameraNo); - break; - case OPEN_KINECT: - camera = new CameraOpenKinect(cameraNo); - break; - case FLY_CAPTURE: - camera = new CameraFlyCapture(cameraNo); - break; - default: - throw new RuntimeException("ProCam, Camera: Unspported camera Type"); - } - return camera; + public static Camera createCamera(Camera.Type type) { + return createCamera(type, "0", ""); } public static Camera createCamera(Camera.Type type, String description) { @@ -73,35 +38,75 @@ public static Camera createCamera(Camera.Type type, String description) { * @param type must be PROCESSING_VIDEO or FFMPEG * @param description device of the camera (/dev/video0) or name. see the * Processing GettingStartedCamera example to get the name. + * @param format either ffmpeg format information, or RGB, IR, DEPTH to + * specify the default camera type. * @return */ public static Camera createCamera(Camera.Type type, String description, String format) { - Camera camera; + Camera camera = null; + CameraRGBIRDepth cameraMulti = null; + int cameraNo = 0; +// System.out.println("CameraFactory: new " + type.name() + ", " + description + " " + format); + boolean isInt = false; + try { + cameraNo = Integer.parseInt(description); + isInt = true; + } catch (NumberFormatException e) { + isInt = false; + } + boolean isRGB = format.equalsIgnoreCase("rgb") || format.equalsIgnoreCase("color"); + boolean isIR = format.equalsIgnoreCase("ir"); + boolean isDepth = format.equalsIgnoreCase("depth"); + + // classes to remove: + // camera = new CameraOpenCVDepth(cameraNo); switch (type) { case FFMPEG: camera = new CameraFFMPEG(description, format); break; case PROCESSING: camera = new CameraProcessing(description); + break; + // Depth Cameras + case OPEN_KINECT_2: + cameraMulti = new CameraOpenKinect2(cameraNo); + break; + case REALSENSE: + cameraMulti = new CameraRealSense(cameraNo); + break; + case OPEN_KINECT: + cameraMulti = new CameraOpenKinect(cameraNo); + break; + case OPENCV: + camera = new CameraOpenCV(cameraNo); + break; + case FLY_CAPTURE: + camera = new CameraFlyCapture(cameraNo); + break; default: - boolean isInt = checkInt(description); - if (!isInt) { - throw new RuntimeException("The description must be a number for this type."); - } - return createCamera(type, Integer.parseInt(description)); + throw new RuntimeException("ProCam, Camera: Unspported camera Type"); } - return camera; - } - - private static boolean checkInt(String str) { - try { - Integer.parseInt(str); - return true; - } catch (NumberFormatException e) { - return false; + if (cameraMulti != null) { + if (isRGB) { + cameraMulti.setUseColor(true); + cameraMulti.actAsColorCamera(); + } + if (isIR) { + cameraMulti.setUseIR(true); + cameraMulti.actAsIRCamera(); + } + if (isDepth) { + cameraMulti.setUseDepth(true); + cameraMulti.actAsDepthCamera(); + } + return cameraMulti; + } + if (camera != null) { + return camera; } + throw new RuntimeException("ProCam, Camera: Unspported camera Type"); } } diff --git a/papart/src/fr/inria/papart/procam/camera/CameraOpenCV.java b/papart/src/fr/inria/papart/procam/camera/CameraOpenCV.java index 5d9085ed..5dc37793 100755 --- a/papart/src/fr/inria/papart/procam/camera/CameraOpenCV.java +++ b/papart/src/fr/inria/papart/procam/camera/CameraOpenCV.java @@ -46,7 +46,7 @@ public void start() { OpenCVFrameGrabber grabberCV = new OpenCVFrameGrabber(this.systemNumber); grabberCV.setImageWidth(width()); grabberCV.setImageHeight(height()); -// grabberCV.setFrameRate(60); + grabberCV.setFrameRate(frameRate); grabberCV.setImageMode(FrameGrabber.ImageMode.COLOR); try { diff --git a/papart/src/fr/inria/papart/procam/camera/CameraOpenCVDepth.java b/papart/src/fr/inria/papart/procam/camera/CameraOpenCVDepth.java deleted file mode 100644 index 5eadd353..00000000 --- a/papart/src/fr/inria/papart/procam/camera/CameraOpenCVDepth.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.procam.camera; - -import fr.inria.papart.multitouch.KinectTouchInput; -import org.bytedeco.javacpp.opencv_core; -import org.bytedeco.javacpp.opencv_core.IplImage; -import org.bytedeco.javacv.FrameGrabber; -import org.bytedeco.javacv.OpenCVFrameConverter; -import org.bytedeco.javacv.OpenCVFrameGrabber; -import processing.core.PImage; - -/** - * WARNING, THIS IS NOT USED, AND MAYBE NOT WORKING AT ALL. - * @author Jeremy Laviole - */ -public class CameraOpenCVDepth extends Camera { - - private OpenCV16BitFrameGrabber grabber; - private final OpenCVFrameConverter.ToIplImage converter; - private KinectTouchInput touchInput; - public Camera colorCamera; - - protected CameraOpenCVDepth(int cameraNo) { - this.systemNumber = cameraNo; -// this.setPixelFormat(PixelFormat.RGB); - converter = new OpenCVFrameConverter.ToIplImage(); - } - - @Override - public void start() { - OpenCV16BitFrameGrabber grabberCV = new OpenCV16BitFrameGrabber(this.systemNumber); - System.out.println("Starting the grabber with " + width() + " " + height()); - grabberCV.setImageWidth(width()); - grabberCV.setImageHeight(height()); - grabberCV.setImageMode(FrameGrabber.ImageMode.RAW); - - try { - grabberCV.start(); - - System.out.println("Format : " + grabberCV.getFormat()); - - this.grabber = grabberCV; - this.isConnected = true; - } catch (Exception e) { - System.err.println("Could not start frameGrabber... " + e); - - System.err.println("Could not camera start frameGrabber... " + e); - System.err.println("Camera ID " + this.systemNumber + " could not start."); - System.err.println("Check cable connection, ID and resolution asked."); - - this.grabber = null; - } - } - - @Override - public void grab() { - - if (this.isClosing()) { - return; - } - try { - IplImage img = converter.convertToIplImage(grabber.grab()); - if (img != null) { - this.updateCurrentImage(img); - } - -// System.out.println("Grabbing Depth Kinect2..."); - this.currentImage = img; - if (touchInput != null) { - touchInput.lock(); - System.out.println("Touch input update..."); - touchInput.update(); - - touchInput.getTouch2DColors(colorCamera.getIplImage()); - touchInput.unlock(); - } else { - if (touchInput != null) { - System.err.println("Error, the TouchInput is set, but no DepthImg is grabbed."); - } - } - - } catch (Exception e) { - System.err.println("Camera: OpenCV Grab() Error ! " + e); - } - } - - @Override - public PImage getPImage() { - - if (currentImage != null) { - this.checkCamImage(); - camImage.update(currentImage); - return camImage; - } - // TODO: exceptions !!! - return null; - } - - @Override - public void close() { - this.setClosing(); - if (grabber != null) { - try { - grabber.stop(); - System.out.println("Stopping grabber (OpenCV depth)"); - - } catch (Exception e) { - System.out.println("Impossible to close " + e); - } - } - } - - public void setTouchInput(KinectTouchInput kinectTouchInput) { - this.touchInput = kinectTouchInput; - } - - public void setColorCamera(Camera camera) { - this.colorCamera = camera; - } - -} diff --git a/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect.java b/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect.java index c136bb74..de87e30b 100755 --- a/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect.java +++ b/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect.java @@ -19,84 +19,29 @@ */ package fr.inria.papart.procam.camera; -import fr.inria.papart.graph.Displayable; -import fr.inria.papart.multitouch.KinectTouchInput; -import fr.inria.papart.procam.Utils; -import java.util.HashMap; +import java.util.logging.Level; +import java.util.logging.Logger; import org.bytedeco.javacpp.freenect; -import org.bytedeco.javacpp.opencv_core.IplImage; +import org.bytedeco.javacv.FrameGrabber; import org.bytedeco.javacv.OpenKinectFrameGrabber; -import processing.core.PApplet; -import processing.core.PImage; /** * * @author Jeremy Laviole */ -public class CameraOpenKinect extends Camera implements Displayable { +public class CameraOpenKinect extends CameraRGBIRDepth { - private boolean isGrabbingDepth = false; protected OpenKinectFrameGrabber grabber; - - private CameraOpenKinectDepth depthCamera; + int kinectVideoFormat; protected CameraOpenKinect(int cameraNo) { this.systemNumber = cameraNo; - this.setPixelFormat(PixelFormat.BGR); - - depthCamera = new CameraOpenKinectDepth(this); - } - - @Override - public void start() { grabber = new OpenKinectFrameGrabber(this.systemNumber); - grabber.setImageWidth(width()); - grabber.setImageHeight(height()); - - try { - grabber.start(); - grabber.setVideoFormat(freenect.FREENECT_VIDEO_RGB); - - depthCamera.start(); - - this.isConnected = true; - } catch (Exception e) { - System.err.println("Could not Kinect start frameGrabber... " + e); - System.err.println("Kinect ID " + this.systemNumber + " could not start."); - System.err.println("Check cable connection and ID."); - } } @Override - public void grab() { - - if (this.isClosing()) { - return; - } - - try { - IplImage img = grabber.grabVideo(); - updateCurrentImage(img); - - if (this.isGrabbingDepth) { - depthCamera.grab(); - } - - } catch (Exception e) { - System.err.println("Camera: Kinect Grab() Error ! " + e); - e.printStackTrace(); - } - } - - @Override - public PImage getPImage() { - this.checkCamImage(); - if (currentImage != null) { - camImage.update(currentImage); - return camImage; - } - // TODO: exceptions !!! - return null; + public void internalStart() throws FrameGrabber.Exception { + grabber.start(); } @Override @@ -107,48 +52,81 @@ public void close() { System.out.println("Stopping KinectGrabber"); this.stopThread(); grabber.stop(); - if(this.isGrabbingDepth){ - depthCamera.close(); - } + depthCamera.close(); } catch (Exception e) { } } } - public void setTouch(KinectTouchInput touchInput) { - this.setGrabDepth(true); - depthCamera.setTouchInput(touchInput); + @Override + public void grabIR() { + try { + IRCamera.updateCurrentImage(grabber.grabIR()); + } catch (FrameGrabber.Exception ex) { + Logger.getLogger(CameraOpenKinect.class.getName()).log(Level.SEVERE, null, ex); + } } - public CameraOpenKinectDepth getDepthCamera() { - this.setGrabDepth(true); - return this.depthCamera; + @Override + public void grabDepth() { + try { + depthCamera.currentImage = grabber.grabDepth(); + + ((WithTouchInput) depthCamera).newTouchImageWithColor(colorCamera.currentImage); + } catch (FrameGrabber.Exception ex) { + Logger.getLogger(CameraOpenKinect.class.getName()).log(Level.SEVERE, null, ex); + } } - public void setGrabDepth(boolean grabDepth) { - this.isGrabbingDepth = grabDepth; + @Override + public void grabColor() { + try { + colorCamera.updateCurrentImage(grabber.grabVideo()); + } catch (FrameGrabber.Exception ex) { + Logger.getLogger(CameraOpenKinect.class.getName()).log(Level.SEVERE, null, ex); + } } - HashMap imageMap = new HashMap(); + @Override + public void setUseDepth(boolean use) { + if (use) { + depthCamera.setPixelFormat(PixelFormat.DEPTH_KINECT_MM); + depthCamera.type = SubCamera.Type.DEPTH; + depthCamera.setSize(640, 480); + grabber.setDepthFormat(freenect.FREENECT_DEPTH_MM); + } + this.useDepth = use; + } @Override - public void prepareToDisplayOn(PApplet display) { - PImage image = display.createImage(this.width, this.height, RGB); - imageMap.put(display, image); + public void setUseIR(boolean use) { + if (use) { + IRCamera.setPixelFormat(PixelFormat.GRAY); + IRCamera.type = SubCamera.Type.IR; + IRCamera.setSize(640, 480); + // grabber.setvideoformat ? + } + this.useIR = use; } @Override - public PImage getDisplayedOn(PApplet display) { - PImage image = imageMap.get(display); - Utils.IplImageToPImage(currentImage, false, image); - return image; + public void setUseColor(boolean use) { + if (use) { + colorCamera.setPixelFormat(PixelFormat.BGR); + colorCamera.type = SubCamera.Type.COLOR; + colorCamera.setSize(640, 480); + + grabber.setImageWidth(colorCamera.width()); + grabber.setImageHeight(colorCamera.height()); + kinectVideoFormat = freenect.FREENECT_VIDEO_RGB; + grabber.setVideoFormat(kinectVideoFormat); + } + this.useColor = use; } @Override - public boolean canBeDisplayedOn(PApplet display) { - return imageMap.containsKey(display); + protected void internalGrab() throws Exception { } - } diff --git a/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect2.java b/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect2.java new file mode 100755 index 00000000..a9d77da9 --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/CameraOpenKinect2.java @@ -0,0 +1,136 @@ +/* + * Part of the PapARt project - https://project.inria.fr/papart/ + * + * Copyright (C) 2014-2016 Inria + * Copyright (C) 2011-2013 Bordeaux University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; If not, see + * . + */ +package fr.inria.papart.procam.camera; + +import org.bytedeco.javacpp.opencv_core; +import org.bytedeco.javacv.FrameGrabber; +import org.bytedeco.javacv.OpenKinect2FrameGrabber; +import processing.core.PImage; + +/** + * + * @author Jeremy Laviole + */ +public class CameraOpenKinect2 extends CameraRGBIRDepth { + + protected OpenKinect2FrameGrabber grabber; + + class Kinect2SubCamera extends SubCamera { + + public Kinect2SubCamera(CameraRGBIRDepth mainCamera) { + super(mainCamera); + } + + @Override + public PImage getPImage() { + System.out.println("Kinect2: Get PImage"); + mainCamera.grab(); + return super.getPImage(); + } + } + + protected CameraOpenKinect2(int cameraNo) { + this.systemNumber = cameraNo; + colorCamera = new Kinect2SubCamera(this); + grabber = new OpenKinect2FrameGrabber(this.systemNumber); + } + + @Override + public void internalStart() throws FrameGrabber.Exception { + grabber.start(); + } + + /** + * * + * Warning BUG: cannot grab in a thread and display as PImage in another. + * + * @throws Exception + */ + @Override + protected void internalGrab() throws Exception { + System.out.println("Grab called." + Thread.currentThread()); + grabber.grab(); + } + + @Override + public void close() { + setClosing(); + if (grabber != null) { + try { + this.stopThread(); + grabber.stop(); + } catch (Exception e) { + } + } + } + + @Override + public void setUseIR(boolean use) { + if (use) { + IRCamera.setPixelFormat(PixelFormat.GRAY_32); + IRCamera.type = SubCamera.Type.IR; + IRCamera.setSize(512, 424); + grabber.enableIRStream(); + } + this.useIR = use; + } + + @Override + public void setUseDepth(boolean use) { + if (use) { + depthCamera.setPixelFormat(PixelFormat.FLOAT_DEPTH_KINECT2); + depthCamera.type = SubCamera.Type.DEPTH; + depthCamera.setSize(512, 424); + grabber.enableDepthStream(); + } + this.useDepth = use; + } + + @Override + public void setUseColor(boolean use) { + if (use) { + colorCamera.setPixelFormat(PixelFormat.ARGB); + colorCamera.type = SubCamera.Type.COLOR; + colorCamera.setSize(1920, 1080); + grabber.enableColorStream(); + } + this.useColor = use; + } + + @Override + public void grabIR() { + IRCamera.updateCurrentImage(grabber.getIRImage()); + } + + @Override + public void grabDepth() { + depthCamera.currentImage = grabber.getDepthImage(); + ((WithTouchInput) depthCamera).newTouchImageWithColor(colorCamera.currentImage); + } + + @Override + public void grabColor() { + opencv_core.IplImage videoImage = grabber.getVideoImage(); + if (videoImage != null) { + colorCamera.updateCurrentImage(videoImage); + } + } + +} diff --git a/papart/src/fr/inria/papart/procam/camera/CameraOpenKinectDepth.java b/papart/src/fr/inria/papart/procam/camera/CameraOpenKinectDepth.java deleted file mode 100755 index ad0e6f58..00000000 --- a/papart/src/fr/inria/papart/procam/camera/CameraOpenKinectDepth.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.procam.camera; - -import fr.inria.papart.multitouch.KinectTouchInput; -import fr.inria.papart.procam.Utils; -import org.bytedeco.javacpp.freenect; -import org.bytedeco.javacpp.opencv_core.IplImage; -import processing.core.PApplet; -import processing.core.PImage; - -/** - * - * @author Jeremy Laviole - */ -public class CameraOpenKinectDepth extends Camera { - - private CameraOpenKinect parent; - private int depthFormat = freenect.FREENECT_DEPTH_MM; - // other possibility freenect.FREENECT_DEPTH_10_BIT -> Obselete; - - private IplImage depthImage; - private KinectTouchInput touchInput; - private PImage camImageDepth = null; - - protected CameraOpenKinectDepth(CameraOpenKinect parent) { - this.parent = parent; - this.setPixelFormat(PixelFormat.DEPTH_KINECT_MM); - } - - // Nothing, this is virtual... - @Override - public void start() { - parent.grabber.setDepthFormat(depthFormat); - } - - @Override - public void grab() { - try { - IplImage img = parent.grabber.grabDepth(); - - this.currentImage = img; - if (touchInput != null) { - touchInput.lock(); - touchInput.update(); - touchInput.getTouch2DColors(parent.currentImage); - touchInput.unlock(); - } else { - if (touchInput != null) { - System.err.println("Error, the TouchInput is set, but no DepthImg is grabbed."); - } - } - } catch (Exception e) { - System.err.println("Camera: Kinect Grab depth Error ! " + e); - e.printStackTrace(); - } - - } - - @Override - public PImage getPImage() { - if (camImageDepth == null) { - camImageDepth = parent.parent.createImage(width, height, PApplet.ALPHA); - } - - if (depthImage != null) { - Utils.IplImageToPImageKinect(depthImage, false, camImageDepth); - } - return camImageDepth; - } - - @Override - public void close() { - setClosing(); - } - - public KinectTouchInput getTouchInput() { - return touchInput; - } - - public void setTouchInput(KinectTouchInput touchInput) { - this.touchInput = touchInput; - } - - public int getDepthFormat() { - return depthFormat; - } - - public void setDepthFormat(int depthFormat) { - this.depthFormat = depthFormat; - } - -} diff --git a/papart/src/fr/inria/papart/procam/camera/CameraRGBIRDepth.java b/papart/src/fr/inria/papart/procam/camera/CameraRGBIRDepth.java new file mode 100644 index 00000000..a551816a --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/CameraRGBIRDepth.java @@ -0,0 +1,518 @@ +/* + * Copyright (C) 2016 jiii. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package fr.inria.papart.procam.camera; + +import fr.inria.papart.procam.ProjectiveDeviceP; +import fr.inria.papart.tracking.DetectedMarker; +import fr.inria.papart.tracking.MarkerBoard; +import java.util.List; +import java.util.concurrent.Semaphore; +import org.bytedeco.javacpp.opencv_core; +import org.bytedeco.javacv.OpenKinectFrameGrabber; +import processing.core.PApplet; +import processing.core.PImage; +import processing.core.PMatrix3D; +import processing.core.PVector; + +/** + * + * @author jiii + */ +public abstract class CameraRGBIRDepth extends Camera { + + protected SubDepthCamera depthCamera; + protected SubCamera colorCamera; + protected SubCamera IRCamera; + private SubCamera actAsCamera = null; + + protected boolean useIR = false; + protected boolean useDepth = false; + protected boolean useColor = false; + + public CameraRGBIRDepth() { + colorCamera = new SubCamera(this, SubCamera.Type.COLOR); + depthCamera = new SubDepthCamera(this, SubCamera.Type.DEPTH); + IRCamera = new SubCamera(this, SubCamera.Type.IR); + } + + @Override + public void setParent(PApplet parent) { + super.setParent(parent); + if (depthCamera != null) { + depthCamera.setParent(parent); + } + if (IRCamera != null) { + IRCamera.setParent(parent); + } + if (colorCamera != null) { + colorCamera.setParent(parent); + } + } + + public SubDepthCamera getDepthCamera() { + return this.depthCamera; + } + + public SubCamera getIRCamera() { + return this.IRCamera; + } + + public SubCamera getColorCamera() { + return this.colorCamera; + } + + public SubCamera getActingCamera() { + return this.actAsCamera; + } + + public opencv_core.IplImage getDepthImage() { + return depthCamera.getIplImage(); + } + + public PImage getDepthPImage() { + if (useDepth) { + return depthCamera.getPImage(); + } + return null; + } + + public PImage getColorImage() { + if (useColor) { + return colorCamera.getPImage(); + } + return null; + } + + public PImage getIRImage() { + if (useIR) { + return IRCamera.getPImage(); + } + return null; + } + + protected abstract void grabIR(); + + protected abstract void grabDepth(); + + protected abstract void grabColor(); + + public void disable(SubCamera camera) { + if (camera.type == SubCamera.Type.DEPTH) { + setUseDepth(false); + } + if (camera.type == SubCamera.Type.IR) { + setUseIR(false); + } + if (camera.type == SubCamera.Type.COLOR) { + setUseColor(false); + } + } + + void grab(SubCamera camera) { + if (camera.type == SubCamera.Type.COLOR) { + grabColor(); + } + if (camera.type == SubCamera.Type.IR) { + grabIR(); + } + if (camera.type == SubCamera.Type.DEPTH) { + grabDepth(); + } + } + + protected abstract void internalStart() throws Exception; + + protected boolean isStarting = false; + + @Override + public void start() { + isStarting = true; + try { + if (isUseColor()) { + colorCamera.start(); + } + if (isUseDepth()) { + depthCamera.start(); + } + if (isUseIR()) { + IRCamera.start(); + } + internalStart(); + this.isConnected = true; + } catch (Exception e) { + System.err.println("Could not start frameGrabber... " + e); + System.err.println("Depth camera ID " + this.systemNumber + " could not start."); + System.err.println("Check cable connection and ID."); + e.printStackTrace(); + } + isStarting = false; + } + + protected abstract void internalGrab() throws Exception; + + @Override + public void grab() { + + if (this.isClosing()) { + return; + } + // update the images. + try { + internalGrab(); + + if (useColor) { + colorCamera.grab(); + } + + if (useIR) { + IRCamera.grab(); + } + + if (useDepth) { + depthCamera.grab(); + } + + if (actAsCamera != null) { + currentImage = actAsCamera.currentImage; + } + } catch (Exception e) { + System.out.println("Exception :" + e); + e.printStackTrace(); + } + } + + public void actAsColorCamera() { + actAsCamera = colorCamera; + } + + public void actAsIRCamera() { + actAsCamera = IRCamera; + } + + public void actAsDepthCamera() { + actAsCamera = depthCamera; + } + + // Generated delegate methods... + @Override + public PImage getPImage() { + return actAsCamera.getPImage(); + } + + @Override + public String toString() { + if (actAsCamera == null) { + return "RGBDIR camear"; + } + return actAsCamera.toString(); + } + + @Override + public PImage getImage() { + return actAsCamera.getImage(); + } + + @Override + void setMarkers(DetectedMarker[] detectedMarkers) { + actAsCamera.setMarkers(detectedMarkers); + } + + @Override + protected void checkParameters() { + actAsCamera.checkParameters(); + } + + @Override + public void setSimpleCalibration(float fx, float fy, float cx, float cy, int w, int h) { + actAsCamera.setSimpleCalibration(fx, fy, cx, cy, w, h); + } + + @Override + public void setCalibration(String fileName) { + actAsCamera.setCalibration(fileName); + } + + @Override + public PImage getPImageCopy() { + return actAsCamera.getPImageCopy(); + } + + @Override + public PImage getPImageCopy(PApplet context) { + return actAsCamera.getPImageCopy(context); + } + + @Override + public PImage getPImageCopyTo(PImage out) { + return actAsCamera.getPImageCopyTo(out); + } + + @Override + public void setCameraDevice(String description) { + actAsCamera.setCameraDevice(description); + } + + @Override + protected String getCameraDevice() { + return actAsCamera.getCameraDevice(); + } + + @Override + public void setSystemNumber(int systemNumber) { + actAsCamera.setSystemNumber(systemNumber); + } + + @Override + public void setFrameRate(int frameRate) { + actAsCamera.setFrameRate(frameRate); + } + + @Override + public int width() { + return actAsCamera.width(); + } + + @Override + public int height() { + return actAsCamera.height(); + } + + @Override + public void setSize(int width, int height) { + actAsCamera.setSize(width, height); + } + + @Override + public int getFrameRate() { + return actAsCamera.getFrameRate(); + } + + @Override + public boolean isUndistort() { + return actAsCamera.isUndistort(); + } + + @Override + public void setUndistort(boolean undistort) { + actAsCamera.setUndistort(undistort); + } + + @Override + public boolean isCalibrated() { + return actAsCamera.isCalibrated(); + } + + @Override + public String getCalibrationFile() { + return actAsCamera.getCalibrationFile(); + } + + @Override + public void setCalibrationARToolkit(String calibrationARToolkit) { + actAsCamera.setCalibrationARToolkit(calibrationARToolkit); + } + + @Override + public String getCalibrationARToolkit() { + return actAsCamera.getCalibrationARToolkit(); + } + + @Override + public void trackMarkerBoard(MarkerBoard sheet) { + System.out.println("In trackMarkerboard in CameaRGBIRDepth BAAAADD"); + actAsCamera.trackMarkerBoard(sheet); + } + + @Override + public void trackSheets(boolean auto) { + actAsCamera.trackSheets(auto); + } + + @Override + public boolean tracks(MarkerBoard board) { + return actAsCamera.tracks(board); + } + + @Override + public List getTrackedSheets() { + return actAsCamera.getTrackedSheets(); + } + + @Override + public DetectedMarker[] getDetectedMarkers() { + return actAsCamera.getDetectedMarkers(); + } + + @Override + protected Semaphore getSheetSemaphore() { + return actAsCamera.getSheetSemaphore(); + } + + /** + * SetThread called by a subcamera, either color or IR (not checked). + * + * @param subCam + */ + void setThread(SubCamera subCam) { + if (thread == null) { + thread = new CameraThread(this); + thread.setCompute(subCam.trackSheets); + subCam.thread = thread; + + thread.setCompute(trackSheets); + thread.start(); + } else { + System.err.println("Camera: Error Thread already launched"); + } + } + + /** + * Called from aynwhere, start the thread and use the acting camera to track + * sheets of paper. + */ + @Override + public void setThread() { + if (thread == null) { + thread = new CameraThread(this); + if (this.actAsCamera != null) { + thread.setCompute(actAsCamera.trackSheets); + actAsCamera.thread = thread; + } else { + thread.setCompute(trackSheets); + } + + thread.start(); + } else { + System.err.println("Camera: Error Thread already launched"); + } + + if (useDepth) { + depthCamera.thread = thread; + } + if (useColor) { + colorCamera.thread = thread; + } + if (useIR) { + IRCamera.thread = thread; + } + } + + @Override + public void forceCurrentImage(opencv_core.IplImage img) { + actAsCamera.forceCurrentImage(img); + } + + @Override + protected void updateCurrentImage(opencv_core.IplImage img) { + actAsCamera.updateCurrentImage(img); + } + + @Override + protected void checkCamImage() { + actAsCamera.checkCamImage(); + } + + @Override + public boolean isPixelFormatGray() { + return actAsCamera.isPixelFormatGray(); + } + + @Override + public boolean isPixelFormatColor() { + return actAsCamera.isPixelFormatColor(); + } + + @Override + public opencv_core.IplImage getIplImage() { + return actAsCamera.getIplImage(); + } + + @Override + public ProjectiveDeviceP getProjectiveDevice() { + return actAsCamera.getProjectiveDevice(); + } + + @Override + protected void setClosing() { + super.setClosing(); + } + + @Override + public boolean isClosing() { + if (actAsCamera == null) { + return super.isClosing(); + } + return actAsCamera.isClosing(); + } + + @Override + public Camera.PixelFormat getPixelFormat() { + return actAsCamera.getPixelFormat(); + } + + @Override + public void setPixelFormat(Camera.PixelFormat format) { + actAsCamera.setPixelFormat(format); + } + + @Override + public boolean hasExtrinsics() { + return actAsCamera.hasExtrinsics(); + } + + @Override + public PMatrix3D getExtrinsics() { + return actAsCamera.getExtrinsics(); + } + + @Override + public void setExtrinsics(PMatrix3D extrinsics) { + actAsCamera.setExtrinsics(extrinsics); + } + + @Override + public PVector getViewPoint(PVector point) { + return actAsCamera.getViewPoint(point); + } + + public boolean isUseIR() { + return useIR; + } + + public void setUseIR(boolean useIR) { + this.useIR = useIR; + } + + public boolean isUseDepth() { + return useDepth; + } + + public void setUseDepth(boolean useDepth) { + this.useDepth = useDepth; + } + + public boolean isUseColor() { + return useColor; + } + + public void setUseColor(boolean useColor) { + this.useColor = useColor; + } + +} diff --git a/papart/src/fr/inria/papart/procam/camera/CameraRealSense.java b/papart/src/fr/inria/papart/procam/camera/CameraRealSense.java new file mode 100755 index 00000000..88113123 --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/CameraRealSense.java @@ -0,0 +1,261 @@ +/* + * Part of the PapARt project - https://project.inria.fr/papart/ + * + * Copyright (C) 2014-2016 Inria + * Copyright (C) 2011-2013 Bordeaux University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; If not, see + * . + */ +package fr.inria.papart.procam.camera; + +import java.nio.FloatBuffer; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.bytedeco.javacpp.RealSense; +import org.bytedeco.javacpp.opencv_core; +import org.bytedeco.javacv.Frame; +import org.bytedeco.javacv.FrameGrabber; +import org.bytedeco.javacv.RealSenseFrameGrabber; +import processing.core.PMatrix3D; + +/** + * + * @author Jeremy Laviole + */ +public class CameraRealSense extends CameraRGBIRDepth { + + protected RealSenseFrameGrabber grabber; + private boolean useHardwareIntrinsics = true; + + protected CameraRealSense(int cameraNo) { + try { + RealSenseFrameGrabber.tryLoad(); + } catch (FrameGrabber.Exception ex) { + Logger.getLogger(CameraRealSense.class.getName()).log(Level.SEVERE, null, ex); + } + this.systemNumber = cameraNo; + grabber = new RealSenseFrameGrabber(this.systemNumber); + + } + + public RealSenseFrameGrabber getFrameGrabber() { + return this.grabber; + } + + public void useHardwareIntrinsics(boolean use) { + this.useHardwareIntrinsics = use; + } + + @Override + public void internalStart() throws FrameGrabber.Exception { + + if (useColor) { + System.out.println("Init Camera RealSense: " + colorCamera.width() + " " + colorCamera.height()); + grabber.setImageWidth(colorCamera.width()); + grabber.setImageHeight(colorCamera.height()); + if (colorCamera.width() == 1280) { + grabber.setFrameRate(60); + } else { + grabber.setFrameRate(colorCamera.getFrameRate()); +// grabber.setFrameRate(30); + } + + grabber.enableColorStream(); + } + + if (useIR) { + grabber.setIRImageWidth(IRCamera.width()); + grabber.setIRImageHeight(IRCamera.height()); + grabber.setIRFrameRate(IRCamera.getFrameRate()); + grabber.enableIRStream(); + } + + if (useDepth) { + grabber.setDepthImageWidth(depthCamera.width()); + grabber.setDepthImageHeight(depthCamera.height()); + grabber.setDepthFrameRate(depthCamera.getFrameRate()); + grabber.setPreset(5); + grabber.enableDepthStream(); + } + grabber.start(); + + // Override the calibration... + if (useHardwareIntrinsics) { + if (useColor) { + useHarwareIntrinsics(colorCamera, grabber); + System.out.println("setting hardware intrinsics for Realsense.."); + } + if (useIR) { + useHarwareIntrinsics(IRCamera, grabber); + } + if (useDepth) { + useHarwareIntrinsics(depthCamera, grabber); + } + } + + } + + @Override + public void internalGrab() throws Exception { + grabber.grab(); + } + + public Frame grabFrame() { + try { + return grabber.grab(); + } catch (FrameGrabber.Exception ex) { + Logger.getLogger(CameraRealSense.class.getName()).log(Level.SEVERE, null, ex); + } + return null; + } + + public float getDepthScale() { + return grabber.getDepthScale(); + } + + @Override + public void close() { + this.setClosing(); + if (grabber != null) { + try { + grabber.stop(); + System.out.println("Stopping grabber (RealSense)"); + + } catch (Exception e) { + System.out.println("Impossible to close " + e); + } + } + } + + @Override + public void grabColor() { + opencv_core.IplImage video = grabber.grabVideo(); + if (video != null) { + colorCamera.updateCurrentImage(video); + } + } + + @Override + public void grabIR() { + IRCamera.updateCurrentImage(grabber.grabIR()); + } + + @Override + public void grabDepth() { + depthCamera.updateCurrentImage(grabber.grabDepth()); + // update the touch input + + if (getActingCamera() == IRCamera) { + ((WithTouchInput) depthCamera).newTouchImageWithColor(IRCamera.currentImage); + return; + } + if (getActingCamera() == colorCamera || useColor) { + ((WithTouchInput) depthCamera).newTouchImageWithColor(colorCamera.currentImage); + return; + } + ((WithTouchInput) depthCamera).newTouchImage(); + } + + @Override + public void setUseIR(boolean use) { + if (use) { + IRCamera.setSize(640, 480); + IRCamera.setPixelFormat(PixelFormat.GRAY); + IRCamera.setFrameRate(30); + } else { + grabber.disableIRStream(); + } + this.useIR = use; + } + + @Override + public void setUseDepth(boolean use) { + if (use) { + depthCamera.setPixelFormat(PixelFormat.REALSENSE_Z16); + depthCamera.setSize(640, 480); + depthCamera.setFrameRate(30); + } else { + grabber.disableDepthStream(); + } + this.useDepth = use; + } + + @Override + public void setUseColor(boolean use) { + // todo: boolean or not ? + if (!use) { + grabber.disableColorStream(); + } else { + colorCamera.setPixelFormat(PixelFormat.RGB); + + // default values + colorCamera.setSize(1280, 720); +// colorCamera.setFrameRate(30); + + // Default values to get Color with multi-touch depth tracking. +// this.setSize(1280, 720); + } + this.useColor = use; + } + + @Override + public void setSize(int w, int h) { + Camera act = getActingCamera(); + + if (act == null) { + + // it is likely that the set size was for the color camera then. + if (useColor) { + colorCamera.setSize(w, h); + } + return; + } else { + act.setSize(w, h); + } + } + + public PMatrix3D getHardwareExtrinsics() { + RealSense.extrinsics extrinsics = grabber.getRealSenseDevice().get_extrinsics(RealSense.color, RealSense.depth); + FloatBuffer fb = extrinsics.position(0).asByteBuffer().asFloatBuffer(); + return new PMatrix3D( + fb.get(0), fb.get(3), fb.get(6), -fb.get(9) * 1000f, + fb.get(1), fb.get(4), fb.get(7), fb.get(10) * 1000f, + fb.get(2), fb.get(5), fb.get(8), fb.get(11) * 1000f, + 0, 0, 0, 1); + } + + public static void useHarwareIntrinsics(SubCamera camera, RealSenseFrameGrabber grabber) { + if (camera == null || camera == Camera.INVALID_CAMERA) { + return; + } + int camType = 0; + if (camera.type == SubCamera.Type.COLOR) { + camType = RealSense.color; + } + if (camera.type == SubCamera.Type.IR) { + camType = RealSense.infrared; + } + if (camera.type == SubCamera.Type.DEPTH) { + camType = RealSense.depth; + } + System.out.println("Setting hardware intrinsics for: " + camera.type.name()); + RealSense.intrinsics intrinsics = grabber.getRealSenseDevice().get_stream_intrinsics(camType); + FloatBuffer fb = intrinsics.position(0).asByteBuffer().asFloatBuffer(); + float cx = fb.get(2); + float cy = fb.get(3); + float fx = fb.get(4); + float fy = fb.get(5); + camera.setSimpleCalibration(fx, fy, cx, cy); + } +} diff --git a/papart/src/fr/inria/papart/procam/camera/CameraThread.java b/papart/src/fr/inria/papart/procam/camera/CameraThread.java index 6657018c..3ce42a52 100755 --- a/papart/src/fr/inria/papart/procam/camera/CameraThread.java +++ b/papart/src/fr/inria/papart/procam/camera/CameraThread.java @@ -30,9 +30,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.bytedeco.javacpp.ARToolKitPlus; -import static org.bytedeco.javacpp.ARToolKitPlus.MARKER_ID_BCH; -import static org.bytedeco.javacpp.ARToolKitPlus.PIXEL_FORMAT_LUM; -import static org.bytedeco.javacpp.ARToolKitPlus.UNDIST_NONE; import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U; import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY; import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor; @@ -44,6 +41,7 @@ class CameraThread extends Thread { private final Camera camera; + Camera cameraForMarkerboard; private boolean compute; private IplImage image, grayImage; private DetectedMarker[] detectedMarkers; @@ -74,20 +72,35 @@ private void initThreadPool() { @Override public void run() { + cameraForMarkerboard = camera; + while (!stop) { + checkSubCamera(); camera.grab(); + // If there is no camera for tracking... + if (cameraForMarkerboard == null || !compute || camera.getTrackedSheets().isEmpty()) { + continue; + } image = camera.getIplImage(); - // TODO: check if img can be null... - if (image != null && compute && !camera.getTrackedSheets().isEmpty()) { + if (image != null) { this.compute(); } + } + } + private void checkSubCamera() { + if (!(camera instanceof CameraRGBIRDepth)) { + return; + } + Camera actAsCam = ((CameraRGBIRDepth) camera).getActingCamera(); + if (actAsCam != null) { + cameraForMarkerboard = actAsCam; } } public void compute() { try { - camera.sheetsSemaphore.acquire(); + camera.getSheetSemaphore().acquire(); tryComputeGrayScale(); tryToFindMarkers(); @@ -95,15 +108,22 @@ public void compute() { // updateSequential(); updateParallel(); - camera.sheetsSemaphore.release(); + camera.getSheetSemaphore().release(); } catch (InterruptedException ex) { Logger.getLogger(CameraThread.class.getName()).log(Level.SEVERE, null, ex); } } private void tryComputeGrayScale() { + +// if (image.depth() == IPL_DEPTH_8U) { + if (image.nChannels() == 1) { + grayImage = image; + return; + } + for (MarkerBoard sheet : camera.getTrackedSheets()) { - if (sheet.useGrayscaleImages()) { + if (sheet.useMarkers()) { if (grayImage == null) { initGrayScale(); } @@ -121,6 +141,7 @@ private void tryToFindMarkers() { } this.detectedMarkers = computeMarkerLocations(); camera.setMarkers(this.detectedMarkers); +// System.out.println("Detected markers: " + detectedMarkers.length); break; } } @@ -156,10 +177,11 @@ protected void updateSequential() { } protected void updateBoardLocation(MarkerBoard markerBoard) { - if (markerBoard.useGrayscaleImages()) { - markerBoard.updateLocation(camera, grayImage, this.detectedMarkers); + // The markerboard will know the real camera, not the top-level camera. + if (markerBoard.useMarkers()) { + markerBoard.updateLocation(cameraForMarkerboard, grayImage, this.detectedMarkers); } else { - markerBoard.updateLocation(camera, image, null); + markerBoard.updateLocation(cameraForMarkerboard, image, null); } } diff --git a/papart/src/fr/inria/papart/procam/camera/OpenCV16BitFrameGrabber.java b/papart/src/fr/inria/papart/procam/camera/OpenCV16BitFrameGrabber.java deleted file mode 100644 index c89b44e9..00000000 --- a/papart/src/fr/inria/papart/procam/camera/OpenCV16BitFrameGrabber.java +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Part of the PapARt project - https://project.inria.fr/papart/ - * - * Copyright (C) 2014-2016 Inria - * Copyright (C) 2011-2013 Bordeaux University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation, version 2.1. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; If not, see - * . - */ -package fr.inria.papart.procam.camera; - -import java.io.File; -import org.bytedeco.javacpp.Loader; -import org.bytedeco.javacpp.opencv_core; -import static org.bytedeco.javacpp.opencv_core.CV_16UC1; -import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY; -import static org.bytedeco.javacpp.opencv_imgproc.CV_GRAY2BGR; -import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor; -import org.bytedeco.javacpp.opencv_videoio; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_CONVERT_RGB; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FORMAT; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FOURCC; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FPS; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FRAME_COUNT; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FRAME_HEIGHT; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_FRAME_WIDTH; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_MODE; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_POS_FRAMES; -import static org.bytedeco.javacpp.opencv_videoio.CV_CAP_PROP_POS_MSEC; -import static org.bytedeco.javacpp.opencv_videoio.cvCreateCameraCapture; -import static org.bytedeco.javacpp.opencv_videoio.cvCreateFileCapture; -import static org.bytedeco.javacpp.opencv_videoio.cvGetCaptureProperty; -import static org.bytedeco.javacpp.opencv_videoio.cvGrabFrame; -import static org.bytedeco.javacpp.opencv_videoio.cvQueryFrame; -import static org.bytedeco.javacpp.opencv_videoio.cvReleaseCapture; -import static org.bytedeco.javacpp.opencv_videoio.cvRetrieveFrame; -import static org.bytedeco.javacpp.opencv_videoio.cvSetCaptureProperty; -import org.bytedeco.javacv.Frame; -import org.bytedeco.javacv.FrameConverter; -import org.bytedeco.javacv.FrameGrabber; -import org.bytedeco.javacv.OpenCVFrameConverter; - -/** - * - * @author Samuel Audet - * @author Jérémy Laviole - jeremy.laviole@inria.fr - */ -public class OpenCV16BitFrameGrabber extends FrameGrabber { - - public static String[] getDeviceDescriptions() throws FrameGrabber.Exception { - tryLoad(); - throw new UnsupportedOperationException("Device enumeration not support by OpenCV."); - } - - public static OpenCV16BitFrameGrabber createDefault(File deviceFile) throws FrameGrabber.Exception { - return new OpenCV16BitFrameGrabber(deviceFile); - } - - public static OpenCV16BitFrameGrabber createDefault(String devicePath) throws FrameGrabber.Exception { - return new OpenCV16BitFrameGrabber(devicePath); - } - - public static OpenCV16BitFrameGrabber createDefault(int deviceNumber) throws FrameGrabber.Exception { - return new OpenCV16BitFrameGrabber(deviceNumber); - } - - private static FrameGrabber.Exception loadingException = null; - - public static void tryLoad() throws FrameGrabber.Exception { - if (loadingException != null) { - throw loadingException; - } else { - try { - Loader.load(org.bytedeco.javacpp.opencv_highgui.class); - } catch (Throwable t) { - throw loadingException = new FrameGrabber.Exception("Failed to load " + OpenCV16BitFrameGrabber.class, t); - } - } - } - - public OpenCV16BitFrameGrabber(int deviceNumber) { - this.deviceNumber = deviceNumber; - } - - public OpenCV16BitFrameGrabber(File file) { - this(file.getAbsolutePath()); - } - - public OpenCV16BitFrameGrabber(String filename) { - this.filename = filename; - } - - public void release() throws FrameGrabber.Exception { - stop(); - } - - @Override - protected void finalize() throws Throwable { - super.finalize(); - release(); - } - - private int deviceNumber = 0; - private String filename = null; - private opencv_videoio.CvCapture capture = null; - private opencv_core.IplImage return_image = null; - private FrameConverter converter = new OpenCVFrameConverter.ToIplImage(); - - @Override - public double getGamma() { - // default to a gamma of 2.2 for cheap Webcams, DV cameras, etc. - if (gamma == 0.0) { - return 2.2; - } else { - return gamma; - } - } - - @Override - public String getFormat() { - if (capture == null) { - return super.getFormat(); - } else { - int fourcc = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FOURCC); - return "" + (char) (fourcc & 0xFF) - + (char) ((fourcc >> 8) & 0xFF) - + (char) ((fourcc >> 16) & 0xFF) - + (char) ((fourcc >> 24) & 0xFF); - } - } - - @Override - public int getImageWidth() { - if (return_image != null) { - return return_image.width(); - } else { - return capture == null ? super.getImageWidth() : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH); - } - } - - @Override - public int getImageHeight() { - if (return_image != null) { - return return_image.height(); - } else { - return capture == null ? super.getImageHeight() : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT); - } - } - - @Override - public int getPixelFormat() { - return capture == null ? super.getPixelFormat() : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB); - } - - @Override - public double getFrameRate() { - return capture == null ? super.getFrameRate() : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS); - } - - @Override - public void setImageMode(FrameGrabber.ImageMode imageMode) { - if (imageMode != this.imageMode) { - return_image = null; - } - super.setImageMode(imageMode); - } - - @Override - public int getFrameNumber() { - return capture == null ? super.getFrameNumber() - : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES); - } - - @Override - public void setFrameNumber(int frameNumber) throws FrameGrabber.Exception { - if (capture == null) { - super.setFrameNumber(frameNumber); - } else { - if (cvSetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES, frameNumber) == 0) { - throw new FrameGrabber.Exception("cvSetCaptureProperty() Error: Could not set CV_CAP_PROP_POS_FRAMES to " + frameNumber + "."); - } - } - } - - @Override - public long getTimestamp() { - return capture == null ? super.getTimestamp() - : Math.round(cvGetCaptureProperty(capture, CV_CAP_PROP_POS_MSEC) * 1000); - } - - @Override - public void setTimestamp(long timestamp) throws FrameGrabber.Exception { - if (capture == null) { - super.setTimestamp(timestamp); - } else { - if (cvSetCaptureProperty(capture, CV_CAP_PROP_POS_MSEC, timestamp / 1000.0) == 0) { - throw new FrameGrabber.Exception("cvSetCaptureProperty() Error: Could not set CV_CAP_PROP_POS_MSEC to " + timestamp / 1000.0 + "."); - } - } - } - - @Override - public int getLengthInFrames() { - return capture == null ? super.getLengthInFrames() - : (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_COUNT); - } - - @Override - public long getLengthInTime() { - return Math.round(getLengthInFrames() * 1000000L / getFrameRate()); - } - - public void start() throws FrameGrabber.Exception { - if (filename != null && filename.length() > 0) { - capture = cvCreateFileCapture(filename); - if (capture == null) { - throw new FrameGrabber.Exception("cvCreateFileCapture() Error: Could not create camera capture."); - } - } else { - capture = cvCreateCameraCapture(deviceNumber); - if (capture == null) { - throw new FrameGrabber.Exception("cvCreateCameraCapture() Error: Could not create camera capture."); - } - } - if (imageWidth > 0) { - if (cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, imageWidth) == 0) { - cvSetCaptureProperty(capture, CV_CAP_PROP_MODE, imageWidth); // ?? - } - } - if (imageHeight > 0) { - if (cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, imageHeight) == 0) { - cvSetCaptureProperty(capture, CV_CAP_PROP_MODE, imageHeight); // ?? - } - } - if (frameRate > 0) { - cvSetCaptureProperty(capture, CV_CAP_PROP_FPS, frameRate); - } - - // set the fourCC to Y16 -> V4L2_PIX_FMT_Y16; - cvSetCaptureProperty(capture, CV_CAP_PROP_FOURCC, new FourCC("Y16 ").toInt()); - cvSetCaptureProperty(capture, CV_CAP_PROP_FORMAT, CV_16UC1); - - // Take the gray images... -// cvSetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB, imageMode == FrameGrabber.ImageMode.COLOR ? 1 : 0); - cvSetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB, -1); -// cvSetCaptureProperty(capture, CV_CAP_PROP_CONVERT_RGB, 0); - - // Before cvRetrieveFrame() starts returning something else then null - // QTKit sometimes requires some "warm-up" time for some reason... - // The first frame on Linux is sometimes null as well, - // so it's probably a good idea to run this for all platforms... ? - int count = 0; - while (count++ < 100 && cvGrabFrame(capture) != 0 && cvRetrieveFrame(capture) == null) { - try { - Thread.sleep(100); - } catch (InterruptedException ex) { - } - } - - if (!triggerMode) { - int err = cvGrabFrame(capture); - if (err == 0) { - throw new FrameGrabber.Exception("cvGrabFrame() Error: Could not grab frame. (Has start() been called?)"); - } - } - } - - public void stop() throws FrameGrabber.Exception { - if (capture != null) { - cvReleaseCapture(capture); - capture = null; - } - } - - public void trigger() throws FrameGrabber.Exception { - for (int i = 0; i < numBuffers + 1; i++) { - cvQueryFrame(capture); - } - int err = cvGrabFrame(capture); - if (err == 0) { - throw new FrameGrabber.Exception("cvGrabFrame() Error: Could not grab frame. (Has start() been called?)"); - } - } - - public Frame grab() throws FrameGrabber.Exception { - opencv_core.IplImage image = cvRetrieveFrame(capture); - -// System.out.println("Image data size: " + image.getByteBuffer().capacity()); - - if (image == null) { - throw new FrameGrabber.Exception("cvRetrieveFrame() Error: Could not retrieve frame. (Has start() been called?)"); - } - if (!triggerMode) { - int err = cvGrabFrame(capture); - if (err == 0) { - throw new FrameGrabber.Exception("cvGrabFrame() Error: Could not grab frame. (Has start() been called?)"); - } - } - - if (return_image == null) { - System.out.println("Creating in image with w, h: " + image.width() + " " + image.height()); - System.out.println("Creating in image with depth: " + image.depth()); - return_image = opencv_core.IplImage.create(image.width(), image.height(), image.depth(), 3); - } - return_image = image; - return converter.convert(return_image); - } -} diff --git a/papart/src/fr/inria/papart/procam/camera/ProjectorAsCamera.java b/papart/src/fr/inria/papart/procam/camera/ProjectorAsCamera.java index abe617ee..3f164ab3 100644 --- a/papart/src/fr/inria/papart/procam/camera/ProjectorAsCamera.java +++ b/papart/src/fr/inria/papart/procam/camera/ProjectorAsCamera.java @@ -20,10 +20,15 @@ package fr.inria.papart.procam.camera; import fr.inria.papart.procam.ProjectiveDeviceP; -import fr.inria.papart.procam.Utils; +import fr.inria.papart.utils.ARToolkitPlusUtils; +import fr.inria.papart.procam.display.ProjectorDisplay; import java.util.logging.Level; import java.util.logging.Logger; +import org.bytedeco.javacpp.opencv_core; +import static org.bytedeco.javacpp.opencv_core.IPL_DEPTH_8U; import org.bytedeco.javacpp.opencv_core.IplImage; +import static org.bytedeco.javacpp.opencv_imgproc.CV_BGR2GRAY; +import static org.bytedeco.javacpp.opencv_imgproc.cvCvtColor; import processing.core.PApplet; import processing.core.PImage; @@ -33,10 +38,22 @@ */ public class ProjectorAsCamera extends Camera { + private final TrackedView projectorView; + private final Camera cameraTracking; + private IplImage grayImage; + private final ProjectorDisplay projector; + + public ProjectorAsCamera(ProjectorDisplay projector, Camera cameraTracking, TrackedView view) { + this.projectorView = view; + this.cameraTracking = cameraTracking; + this.projector = projector; + } + public void setImage(IplImage image) { this.currentImage = image; } + @Override public void setCalibration(String fileName) { try { this.calibrationFile = fileName; @@ -59,7 +76,7 @@ public void setCalibration(String fileName) { static public void convertARProjParams(PApplet parent, String calibrationFile, String calibrationARtoolkit) { try { - Utils.convertProjParam(parent, calibrationFile, calibrationARtoolkit); + ARToolkitPlusUtils.convertProjParam(parent, calibrationFile, calibrationARtoolkit); } catch (Exception ex) { System.out.println("Error converting projector to ARToolkit " + calibrationFile + " " + calibrationARtoolkit @@ -87,6 +104,34 @@ public PImage getPImage() { */ @Override public void grab() { + IplImage img = projectorView.getIplViewOf(cameraTracking); + if (img != null) { + currentImage = img; + if (this.format == PixelFormat.GRAY) { + currentImage = greyProjectorImage(img); + } + } + } + + private opencv_core.IplImage greyProjectorImage(opencv_core.IplImage projImage) { + + if (projImage.nChannels() == 1) { + grayImage = projImage; + return grayImage; + } + + if (grayImage == null) { + grayImage = opencv_core.IplImage.create(projector.getWidth(), + projector.getHeight(), + IPL_DEPTH_8U, 1); + } + + cvCvtColor(projImage, grayImage, CV_BGR2GRAY); + // if(test){ + // cvSaveImage( sketchPath() + "/data/projImage.jpg", grayImage); + // cvSaveImage( sketchPath() + "/data/camImage.jpg", camera.getIplImage()); + // } + return grayImage; } /** diff --git a/papart/src/fr/inria/papart/procam/camera/SubCamera.java b/papart/src/fr/inria/papart/procam/camera/SubCamera.java new file mode 100644 index 00000000..ae0320da --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/SubCamera.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2016 jiii. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package fr.inria.papart.procam.camera; + +import processing.core.PImage; + +/** + * + * @author jiii + */ +public class SubCamera extends Camera { + + public enum Type { + IR, COLOR, DEPTH + } + + protected CameraRGBIRDepth mainCamera; + public Type type; + + public SubCamera(CameraRGBIRDepth mainCamera) { + this.mainCamera = mainCamera; + } + public SubCamera(CameraRGBIRDepth mainCamera, Type type) { + this.mainCamera = mainCamera; + this.type = type; + } + + public Camera getMainCamera() { + return mainCamera; + } + + @Override + public void start() { + if (!mainCamera.isStarting) { + throw new RuntimeException("Cannot start a subCamera: start the main camera instead."); + } + isConnected = true; + } + + @Override + public void grab() { + if (isConnected) { + mainCamera.grab(this); + } + } + + @Override + public void close() { + this.setClosing(); + this.isConnected = false; + mainCamera.disable(this); + } + + /** + * It makes the camera update continuously. + */ + public void setThread() { + // thread must be of the main camera... + mainCamera.setThread(this); + + if (thread == null) { + thread = new CameraThread(this); + thread.setCompute(this.trackSheets); + thread.start(); + } else { + System.err.println("Camera: Error Thread already launched"); + } + } + + @Override + public PImage getPImage() { + // TODO: time management to avoid to send multiple times the same + // frame to the graphics card. + this.checkCamImage(); + if (currentImage != null) { + camImage.update(currentImage); +// return camImage; + } + return camImage; + } +} diff --git a/papart/src/fr/inria/papart/procam/camera/SubDepthCamera.java b/papart/src/fr/inria/papart/procam/camera/SubDepthCamera.java new file mode 100644 index 00000000..5c3e00b7 --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/SubDepthCamera.java @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2016 jiii. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package fr.inria.papart.procam.camera; + +import fr.inria.papart.multitouch.KinectTouchInput; +import fr.inria.papart.multitouch.TouchInput; +import org.bytedeco.javacpp.opencv_core; + +/** + * + * @author jiii + */ +public class SubDepthCamera extends SubCamera implements WithTouchInput{ + + private KinectTouchInput touchInput; + + public SubDepthCamera(CameraRGBIRDepth mainCamera) { + super(mainCamera); + } + + public SubDepthCamera(CameraRGBIRDepth mainCamera, Type type) { + super(mainCamera, type); + } + + @Override + public KinectTouchInput getTouchInput() { + return touchInput; + } + + @Override + public void setTouchInput(KinectTouchInput touchInput) { + this.touchInput = touchInput; + } + + @Override + public void newTouchImageWithColor(opencv_core.IplImage colorImage) { + if (touchInput != null) { + touchInput.lock(); + touchInput.update(); + touchInput.getTouch2DColors(colorImage); + touchInput.unlock(); + } else if (touchInput != null) { + System.err.println("Error, the TouchInput is set, but no DepthImg is grabbed."); + } + } + @Override + public void newTouchImage() { + if (touchInput != null) { + touchInput.lock(); + touchInput.update(); + touchInput.unlock(); + } else if (touchInput != null) { + System.err.println("Error, the TouchInput is set, but no DepthImg is grabbed."); + } + } +} diff --git a/papart/src/fr/inria/papart/procam/camera/TrackedView.java b/papart/src/fr/inria/papart/procam/camera/TrackedView.java index 45df2f18..c3ec998d 100755 --- a/papart/src/fr/inria/papart/procam/camera/TrackedView.java +++ b/papart/src/fr/inria/papart/procam/camera/TrackedView.java @@ -19,10 +19,11 @@ */ package fr.inria.papart.procam.camera; +import fr.inria.papart.utils.ImageUtils; import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.tracking.MarkerBoardInvalid; import fr.inria.papart.procam.PaperScreen; -import fr.inria.papart.procam.Utils; +import fr.inria.papart.utils.ARToolkitPlusUtils; import fr.inria.papart.procam.camera.Camera; import org.bytedeco.javacpp.opencv_core.CvMat; import org.bytedeco.javacpp.opencv_core.IplImage; @@ -37,7 +38,7 @@ */ public class TrackedView { - private PImage extractedImage = null; + private PImage extractedPImage = null; private IplImage extractedIplImage = null; // private data @@ -87,22 +88,24 @@ public TrackedView() { allocateMemory(); } - /** - * - * @param corners - */ + private boolean cornersSet = false; + public void setCorners(PVector[] corners) { if (corners.length == 4) { for (int i = 0; i < 4; i++) { screenPixelCoordinates[i] = corners[i]; } + cornersSet = true; } - } public void init() { - extractedImage = new PImage(imageWidthPx, imageHeightPx, PApplet.RGB); + init(PApplet.RGB); + } + public void init(int frameType) { + // TODO: Init with good color... + extractedPImage = new PImage(imageWidthPx, imageHeightPx, frameType); initiateImageCoordinates(); } @@ -120,44 +123,63 @@ private void initiateImageCoordinates() { } public PImage getViewOf(Camera camera) { - if (extractedImage == null) { - System.err.println("You should init the TrackedView before getting the view."); - return null; - } - if (camera.getIplImage() == null) { + camera = Camera.checkActingCamera(camera); + + IplImage img = camera.getIplImage(); + if (!isExtractionReady(img)) { return null; } - - this.mainImage = camera.getIplImage(); + + this.mainImage = img; this.camera = camera; CvMat homography = computeHomography(); - Utils.remapImage(homography, camera.getIplImage(), extractedIplImage, extractedImage); - return extractedImage; + + boolean useRGB = camera.getPixelFormat() == Camera.PixelFormat.RGB; + // Convert to the good type... + ImageUtils.remapImage(homography, img, extractedIplImage, extractedPImage, useRGB); + return extractedPImage; } public IplImage getIplViewOf(Camera camera) { - if (camera.getIplImage() == null) { + IplImage img = camera.getIplImage(); + if (!isExtractionReady(img)) { return null; } - this.mainImage = camera.getIplImage(); + this.mainImage = img; this.camera = camera; CvMat homography = computeHomography(); - Utils.remapImageIpl(homography, camera.getIplImage(), extractedIplImage); + ImageUtils.remapImageIpl(homography, camera.getIplImage(), extractedIplImage); return extractedIplImage; } + private boolean isExtractionReady(IplImage img) { + if (extractedPImage == null) { + System.err.println("You should init the TrackedView before getting the view."); + return false; + } + + if(img != null){ + checkMemory(img); + } + + return img != null && (!useManualConrers || (useManualConrers && cornersSet)); + } + private CvMat computeHomography() { - checkMemory(); computeCorners(); - CvMat homography = Utils.createHomography(screenPixelCoordinates, imagePixelCoordinates); + CvMat homography = ImageUtils.createHomography(screenPixelCoordinates, imagePixelCoordinates); return homography; } - private void checkMemory() { + private void checkMemory(IplImage memory) { if (extractedIplImage == null) { - extractedIplImage = Utils.createImageFrom(extractedImage); + extractedIplImage = ImageUtils.createNewSizeImageFrom(memory,imageWidthPx, imageHeightPx); + + if (extractedIplImage == null) { + System.err.println("Impossible to create a View! " + this + " " + extractedPImage); + } } } @@ -241,6 +263,7 @@ private void computeCorners() { for (int i = 0; i < 4; i++) { screenPixelCoordinates[i] = camera.pdp.worldToPixel(corner3DPos[i], true); } + cornersSet = true; } public MarkerBoard getBoard() { @@ -265,6 +288,10 @@ public void setBottomLeftCorner(PVector bottomLeftCorner) { this.bottomLeftCorner.set(bottomLeftCorner); this.isYUp = true; } + + public void forceYOrientation(boolean up){ + this.isYUp = up; + } /** * Use either TopLeftCorner OR BottomLeftCorner. Calling one will discard diff --git a/papart/src/fr/inria/papart/procam/camera/WithTouchInput.java b/papart/src/fr/inria/papart/procam/camera/WithTouchInput.java new file mode 100644 index 00000000..62feac8b --- /dev/null +++ b/papart/src/fr/inria/papart/procam/camera/WithTouchInput.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2016 Jérémy Laviole - jeremy.laviole@inria.fr. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +package fr.inria.papart.procam.camera; + +import fr.inria.papart.multitouch.KinectTouchInput; +import org.bytedeco.javacpp.opencv_core.IplImage; + +/** + * + * @author Jérémy Laviole - jeremy.laviole@inria.fr + */ +public interface WithTouchInput { + + public KinectTouchInput getTouchInput(); + public void setTouchInput(KinectTouchInput touchInput) ; + public void newTouchImage(); + public void newTouchImageWithColor(IplImage image); +} diff --git a/papart/src/fr/inria/papart/procam/display/ARDisplay.java b/papart/src/fr/inria/papart/procam/display/ARDisplay.java index b98cfafa..b6c97def 100755 --- a/papart/src/fr/inria/papart/procam/display/ARDisplay.java +++ b/papart/src/fr/inria/papart/procam/display/ARDisplay.java @@ -22,22 +22,17 @@ import fr.inria.papart.calibration.PlaneCalibration; import processing.opengl.PGraphicsOpenGL; import org.bytedeco.javacv.ProjectiveDevice; -import fr.inria.papart.drawingapp.DrawUtils; +import fr.inria.papart.utils.DrawUtils; import fr.inria.papart.multitouch.TouchInput; -import fr.inria.papart.multitouch.TouchPoint; -import fr.inria.papart.procam.HasCamera; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.procam.HasExtrinsics; -import fr.inria.papart.tracking.MarkerBoard; import fr.inria.papart.procam.ProjectiveDeviceP; import fr.inria.papart.procam.Screen; -import java.util.ArrayList; import processing.core.PApplet; import processing.core.PImage; import processing.core.PMatrix3D; import processing.core.PVector; import processing.opengl.PShader; -import toxi.geom.Plane; import toxi.geom.Ray3D; import toxi.geom.ReadonlyVec3D; import toxi.geom.Vec3D; @@ -46,7 +41,7 @@ * * @author jeremy */ -public class ARDisplay extends BaseDisplay implements HasExtrinsics{ +public class ARDisplay extends BaseDisplay implements HasExtrinsics { // public PGraphicsOpenGL graphicsUndist; private PImage mapImg; @@ -67,6 +62,12 @@ public class ARDisplay extends BaseDisplay implements HasExtrinsics{ private boolean distort = false; + /** + * Warning Not used directly. + * + * @param parent + * @param calibrationYAML + */ public ARDisplay(PApplet parent, String calibrationYAML) { super(parent); loadCalibration(calibrationYAML); @@ -103,6 +104,18 @@ protected void loadCalibration(String calibrationYAML) { } } + /** + * * + * Reload the intrinsic calibration from the camera. + */ + public void reloadCalibration() { + setCalibration(camera.getProjectiveDevice()); + } + + public void setCalibration(Camera c) { + setCalibration(c.getProjectiveDevice()); + } + protected void setCalibration(ProjectiveDeviceP pdp) { // Load the camera parameters. // pdp = ProjectiveDeviceP.loadProjectiveDevice(calibrationYAML, 0); @@ -117,9 +130,13 @@ protected void setCalibration(ProjectiveDeviceP pdp) { this.frameHeight = pdp.getHeight(); this.drawingSizeX = frameWidth; this.drawingSizeY = frameHeight; - - // TODO: no more distorsions Processing3 test - // this.setDistort(pdp.handleDistorsions()); + + if (this.graphics != null) { + updateIntrinsicsRendering(); + } + + // TODO: To set back when the distorsions are properly computed +// this.setDistort(pdp.handleDistorsions()); this.setDistort(false); } @@ -165,8 +182,10 @@ public void draw() { drawScreensOver(); parent.noStroke(); - if (camera != null && camera.getPImage() != null) { - parent.image(camera.getPImage(), 0, 0, parent.width, parent.height); + PImage img = camera.getPImage(); + + if (camera != null && img != null) { + parent.image(img, 0, 0, parent.width, parent.height); // ((PGraphicsOpenGL) (parent.g)).image(camera.getPImage(), 0, 0, frameWidth, frameHeight); } @@ -197,7 +216,7 @@ public void drawImage(PGraphicsOpenGL g, PImage image, @Override public void renderScreens() { this.graphics.noStroke(); - + for (Screen screen : screens) { if (!screen.isDrawing()) { continue; @@ -322,7 +341,8 @@ private void initDistortMap() { parent.colorMode(PApplet.RGB, 255); lensFilter.set("mapTex", mapImg); - lensFilter.set("texture", this.graphics); + // name must not be texture ? + lensFilter.set("textureGraphics", this.graphics); lensFilter.set("resX", (int) (frameWidth * quality)); lensFilter.set("resY", (int) (frameHeight * quality)); lensFilter.set("mag", mag); @@ -391,9 +411,7 @@ public void loadModelView() { // Setting the projector negative because ARToolkit provides neg Z values this.graphics.scale(1, 1, -1); - // TODO: check ! this.graphics.scale(1f / quality); - } public void endDraw() { @@ -455,8 +473,8 @@ public PVector projectPointer(Screen screen, float px, float py) { Ray3D ray = new Ray3D(new Vec3D(originP.x, - originP.y, - originP.z), + originP.y, + originP.z), new Vec3D(viewedPtP.x, viewedPtP.y, viewedPtP.z)); @@ -475,8 +493,8 @@ public PVector projectPointer(Screen screen, float px, float py) { 1f - (res.y() / res.z()), 1); return out; } - - /** + + /** * Computes the 3D coordinates of a projected pixel in the tracking camera * coordinate system. * @@ -492,12 +510,16 @@ public PVector getProjectedPointOnPlane(PlaneCalibration planeCalibCam, float px PVector originP = new PVector(0, 0, 0); PVector viewedPtP = getProjectiveDeviceP().pixelToWorldNormalized(px, py); - // Pass it to the camera point of view (origin) - PMatrix3D proCamExtrinsics = getExtrinsicsInv(); - PVector originC = new PVector(); - PVector viewedPtC = new PVector(); - proCamExtrinsics.mult(originP, originC); - proCamExtrinsics.mult(viewedPtP, viewedPtC); + PVector originC = originP.copy(); + PVector viewedPtC = viewedPtP.copy(); + if (hasExtrinsics()) { + // Pass it to the camera point of view (origin) + PMatrix3D proCamExtrinsics = getExtrinsicsInv(); + originC = new PVector(); + viewedPtC = new PVector(); + proCamExtrinsics.mult(originP, originC); + proCamExtrinsics.mult(viewedPtP, viewedPtC); + } // Second argument is a direction viewedPtC.sub(originC); @@ -517,7 +539,7 @@ public PVector getProjectedPointOnPlane(PlaneCalibration planeCalibCam, float px } return new PVector(inter.x(), inter.y(), inter.z()); - } + } protected PMatrix3D createProjection(PVector nearFar) { diff --git a/papart/src/fr/inria/papart/procam/display/BaseDisplay.java b/papart/src/fr/inria/papart/procam/display/BaseDisplay.java index e8b7ed28..27bdaef3 100755 --- a/papart/src/fr/inria/papart/procam/display/BaseDisplay.java +++ b/papart/src/fr/inria/papart/procam/display/BaseDisplay.java @@ -159,7 +159,7 @@ public void endDraw() { * Called in Automatic mode to display the image. */ public void draw() { - parent.g.background(100, 0, 0); + parent.g.background(30, 30, 30); drawScreensOver(); parent.noStroke(); parent.g.image(this.render(), 0, 0, this.drawingSizeX, this.drawingSizeY); @@ -280,4 +280,22 @@ public PVector projectPointer(Screen screen, float x, float y) { screenMat.mult(new PVector(x * drawingSizeX, y * drawingSizeY), transformed); return transformed; } + + + public PVector project(Screen screen, float x, float y) { + boolean isProjector = this instanceof ProjectorDisplay; + boolean isARDisplay = this instanceof ARDisplay; + // check that the correct method is called ! + PVector paperScreenCoord; + if (isProjector) { + paperScreenCoord = ((ProjectorDisplay) this).projectPointer(screen, x, y); + } else { + if (isARDisplay) { + paperScreenCoord = ((ARDisplay) this).projectPointer(screen, x, y); + } else { + paperScreenCoord = this.projectPointer(screen, x, y); + } + } + return paperScreenCoord; + } } diff --git a/papart/src/fr/inria/papart/procam/display/ProjectorDisplay.java b/papart/src/fr/inria/papart/procam/display/ProjectorDisplay.java index b6a31e3f..f11dced7 100755 --- a/papart/src/fr/inria/papart/procam/display/ProjectorDisplay.java +++ b/papart/src/fr/inria/papart/procam/display/ProjectorDisplay.java @@ -20,7 +20,7 @@ package fr.inria.papart.procam.display; import fr.inria.papart.calibration.PlaneCalibration; -import fr.inria.papart.drawingapp.DrawUtils; +import fr.inria.papart.utils.DrawUtils; import fr.inria.papart.multitouch.TouchInput; import fr.inria.papart.procam.camera.Camera; import fr.inria.papart.tracking.MarkerBoard; @@ -269,26 +269,32 @@ void projectCornersImage() { g.ellipseMode(PApplet.CENTER); g.noStroke(); - // corner 4 + // corner 4 Yellow 0, 0 g.fill(255, 255, 50); g.translate(0, 0); drawEllipses(g); - // corner 3 + // corner 3 green x, 0 g.translate(g.width, 0); g.fill(50, 255, 50); drawEllipses(g); - // Corner 2 + // Corner 2 Red x,y g.fill(255, 50, 55); g.translate(0, g.height); drawEllipses(g); - // Corner 1 - g.fill(255); + // Corner 1 White 0,y + g.fill(255); g.translate(-g.width, 0); drawEllipses(g); + + // In TrackedView + // 0 is -> 0, h (white) + // 1 is -> w, h (Red) + // 2 is -> w, 0 (Green) + // 3 is -> 0, 0 (Yellow) } void drawEllipses(PGraphicsOpenGL g) { diff --git a/papart/src/fr/inria/papart/procam/display/distortFrag.glsl b/papart/src/fr/inria/papart/procam/display/distortFrag.glsl index 0ee4bf1e..1927e3e2 100755 --- a/papart/src/fr/inria/papart/procam/display/distortFrag.glsl +++ b/papart/src/fr/inria/papart/procam/display/distortFrag.glsl @@ -3,7 +3,7 @@ precision mediump float; precision mediump int; #endif -uniform sampler2D texture; +uniform sampler2D textureGraphics; uniform sampler2D mapTex; uniform int resX, resY; @@ -29,7 +29,7 @@ void main() { vec2 coord2 = vec2( (mapCoord.x - 0.5) * mag / float(resX), (mapCoord.y - 0.5) * mag / float(resY)); - gl_FragColor = vec4(texture2D(texture, coord2 + vertTexCoord.st ).rgba); + gl_FragColor = vec4(texture2D(textureGraphics, coord2 + vertTexCoord.st ).rgba); // gl_FragColor = vec4(mapCoord.rgb , 1); // gl_FragColor = vec4(coord2.rg, 1 , 1); diff --git a/papart/src/fr/inria/papart/procam/display/distortVert.glsl b/papart/src/fr/inria/papart/procam/display/distortVert.glsl index ca26bfb2..2ca3c2a5 100755 --- a/papart/src/fr/inria/papart/procam/display/distortVert.glsl +++ b/papart/src/fr/inria/papart/procam/display/distortVert.glsl @@ -6,7 +6,7 @@ uniform mat4 transform; uniform mat4 texMatrix; -attribute vec4 vertex; +attribute vec4 position; attribute vec4 color; attribute vec2 texCoord; @@ -15,13 +15,14 @@ varying vec4 vertTexCoord; void main() { - - // vertColor = color; + // Useless... ? + vertColor = color; vertTexCoord = texMatrix * vec4(texCoord, 1.0, 1.0); - gl_TexCoord[0] = gl_MultiTexCoord0; + // Deprecated + // gl_TexCoord[0] = gl_MultiTexCoord0; - gl_Position = transform * vertex; + gl_Position = transform * position; // gl_Position = ftransform(); } diff --git a/papart/src/fr/inria/papart/tracking/MarkerBoard.java b/papart/src/fr/inria/papart/tracking/MarkerBoard.java index dd92cb3c..32387eb2 100755 --- a/papart/src/fr/inria/papart/tracking/MarkerBoard.java +++ b/papart/src/fr/inria/papart/tracking/MarkerBoard.java @@ -23,6 +23,7 @@ import fr.inria.papart.procam.display.ProjectorDisplay; import fr.inria.papart.procam.display.ARDisplay; import fr.inria.papart.multitouch.OneEuroFilter; +import fr.inria.papart.procam.camera.CameraRGBIRDepth; import fr.inria.papart.tracking.ObjectFinder; import org.bytedeco.javacpp.ARToolKitPlus; import org.bytedeco.javacpp.opencv_core.IplImage; @@ -64,16 +65,19 @@ public abstract class MarkerBoard { static public final int FORCE_UPDATE = 3; static public final PMatrix3D INVALID_LOCATION = new PMatrix3D(); - public enum MarkerType { ARTOOLKITPLUS, JAVACV_FINDER, SVG, INVALID } - - protected MarkerBoard(){ + + public MarkerType getMarkerType() { + return type; + } + + protected MarkerBoard() { this.fileName = "Invalid MarkerBoard"; } - + public MarkerBoard(String fileName, float width, float height) { this.fileName = fileName; this.width = width; @@ -89,13 +93,11 @@ public MarkerBoard(String fileName, float width, float height) { } protected abstract void addTrackerImpl(Camera camera); - + public void addTracker(PApplet applet, Camera camera) { // public void addTracker(PApplet applet, Camera camera, ARToolKitPlus.TrackerMultiMarker tracker, float[] transfo) { this.applet = applet; - addTrackerImpl(camera); - this.cameras.add(camera); this.drawingMode.add(false); this.lastPos.add(new PVector()); @@ -103,25 +105,25 @@ public void addTracker(PApplet applet, Camera camera) { this.minDistanceDrawingMode.add(2f); this.nextTimeEvent.add(0); this.updateStatus.add(NORMAL); - OneEuroFilter[] filter = null; this.filters.add(filter); + + addTrackerImpl(camera); } - private int getId(Camera camera) { - return cameras.indexOf(camera); + return cameras.indexOf(Camera.checkActingCamera(camera)); } public void setFiltering(Camera camera, double freq, double minCutOff) { - int id = cameras.indexOf(camera); + int id = getId(camera); OneEuroFilter[] filter = createFilter(freq, minCutOff); filters.set(id, filter); } public void removeFiltering(Camera camera) { - int id = cameras.indexOf(camera); - filters.remove(id); + int id = getId(camera); + filters.set(id, null); } public void setDrawingMode(Camera camera, boolean dm) { @@ -136,7 +138,7 @@ public void setDrawingMode(Camera camera, boolean dm, float dist) { } public void setFakeLocation(Camera camera, PMatrix3D location) { - int id = cameras.indexOf(camera); + int id = getId(camera); PMatrix3D transfo = (PMatrix3D) transfos.get(id); transfo.set(location); } @@ -202,7 +204,7 @@ private PVector getPositionVector(int id) { // We suppose that the ARDisplay is the one of the camera... public PVector getBoardLocation(Camera camera, ARDisplay display) { - int id = cameras.indexOf(camera); + int id = getId(camera); PVector v = getPositionVector(id); // Apply extrinsics if required. @@ -226,7 +228,7 @@ public boolean isSeenBy(Camera camera, ProjectorDisplay projector, float error) public synchronized void updateLocation(Camera camera, IplImage img, Object globalTracking) { - int id = cameras.indexOf(camera); + int id = getId(camera); if (id == -1) { throw new RuntimeException("The board " + this.fileName + " is" + " not registered with the camera you asked"); @@ -240,15 +242,15 @@ public synchronized void updateLocation(Camera camera, IplImage img, Object glob if (mode == BLOCK_UPDATE && currentTime < endTime) { return; } - + updatePositionImpl(id, currentTime, endTime, mode, camera, img, globalTracking); } + protected abstract void updatePositionImpl(int id, int currentTime, int endTime, int mode, Camera camera, IplImage img, Object globalTracking); - public PMatrix3D getTransfoMat(Camera camera) { - return transfos.get(cameras.indexOf(camera)); + return transfos.get(getId(camera)); } public PMatrix3D getTransfoRelativeTo(Camera camera, MarkerBoard board2) { @@ -266,22 +268,26 @@ public ObjectFinder getObjectTracking(Camera camera) { } public ARToolKitPlus.TrackerMultiMarker getARToolkitTracking(Camera camera) { - assert (this.useGrayscaleImages()); + assert (this.useMarkers()); return (ARToolKitPlus.TrackerMultiMarker) getTracking(camera); } private Object getTracking(Camera camera) { - return trackers.get(cameras.indexOf(camera)); + return trackers.get(getId(camera)); } public boolean useJavaCVFinder() { return this.type == MarkerType.JAVACV_FINDER; } - public boolean useGrayscaleImages() { + public boolean useMarkers() { return this.type == MarkerType.ARTOOLKITPLUS || this.type == MarkerType.SVG; } - + + public boolean useGrayImages() { + return this.type == MarkerType.ARTOOLKITPLUS || this.type == MarkerType.SVG; + } + public boolean useCustomARToolkitBoard() { return this.type == MarkerType.SVG; } diff --git a/papart/src/fr/inria/papart/tracking/MarkerBoardARToolKitPlus.java b/papart/src/fr/inria/papart/tracking/MarkerBoardARToolKitPlus.java index 9457f4c9..594511ee 100644 --- a/papart/src/fr/inria/papart/tracking/MarkerBoardARToolKitPlus.java +++ b/papart/src/fr/inria/papart/tracking/MarkerBoardARToolKitPlus.java @@ -19,6 +19,7 @@ */ package fr.inria.papart.tracking; +import static fr.inria.papart.procam.Papart.camCalibARtoolkit; import static fr.inria.papart.tracking.MarkerBoard.BLOCK_UPDATE; import static fr.inria.papart.tracking.MarkerBoard.FORCE_UPDATE; import static fr.inria.papart.tracking.MarkerBoard.NORMAL; @@ -72,6 +73,9 @@ public MarkerBoardARToolKitPlus(String fileName, float width, float height) { // @Override protected void addTrackerImpl(Camera camera) { + + System.out.println("Starting a ARToolkitPlus tracker for CFG files."); + // create a tracker that does: // - 6x6 sized marker images (required for binary markers) // - samples at a maximum of 6x6 @@ -109,12 +113,16 @@ protected void addTrackerImpl(Camera camera) { tracker.setMarkerMode(ARToolKitPlus.MARKER_ID_BCH); // TODO: find why FULL RES is not working with a FULL HD image. -// tracker.setImageProcessingMode(ARToolKitPlus.IMAGE_FULL_RES); - tracker.setImageProcessingMode(ARToolKitPlus.IMAGE_HALF_RES); + tracker.setImageProcessingMode(ARToolKitPlus.IMAGE_FULL_RES); +// tracker.setImageProcessingMode(ARToolKitPlus.IMAGE_HALF_RES); // tracker.setUseDetectLite(false); tracker.setUseDetectLite(true); + // Deal with the calibration files here... + Camera.convertARParams(this.applet, camera.getProjectiveDevice(), camCalibARtoolkit); + camera.setCalibrationARToolkit(camCalibARtoolkit); + // Initialize the tracker, with camera parameters and marker config. if (!tracker.init(camera.getCalibrationARToolkit(), this.getFileName(), 1.0f, 10000.f)) { System.err.println("Init ARTOOLKIT Error " + camera.getCalibrationARToolkit() + " " + this.getFileName()); diff --git a/papart/src/fr/inria/papart/tracking/MarkerBoardFactory.java b/papart/src/fr/inria/papart/tracking/MarkerBoardFactory.java index bce43668..5868decc 100644 --- a/papart/src/fr/inria/papart/tracking/MarkerBoardFactory.java +++ b/papart/src/fr/inria/papart/tracking/MarkerBoardFactory.java @@ -20,33 +20,48 @@ package fr.inria.papart.tracking; import fr.inria.papart.tracking.MarkerBoard.MarkerType; +import java.util.ArrayList; +import java.util.HashMap; /** * * @author Jérémy Laviole - jeremy.laviole@inria.fr */ public class MarkerBoardFactory { - + private static final HashMap allBoards = new HashMap<>(); + // Todo: error Handling... - public static MarkerBoard create(String fileName, float width, float height){ + public static MarkerBoard create(String fileName, float width, float height) { - MarkerType type = getType(fileName); - if (type == MarkerType.ARTOOLKITPLUS) { - return new MarkerBoardARToolKitPlus(fileName, width, height); - } - if (type == MarkerType.JAVACV_FINDER) { - return new MarkerBoardJavaCV(fileName, width, height); + if(allBoards.containsKey(fileName)){ + return allBoards.get(fileName); } - if (type == MarkerType.SVG) { - return new MarkerBoardSvg(fileName, width, height); + MarkerBoard output = MarkerBoardInvalid.board; + + MarkerType type = getType(fileName); + try { + if (type == MarkerType.ARTOOLKITPLUS) { + output = new MarkerBoardARToolKitPlus(fileName, width, height); + } + if (type == MarkerType.JAVACV_FINDER) { + output = new MarkerBoardJavaCV(fileName, width, height); + } + + if (type == MarkerType.SVG) { + output = new MarkerBoardSvg(fileName, width, height); + } + + allBoards.put(fileName, output); + } catch (Exception e) { + System.err.println("Error loading the markerboard: " + e); } - return MarkerBoardInvalid.board; + return output; } - + private static MarkerType getType(String name) { if (name.endsWith("cfg")) { return MarkerType.ARTOOLKITPLUS; @@ -60,5 +75,4 @@ private static MarkerType getType(String name) { return MarkerType.INVALID; } - } diff --git a/papart/src/fr/inria/papart/tracking/MarkerBoardJavaCV.java b/papart/src/fr/inria/papart/tracking/MarkerBoardJavaCV.java index e9095ac1..87538114 100644 --- a/papart/src/fr/inria/papart/tracking/MarkerBoardJavaCV.java +++ b/papart/src/fr/inria/papart/tracking/MarkerBoardJavaCV.java @@ -43,7 +43,9 @@ public class MarkerBoardJavaCV extends MarkerBoard { private final PVector botLeft = new PVector(); private final PVector botRight = new PVector(); - public MarkerBoardJavaCV(String fileName, float width, float height) { + private opencv_core.IplImage imgToFind; + + public MarkerBoardJavaCV(String fileName, float width, float height) throws Exception { super(fileName, width, height); trackers = new ArrayList(); imagePoints = new PVector[4]; @@ -57,16 +59,21 @@ public MarkerBoardJavaCV(String fileName, float width, float height) { Logger logger = Logger.getLogger(ObjectFinder.class.getName()); logger.setLevel(Level.OFF); this.type = MarkerType.JAVACV_FINDER; + imgToFind = cvLoadImage(this.fileName); + + // TODO: something less violent than a runtime exception... + if (imgToFind == null) { + throw new Exception("MarkerBoardJavaCV: Impossible to load the image: " + this.fileName); + } + } @Override protected void addTrackerImpl(Camera camera) { - opencv_core.IplImage imgToFind = cvLoadImage(this.fileName); ObjectFinder finder = new ObjectFinder(imgToFind); // finder.getSettings().setUseFLANN(true); // finder.getSettings().setMatchesMin(6); - this.trackers.add(finder); this.transfos.add(new PMatrix3D()); } @@ -91,7 +98,6 @@ private PMatrix3D compute3DPos(double[] corners, Camera camera) { // imagePoints[1] = botRight; // imagePoints[2] = topRight; // imagePoints[3] = topLeft; - imagePoints[0] = topLeft; imagePoints[1] = topRight; imagePoints[2] = botRight; @@ -110,14 +116,16 @@ private PMatrix3D compute3DPos(double[] corners, Camera camera) { protected void updatePositionImpl(int id, int currentTime, int endTime, int mode, Camera camera, opencv_core.IplImage img, Object globalTracking) { + try{ ObjectFinder finder = (ObjectFinder) trackers.get(id); // Find the markers double[] corners = finder.find(img); - // one use... HACK - finder = new ObjectFinder(finder.getSettings()); - trackers.set(id, finder); + // one use... HACK -- Why + // why so evil ? +// finder = new ObjectFinder(finder.getSettings()); +// trackers.set(id, finder); if (corners == null) { return; @@ -141,7 +149,6 @@ protected void updatePositionImpl(int id, int currentTime, int endTime, int mode // { // return; // } - lastDistance.set(id, distance); // if the update is forced if (mode == FORCE_UPDATE && currentTime < endTime) { @@ -169,6 +176,10 @@ protected void updatePositionImpl(int id, int currentTime, int endTime, int mode } else { update(newPos, id); } + + } catch(Exception e ){ + e.printStackTrace(); + } } private void update(PMatrix3D newPos, int id) { diff --git a/papart/src/fr/inria/papart/tracking/MarkerBoardSvg.java b/papart/src/fr/inria/papart/tracking/MarkerBoardSvg.java index 349c0eda..db9b511e 100644 --- a/papart/src/fr/inria/papart/tracking/MarkerBoardSvg.java +++ b/papart/src/fr/inria/papart/tracking/MarkerBoardSvg.java @@ -25,9 +25,6 @@ import static fr.inria.papart.tracking.MarkerBoard.FORCE_UPDATE; import static fr.inria.papart.tracking.MarkerBoard.NORMAL; import fr.inria.papart.procam.camera.Camera; -import fr.inria.papart.tracking.DetectedMarker; -import fr.inria.papart.tracking.MarkerList; -import fr.inria.papart.tracking.MarkerSvg; import java.util.ArrayList; import org.bytedeco.javacpp.opencv_core; import processing.core.PMatrix3D; @@ -40,7 +37,6 @@ */ public class MarkerBoardSvg extends MarkerBoard { - private final MarkerList markersFromSVG; public MarkerBoardSvg(String fileName, float width, float height) { diff --git a/papart/src/fr/inria/papart/tracking/ObjectFinder.java b/papart/src/fr/inria/papart/tracking/ObjectFinder.java index 69b17016..8747c86c 100644 --- a/papart/src/fr/inria/papart/tracking/ObjectFinder.java +++ b/papart/src/fr/inria/papart/tracking/ObjectFinder.java @@ -39,13 +39,14 @@ * * @author Samuel Audet * - * ObjectFinder does not work out-of-the-box under Android, because it lacks the standard - * java.beans.beancontext package. We can work around it by doing the following *BEFORE* - * following the instructions in the README.md file: + * ObjectFinder does not work out-of-the-box under Android, because it lacks the + * standard java.beans.beancontext package. We can work around it by doing the + * following *BEFORE* following the instructions in the README.md file: * - * 1. Remove BaseChildSettings.class and BaseSettings.class from javacv.jar - * 2. Follow the instructions in the README.md file - * 3. In your project, define empty classes BaseChildSettings and BaseSettings under the org.bytedeco.javacv package name + * 1. Remove BaseChildSettings.class and BaseSettings.class from javacv.jar 2. + * Follow the instructions in the README.md file 3. In your project, define + * empty classes BaseChildSettings and BaseSettings under the + * org.bytedeco.javacv package name */ public class ObjectFinder { @@ -58,18 +59,24 @@ public ObjectFinder(IplImage objectImage) { settings.objectImage = objectImage; setSettings(settings); } + public ObjectFinder(Settings settings) { setSettings(settings); } public static class Settings extends BaseChildSettings { + IplImage objectImage = null; // ORB detector = ORB.create(); -// ORB detector = ORB.create(500/*=500*/, 1.6f /*=1.2f*/, 6 /*=8*/, 31/*=31*/, + // Marche très bien +// ORB detector = ORB.create(1200/*=500*/, 1.6f /*=1.2f*/, 8 /*=8*/, 31/*=31*/, // 0/*=0*/, 2/*=2*/, ORB.HARRIS_SCORE/*=cv::ORB::HARRIS_SCORE*/, 31 /*=31*/, 20/*=20*/); + // default--> quite awesome + BRISK detector = BRISK.create(50, 2, 1); - + // Tests +// BRISK detector = BRISK.create(briskParam1, briskParam2, briskParam3); // AKAZE detector = AKAZE.create(); // -> CRAZY memory leaks ?! // AKAZE detector = AKAZE.create(AKAZE.DESCRIPTOR_KAZE, // 0, 3, 0.001f, @@ -79,73 +86,29 @@ public static class Settings extends BaseChildSettings { // int descriptor_size/*=0*/, int descriptor_channels/*=3*/, // float threshold/*=0.001f*/, int nOctaves/*=4*/, // int nOctaveLayers/*=4*/, int diffusivity/*=cv::KAZE::DIFF_PM_G2*/); - - // default -// BRISK detector = BRISK.create(30, 3, 1); - BRISK detector = BRISK.create(briskParam1, briskParam2, briskParam3); - // MSER detector = MSER.create(); // -> Not implemented. // FastFeatureDetector detector = FastFeatureDetector.create(); // -> Not implemented. // AgastFeatureDetector detector = AgastFeatureDetector.create(); // -> not implemented - double distanceThreshold = 0.75; - int matchesMin = 4; + int matchesMin = 8; double ransacReprojThreshold = 2.0; + +// Flann causes a native crash // boolean useFLANN = true; boolean useFLANN = false; public IplImage getObjectImage() { return objectImage; } + public void setObjectImage(IplImage objectImage) { this.objectImage = objectImage; } -// public int getDescriptorType() { -// return detector.getDescriptorType(); -// } -// public void setDescriptorType(int dtype) { -// detector.setDescriptorType(dtype); -// } -// -// public int getDescriptorSize() { -// return detector.getDescriptorSize(); -// } -// public void setDescriptorSize(int dsize) { -// detector.setDescriptorSize(dsize); -// } -// -// public int getDescriptorChannels() { -// return detector.getDescriptorChannels(); -// } -// public void setDescriptorChannels(int dch) { -// detector.setDescriptorChannels(dch); -// } -// -// public double getThreshold() { -// return detector.getThreshold(); -// } -// public void setThreshold(double threshold) { -// detector.setThreshold(threshold); -// } -// -// public int getNOctaves() { -// return detector.getNOctaves(); -// } -// public void setNOctaves(int nOctaves) { -// detector.setNOctaves(nOctaves); -// } -// -// public int getNOctaveLayers() { -// return detector.getNOctaveLayers(); -// } -// public void setNOctaveLayers(int nOctaveLayers) { -// detector.setNOctaveLayers(nOctaveLayers); -// } - public double getDistanceThreshold() { return distanceThreshold; } + public void setDistanceThreshold(double distanceThreshold) { this.distanceThreshold = distanceThreshold; } @@ -153,6 +116,7 @@ public void setDistanceThreshold(double distanceThreshold) { public int getMatchesMin() { return matchesMin; } + public void setMatchesMin(int matchesMin) { this.matchesMin = matchesMin; } @@ -160,6 +124,7 @@ public void setMatchesMin(int matchesMin) { public double getRansacReprojThreshold() { return ransacReprojThreshold; } + public void setRansacReprojThreshold(double ransacReprojThreshold) { this.ransacReprojThreshold = ransacReprojThreshold; } @@ -167,15 +132,18 @@ public void setRansacReprojThreshold(double ransacReprojThreshold) { public boolean isUseFLANN() { return useFLANN; } + public void setUseFLANN(boolean useFLANN) { this.useFLANN = useFLANN; } } Settings settings; + public Settings getSettings() { return settings; } + public void setSettings(Settings settings) { this.settings = settings; @@ -184,19 +152,19 @@ public void setSettings(Settings settings) { settings.detector.detectAndCompute(cvarrToMat(settings.objectImage), new Mat(), objectKeypoints, objectDescriptors, false); - int total = (int)objectKeypoints.size(); + int total = (int) objectKeypoints.size(); if (settings.useFLANN) { indicesMat = new Mat(total, 2, CV_32SC1); - distsMat = new Mat(total, 2, CV_32FC1); + distsMat = new Mat(total, 2, CV_32FC1); flannIndex = new Index(); indexParams = new LshIndexParams(12, 20, 2); // using LSH Hamming distance searchParams = new SearchParams(64, 0, true); // maximum number of leafs checked } - pt1 = new Mat(total, 1, CV_32FC2); - pt2 = new Mat(total, 1, CV_32FC2); + pt1 = new Mat(total, 1, CV_32FC2); + pt2 = new Mat(total, 1, CV_32FC2); mask = new Mat(total, 1, CV_8UC1); - H = new Mat(3, 3, CV_64FC1); - ptpairs = new ArrayList(2*objectDescriptors.rows()); + H = new Mat(3, 3, CV_64FC1); + ptpairs = new ArrayList(2 * objectDescriptors.rows()); logger.info(total + " object descriptors"); } @@ -211,30 +179,112 @@ public void setSettings(Settings settings) { Mat pt1 = null, pt2 = null, mask = null, H = null; ArrayList ptpairs = null; + CvRect roi = null; + CvRect defaultRoi = null; + public double[] find(IplImage image) { if (objectDescriptors.rows() < settings.getMatchesMin()) { return null; } imageKeypoints = new KeyPointVector(); imageDescriptors = new Mat(); + + // mask is a single channel image. + if (roi == null) { + roi = cvRect(0, 0, image.width(), image.height()); + defaultRoi = cvRect(0, 0, image.width(), image.height()); + } + + cvSetImageROI(image, roi); + +// System.out.println("retreived roi: " + roi.x() + " " + roi.y() + " " + roi.width() + " " + roi.height()); + long startTime = System.currentTimeMillis(); settings.detector.detectAndCompute(cvarrToMat(image), new Mat(), imageKeypoints, imageDescriptors, false); + // cvarrToMat(maskImg), imageKeypoints, imageDescriptors, false); + if (imageDescriptors.rows() < settings.getMatchesMin()) { + // Reset the mask, nothing found. + roi.x(0); + roi.y(0); + roi.width(image.width()); + roi.height(image.height()); + cvSetImageROI(image, defaultRoi); return null; } - int total = (int)imageKeypoints.size(); + long endTime = System.currentTimeMillis(); + long totalTime = endTime - startTime; +// System.out.println("Detection time: " + totalTime + " ms."); + int total = (int) imageKeypoints.size(); logger.info(total + " image descriptors"); int w = settings.objectImage.width(); int h = settings.objectImage.height(); - double[] srcCorners = {0, 0, w, 0, w, h, 0, h}; + double[] srcCorners = {0, 0, w, 0, w, h, 0, h}; double[] dstCorners = locatePlanarObject(objectKeypoints, objectDescriptors, - imageKeypoints, imageDescriptors, srcCorners); + imageKeypoints, imageDescriptors, srcCorners, image.roi()); + + if (dstCorners == null) { + roi.x(0); + roi.y(0); + roi.width(image.width()); + roi.height(image.height()); + cvSetImageROI(image, defaultRoi); + return null; + } + + adjustROI(image, dstCorners); + // update mask from dstCorners... + + cvSetImageROI(image, defaultRoi); +// System.out.println("Updated roi: " + roi.x() + " " + roi.y()); return dstCorners; } + private void adjustROI(IplImage image, double[] dstCorners) { + int minX = image.width(), minY = image.height(), maxX = 0, maxY = 0; + for (int i = 0; i < 4; i++) { + int x = (int) dstCorners[i * 2]; + int y = (int) dstCorners[i * 2 + 1]; + if (x < minX) { + minX = x; + } + if (x > maxX) { + maxX = x; + } + if (y < minY) { + minY = y; + } + if (y > maxY) { + maxY = y; + } + } + int larger = 100; + minX -= larger; + maxX += larger; + minY -= larger; + maxY += larger; + if (minX < 0) { + minX = 0; + } + if (maxX >= image.width()) { + maxX = image.width() - 1; + } + if (minY < 0) { + minY = 0; + } + if (maxY >= image.height()) { + maxY = image.height() - 1; + } + roi.x(minX); + roi.y(minY); + roi.width(maxX - minX); + roi.height(maxY - minY); + } + static final int[] bits = new int[256]; + static { for (int i = 0; i < bits.length; i++) { for (int j = i; j != 0; j >>= 1) { @@ -248,8 +298,9 @@ int compareDescriptors(ByteBuffer d1, ByteBuffer d2, int best) { assert d1.limit() - d1.position() == d2.limit() - d2.position(); while (d1.position() < d1.limit()) { totalCost += bits[(d1.get() ^ d2.get()) & 0xFF]; - if (totalCost > best) + if (totalCost > best) { break; + } } return totalCost; } @@ -260,8 +311,8 @@ int naiveNearestNeighbor(ByteBuffer vec, ByteBuffer modelDescriptors) { int size = vec.limit() - vec.position(); for (int i = 0; i * size < modelDescriptors.capacity(); i++) { - ByteBuffer mvec = (ByteBuffer)modelDescriptors.position(i * size).limit((i + 1) * size); - d = compareDescriptors((ByteBuffer)vec.reset(), mvec, dist2); + ByteBuffer mvec = (ByteBuffer) modelDescriptors.position(i * size).limit((i + 1) * size); + d = compareDescriptors((ByteBuffer) vec.reset(), mvec, dist2); if (d < dist1) { dist2 = dist1; dist1 = d; @@ -270,8 +321,9 @@ int naiveNearestNeighbor(ByteBuffer vec, ByteBuffer modelDescriptors) { dist2 = d; } } - if (dist1 < settings.distanceThreshold*dist2) + if (dist1 < settings.distanceThreshold * dist2) { return neighbor; + } return -1; } @@ -281,7 +333,7 @@ void findPairs(Mat objectDescriptors, Mat imageDescriptors) { ByteBuffer imageBuf = imageDescriptors.createBuffer(); for (int i = 0; i * size < objectBuf.capacity(); i++) { - ByteBuffer descriptor = (ByteBuffer)objectBuf.position(i * size).limit((i + 1) * size).mark(); + ByteBuffer descriptor = (ByteBuffer) objectBuf.position(i * size).limit((i + 1) * size).mark(); int nearestNeighbor = naiveNearestNeighbor(descriptor, imageBuf); if (nearestNeighbor >= 0) { ptpairs.add(i); @@ -300,38 +352,52 @@ void flannFindPairs(Mat objectDescriptors, Mat imageDescriptors) { IntBuffer indicesBuf = indicesMat.createBuffer(); IntBuffer distsBuf = distsMat.createBuffer(); for (int i = 0; i < length; i++) { - if (distsBuf.get(2*i) < settings.distanceThreshold*distsBuf.get(2*i+1)) { + if (distsBuf.get(2 * i) < settings.distanceThreshold * distsBuf.get(2 * i + 1)) { ptpairs.add(i); - ptpairs.add(indicesBuf.get(2*i)); + ptpairs.add(indicesBuf.get(2 * i)); } } } - /** a rough implementation for object location */ + /** + * a rough implementation for object location + */ double[] locatePlanarObject(KeyPointVector objectKeypoints, Mat objectDescriptors, - KeyPointVector imageKeypoints, Mat imageDescriptors, double[] srcCorners) { + KeyPointVector imageKeypoints, Mat imageDescriptors, double[] srcCorners, IplROI roi) { ptpairs.clear(); if (settings.useFLANN) { flannFindPairs(objectDescriptors, imageDescriptors); } else { findPairs(objectDescriptors, imageDescriptors); } - int n = ptpairs.size()/2; + int n = ptpairs.size() / 2; logger.info(n + " matching pairs found"); if (n < settings.matchesMin) { return null; } - pt1 .resize(n); - pt2 .resize(n); + int xShift = 0; + int yShift = 0; + if (roi != null) { + xShift = roi.xOffset(); + yShift = roi.yOffset(); + } + + pt1.resize(n); + pt2.resize(n); mask.resize(n); FloatBuffer pt1Idx = pt1.createBuffer(); FloatBuffer pt2Idx = pt2.createBuffer(); for (int i = 0; i < n; i++) { - Point2f p1 = objectKeypoints.get(ptpairs.get(2*i)).pt(); - pt1Idx.put(2*i, p1.x()); pt1Idx.put(2*i+1, p1.y()); - Point2f p2 = imageKeypoints.get(ptpairs.get(2*i+1)).pt(); - pt2Idx.put(2*i, p2.x()); pt2Idx.put(2*i+1, p2.y()); + Point2f p1 = objectKeypoints.get(ptpairs.get(2 * i)).pt(); + pt1Idx.put(2 * i, p1.x()); + pt1Idx.put(2 * i + 1, p1.y()); + Point2f p2 = imageKeypoints.get(ptpairs.get(2 * i + 1)).pt(); + pt2Idx.put(2 * i, p2.x() + xShift); + pt2Idx.put(2 * i + 1, p2.y() + yShift); + +// System.out.println("KeyPoints found object: " + p1.x() + " " + p1.y()); +// System.out.println("KeyPoints found image: " + p2.x() + " " + p2.y()); } H = findHomography(pt1, pt2, CV_RANSAC, settings.ransacReprojThreshold, mask, 2000, 0.995); @@ -339,15 +405,15 @@ void flannFindPairs(Mat objectDescriptors, Mat imageDescriptors) { return null; } - double[] h = (double[])H.createIndexer(false).array(); + double[] h = (double[]) H.createIndexer(false).array(); double[] dstCorners = new double[srcCorners.length]; - for(int i = 0; i < srcCorners.length/2; i++) { - double x = srcCorners[2*i], y = srcCorners[2*i + 1]; - double Z = 1/(h[6]*x + h[7]*y + h[8]); - double X = (h[0]*x + h[1]*y + h[2])*Z; - double Y = (h[3]*x + h[4]*y + h[5])*Z; - dstCorners[2*i ] = X; - dstCorners[2*i + 1] = Y; + for (int i = 0; i < srcCorners.length / 2; i++) { + double x = srcCorners[2 * i], y = srcCorners[2 * i + 1]; + double Z = 1 / (h[6] * x + h[7] * y + h[8]); + double X = (h[0] * x + h[1] * y + h[2]) * Z; + double Y = (h[3] * x + h[4] * y + h[5]) * Z; + dstCorners[2 * i] = X; + dstCorners[2 * i + 1] = Y; } return dstCorners; } @@ -357,10 +423,10 @@ public static void main(String[] args) throws Exception { // String objectFilename = args.length == 2 ? args[0] : "/home/jiii/sketchbook/libraries/PapARt/data/markers/dlink.png"; String objectFilename = args.length == 2 ? args[0] : "/home/jiii/repos/Papart-github/papart-examples/Camera/ExtractPlanarObjectForTracking/ExtractedView.bmp"; - String sceneFilename = args.length == 2 ? args[1] : "/home/jiii/my_photo-7.jpg"; + String sceneFilename = args.length == 2 ? args[1] : "/home/jiii/my_photo-7.jpg"; IplImage object = cvLoadImage(objectFilename, CV_LOAD_IMAGE_GRAYSCALE); - IplImage image = cvLoadImage(sceneFilename, CV_LOAD_IMAGE_GRAYSCALE); + IplImage image = cvLoadImage(sceneFilename, CV_LOAD_IMAGE_GRAYSCALE); if (object == null || image == null) { System.err.println("Can not load " + objectFilename + " and/or " + sceneFilename); System.exit(-1); @@ -369,7 +435,7 @@ public static void main(String[] args) throws Exception { IplImage objectColor = IplImage.create(object.width(), object.height(), 8, 3); cvCvtColor(object, objectColor, CV_GRAY2BGR); - IplImage correspond = IplImage.create(image.width(), object.height()+ image.height(), 8, 1); + IplImage correspond = IplImage.create(image.width(), object.height() + image.height(), 8, 1); cvSetImageROI(correspond, cvRect(0, 0, object.width(), object.height())); cvCopy(object, correspond); cvSetImageROI(correspond, cvRect(0, object.height(), correspond.width(), correspond.height())); @@ -386,13 +452,13 @@ public static void main(String[] args) throws Exception { double[] dst_corners = finder.find(image); System.out.println("Finding time = " + (System.currentTimeMillis() - start) + " ms"); - if (dst_corners != null) { + if (dst_corners != null) { for (int i = 0; i < 4; i++) { - int j = (i+1)%4; - int x1 = (int)Math.round(dst_corners[2*i ]); - int y1 = (int)Math.round(dst_corners[2*i + 1]); - int x2 = (int)Math.round(dst_corners[2*j ]); - int y2 = (int)Math.round(dst_corners[2*j + 1]); + int j = (i + 1) % 4; + int x1 = (int) Math.round(dst_corners[2 * i]); + int y1 = (int) Math.round(dst_corners[2 * i + 1]); + int x2 = (int) Math.round(dst_corners[2 * j]); + int y2 = (int) Math.round(dst_corners[2 * j + 1]); line(cvarrToMat(correspond), new Point(x1, y1 + object.height()), new Point(x2, y2 + object.height()), Scalar.WHITE, 1, 8, 0); diff --git a/papart/src/fr/inria/papart/utils/ARToolkitPlusUtils.java b/papart/src/fr/inria/papart/utils/ARToolkitPlusUtils.java new file mode 100755 index 00000000..258004e8 --- /dev/null +++ b/papart/src/fr/inria/papart/utils/ARToolkitPlusUtils.java @@ -0,0 +1,277 @@ +/* + * Part of the PapARt project - https://project.inria.fr/papart/ + * + * Copyright (C) 2014-2016 Inria + * Copyright (C) 2011-2013 Bordeaux University + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; If not, see + * . + */ +package fr.inria.papart.utils; + +import fr.inria.papart.procam.Papart; +import fr.inria.papart.procam.ProjectiveDeviceP; +import fr.inria.papart.procam.camera.Camera.PixelFormat; + +import org.bytedeco.javacv.CameraDevice; +import org.bytedeco.javacv.ProjectorDevice; +import org.bytedeco.javacpp.opencv_imgproc; +import static org.bytedeco.javacpp.opencv_core.*; +import static org.bytedeco.javacpp.opencv_calib3d.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.net.URL; +import java.nio.ByteBuffer; +import processing.core.*; +import static processing.core.PConstants.ARGB; +import static processing.core.PConstants.RGB; +import processing.opengl.Texture; +import toxi.geom.Matrix4x4; +import toxi.geom.Vec3D; +import java.io.*; +import java.nio.FloatBuffer; +import static processing.core.PConstants.ALPHA; +import static processing.core.PConstants.GRAY; +import static processing.core.PConstants.HSB; + +/** + * + * @author jeremy + */ +public class ARToolkitPlusUtils { + + static public final String LibraryName = "PapARt"; + + static int conversionCount = 0; + + static public void convertARParam2(PApplet pa, String inputYAML, String outputDAT) throws Exception { + CameraDevice cam = null; + + // Hack + if (inputYAML.endsWith(".xml")) { + convertARParamXML(pa, inputYAML, outputDAT); + return; + } + + CameraDevice[] c = CameraDevice.read(inputYAML); + if (c.length > 0) { + cam = c[0]; + } + CameraDevice.Settings camSettings = (org.bytedeco.javacv.CameraDevice.Settings) cam.getSettings(); + int w = camSettings.getImageWidth(); + int h = camSettings.getImageHeight(); + + double[] proj = cam.cameraMatrix.get(); + + PrintWriter pw = pa.createWriter(outputDAT); + + StringBuffer sb = new StringBuffer(); + +// byte[] buf = new byte[SIZE_OF_PARAM_SET]; +// ByteBuffer bb = ByteBuffer.wrap(buf); +// bb.order(ByteOrder.BIG_ENDIAN); +// bb.putInt(w); +// bb.putInt(h); + // From ARToolkitPlus... +//http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html + sb.append("ARToolKitPlus_CamCal_Rev02\n"); + sb.append(w).append(" ").append(h).append(" "); + + // cx cy fx fy + sb.append(proj[2]).append(" ").append(proj[5]) + .append(" ").append(proj[0]). + append(" ").append(proj[4]).append(" "); + + // alpha_c // skew factor  + sb.append("0 ").append(" "); + + if (cam.distortionCoeffs != null) { + double[] distort = cam.distortionCoeffs.get(); + // alpha_c ?  +// sb.append("0 "); + // kc(1 - x) -> 6 values + for (int i = 0; i < distort.length; i++) { + sb.append(distort[i]).append(" "); + } + for (int i = distort.length; i < 6; i++) { + sb.append("0 "); + } + } else { + for (int i = 0; i < 6; i++) { + sb.append("0 "); + } + } + // undist iterations + sb.append("10\n"); + + pw.print(sb); + pw.flush(); + pw.close(); + } + + static public void convertARParamFromDevice(PApplet pa, ProjectiveDeviceP pdp, String outputDAT) throws Exception { + + PrintWriter pw = pa.createWriter(outputDAT); + StringBuffer sb = new StringBuffer(); + + // From ARToolkitPlus... +//http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html + sb.append("ARToolKitPlus_CamCal_Rev02\n"); + sb.append(pdp.getWidth()).append(" ").append(pdp.getHeight()).append(" "); + + // cx cy fx fy + sb.append(pdp.getCx()).append(" ").append(pdp.getCy()) + .append(" ").append(pdp.getFx()). + append(" ").append(pdp.getFy()).append(" "); + + // alpha_c // skew factor  + sb.append("0 ").append(" "); + +// if(pdp.handleDistorsions()){ + // TODO: handle the distorsions... +// double[] distort = cam.distortionCoeffs.get(); +// // alpha_c ?  +//// sb.append("0 "); +// // kc(1 - x) -> 6 values +// for (int i = 0; i < distort.length; i++) { +// sb.append(distort[i]).append(" "); +// } +// for (int i = distort.length; i < 6; i++) { +// sb.append("0 "); +// } +// } else { + for (int i = 0; i < 6; i++) { + sb.append("0 "); + } +// } + // undist iterations + sb.append("10\n"); + + pw.print(sb); + pw.flush(); + pw.close(); + } + + static public void convertProjParam(PApplet pa, String inputYAML, String outputDAT) throws Exception { + + ProjectorDevice cam = null; + + ProjectorDevice[] c = ProjectorDevice.read(inputYAML); + if (c.length > 0) { + cam = c[0]; + } + ProjectorDevice.Settings projSettings = (org.bytedeco.javacv.ProjectorDevice.Settings) cam.getSettings(); + int w = projSettings.getImageWidth(); + int h = projSettings.getImageHeight(); + + double[] mat = cam.cameraMatrix.get(); + double[] distort = cam.distortionCoeffs.get(); + + OutputStream os = pa.createOutput(outputDAT); + + PrintWriter pw = pa.createWriter(outputDAT); + + StringBuffer sb = new StringBuffer(); + +// byte[] buf = new byte[SIZE_OF_PARAM_SET]; +// ByteBuffer bb = ByteBuffer.wrap(buf); +// bb.order(ByteOrder.BIG_ENDIAN); +// bb.putInt(w); +// bb.putInt(h); + // From ARToolkitPlus... +//http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html + sb.append("ARToolKitPlus_CamCal_Rev02\n"); + sb.append(w).append(" ").append(h).append(" "); + + // cx cy fx fy + sb.append(mat[2]).append(" ").append(mat[5]) + .append(" ").append(mat[0]). + append(" ").append(mat[4]).append(" "); + + // alpha_c // skew factor  + sb.append("0 ").append(" "); + + // alpha_c ?  +// sb.append("0 "); + // kc(1 - x) -> 6 values + for (int i = 0; i < distort.length; i++) { + sb.append(distort[i]).append(" "); + } + for (int i = distort.length; i < 6; i++) { + sb.append("0 "); + } + + // undist iterations + sb.append("10\n"); + + pw.print(sb); + pw.flush(); + pw.close(); + } + + static public void convertARParamXML(PApplet pa, String fileName, String outputDAT) throws Exception { + + System.out.println("Convert AR Param XML"); + CameraDevice cam = null; + + ProjectiveDeviceP pdp = ProjectiveDeviceP.loadCameraDevice(pa, fileName); + +// CameraDevice[] c = CameraDevice.read(fileName); +// if (c.length > 0) { +// cam = c[0]; +// } + OutputStream os = pa.createOutput(outputDAT); + PrintWriter pw = pa.createWriter(outputDAT); + StringBuffer sb = new StringBuffer(); + + // From ARToolkitPlus... + //http://www.vision.caltech.edu/bouguetj/calib_doc/htmls/parameters.html + sb.append("ARToolKitPlus_CamCal_Rev02\n"); + sb.append(pdp.getWidth()).append(" ").append(pdp.getHeight()).append(" "); + + // cx cy fx fy + sb.append(pdp.getCx()).append(" ").append(pdp.getCy()) + .append(" ").append(pdp.getFx()). + append(" ").append(pdp.getFy()).append(" "); + + // alpha_c // skew factor  + sb.append("0 ").append(" "); + + // kc(1 - x) -> 6 values + if (pdp.handleDistorsions()) { + double[] distort = ((CameraDevice) pdp.getDevice()).distortionCoeffs.get(); + + for (int i = 0; i < distort.length; i++) { + sb.append(distort[i]).append(" "); + } + // fill with 0s the end. + for (int i = distort.length; i < 5; i++) { + sb.append("0 "); + } + } else { + for (int i = 0; i < 5; i++) { + sb.append("0 "); + } + } + + // undist iterations + sb.append("10\n"); + + pw.print(sb); + pw.flush(); + pw.close(); + } + +} diff --git a/papart/src/fr/inria/papart/procam/DrawUtils.java b/papart/src/fr/inria/papart/utils/DrawUtils.java similarity index 99% rename from papart/src/fr/inria/papart/procam/DrawUtils.java rename to papart/src/fr/inria/papart/utils/DrawUtils.java index 0ecbecfe..c9a0a0e3 100755 --- a/papart/src/fr/inria/papart/procam/DrawUtils.java +++ b/papart/src/fr/inria/papart/utils/DrawUtils.java @@ -17,7 +17,7 @@ * Public License along with this library; If not, see * . */ -package fr.inria.papart.drawingapp; +package fr.inria.papart.utils; import processing.core.PApplet; import processing.core.PFont; diff --git a/papart/src/fr/inria/papart/utils/ImageUtils.java b/papart/src/fr/inria/papart/utils/ImageUtils.java new file mode 100644 index 00000000..dafda369 --- /dev/null +++ b/papart/src/fr/inria/papart/utils/ImageUtils.java @@ -0,0 +1,426 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package fr.inria.papart.utils; + +import fr.inria.papart.procam.PaperTouchScreen; +import fr.inria.papart.procam.camera.Camera; +import java.nio.ByteBuffer; +import java.nio.FloatBuffer; +import static org.bytedeco.javacpp.opencv_calib3d.cvFindHomography; +import org.bytedeco.javacpp.opencv_core; +import static org.bytedeco.javacpp.opencv_core.cvCreateImage; +import static org.bytedeco.javacpp.opencv_core.cvCreateMat; +import org.bytedeco.javacpp.opencv_imgproc; +import processing.core.PApplet; +import processing.core.PConstants; +import processing.core.PImage; +import processing.core.PVector; +import processing.opengl.Texture; + +/** + * + * @author jiii + */ +public class ImageUtils { + + public static void byteBufferDepthK1MMtoARGB(ByteBuffer gray, ByteBuffer argb) { + byte[] depthRaw = new byte[2]; + for (int i = 0; i < argb.capacity(); i += 4) { + gray.get(depthRaw); + int d = (depthRaw[0] & 255) << 8 | (depthRaw[1] & 255); + // min depth: 400 + byte dValue = (byte) ((d - 300.0F) / 3000.0F * 255.0F); + argb.put(dValue); + argb.put(dValue); + argb.put(dValue); + argb.put((byte) 255); + } + argb.rewind(); + } + + public static opencv_core.CvMat createHomography(PVector[] in, PVector[] out) { + opencv_core.CvMat srcPoints; + opencv_core.CvMat dstPoints; + int nbPoints = in.length; + opencv_core.CvMat homography; + // TODO: no create map + srcPoints = cvCreateMat(2, in.length, opencv_core.CV_32FC1); + dstPoints = cvCreateMat(2, in.length, opencv_core.CV_32FC1); + homography = cvCreateMat(3, 3, opencv_core.CV_32FC1); + for (int i = 0; i < in.length; i++) { + srcPoints.put(i, in[i].x); + srcPoints.put(i + nbPoints, in[i].y); + dstPoints.put(i, out[i].x); + dstPoints.put(i + nbPoints, out[i].y); + } + cvFindHomography(srcPoints, dstPoints, homography); + // It is better to use : GetPerspectiveTransform + return homography; + } + + public static void createAnaglyph(PImage imgL, PImage imgR, PImage imgOut) { + imgL.loadPixels(); + imgR.loadPixels(); + imgOut.loadPixels(); + int[] pL = imgL.pixels; + int[] pR = imgR.pixels; + int[] pO = imgOut.pixels; + for (int i = 0; i < pL.length; i++) { + pO[i] = (pR[i] >> 16) << 16 | (pL[i] >> 8) & 255 << 8 | pL[i] & 255; + // pO[i] = pL[i]; + } + imgOut.updatePixels(); + // imgL.updatePixels(); + } + + + // TODO wtf + private static byte[] kinectByteArray = null; + + + public static void IplImageToPImageKinect(opencv_core.IplImage img, boolean RGB, PImage ret) { + // conversionCount++; + // if (conversionCount % 30 == 0) { + // System.gc(); + // } + assert (img.width() == ret.width); + assert (img.height() == ret.height); + // BufferedImage bimg = new BufferedImage(); + if (img.nChannels() == 3) { + System.out.println("3 channels"); + ByteBuffer buff = img.getByteBuffer(); + // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); + ret.loadPixels(); + if (RGB) { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + // ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); + ret.pixels[i] = (buff.get(offset) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset + 2) & 255); + } + } else { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + // ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); + ret.pixels[i] = (buff.get(offset + 2) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset) & 255); + } + } + } else if (img.nChannels() == 1) { + ////////////// Kinect Depth ////////////// + ByteBuffer buff = img.getByteBuffer(); + if (kinectByteArray == null) { + kinectByteArray = new byte[2 * img.width() * img.height()]; + } + // else { + // Arrays.fill(kinectByteArray, (byte) 0); + // } + buff.get(kinectByteArray); + for (int i = 0; i < img.width() * img.height() * 2; i += 2) { + int d = (kinectByteArray[i] & 255) << 8 | (kinectByteArray[i + 1] & 255); + ret.pixels[i / 2] = d; + // ret.pixels[i] = + // (buff.get(i) & 0xFF) << 16 + // | (buff.get(i) & 0xFF) << 8 + // | (buff.get(i) & 0xFF); + } + } + // buff = null; + ret.updatePixels(); + } + + public static void byteBufferZ16toARGB(ByteBuffer gray, ByteBuffer argb) { + byte[] tmpArr = new byte[2]; + gray.rewind(); + for (int i = 0; i < argb.capacity(); i += 4) { + gray.get(tmpArr); + argb.put(tmpArr[0]); + argb.put(tmpArr[1]); + argb.put((byte) 128); + argb.put((byte) 255); + } + argb.rewind(); + } + + public static void byteBufferGRAYtoARGB(ByteBuffer gray, ByteBuffer argb) { + byte[] tmpArr = new byte[1]; + for (int i = 0; i < gray.capacity(); i++) { + gray.get(tmpArr); + argb.put(tmpArr[0]); + argb.put(tmpArr[0]); + argb.put(tmpArr[0]); + argb.put((byte) 255); + } + argb.rewind(); + } + + public static void remapImageIpl(opencv_core.CvMat homography, opencv_core.IplImage imgIn, opencv_core.IplImage imgOut) { + opencv_imgproc.cvWarpPerspective(imgIn, imgOut, homography); + // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); + // getFillColor()); + } + + public static opencv_core.IplImage createImageFrom(opencv_core.IplImage imgIn, PImage Pout) { + // TODO: avoid this creation !! + opencv_core.CvSize outSize = new opencv_core.CvSize(); + outSize.width(Pout.width); + outSize.height(Pout.height); + opencv_core.IplImage imgOut = cvCreateImage(outSize, // size + imgIn.depth(), // depth + imgIn.nChannels()); + // imgIn.w + return imgOut; + } + + public static opencv_core.IplImage createImageFrom(opencv_core.IplImage imgIn) { + // TODO: avoid this creation !! + opencv_core.CvSize outSize = new opencv_core.CvSize(); + outSize.width(imgIn.width()); + outSize.height(imgIn.height()); + opencv_core.IplImage imgOut = cvCreateImage(outSize, // size + imgIn.depth(), // depth + imgIn.nChannels()); + // imgIn.w + return imgOut; + } + + public static opencv_core.IplImage createImageFrom(PImage in) { + // TODO: avoid this creation !! + opencv_core.CvSize outSize = new opencv_core.CvSize(); + outSize.width(in.width); + outSize.height(in.height); + System.out.println("inputImage to create an IPL:" + in.width + " " + in.height + " " + in.format); + opencv_core.IplImage imgOut = null; + if (in.format == PConstants.RGB) { + imgOut = cvCreateImage(outSize, opencv_core.IPL_DEPTH_8U, // depth + 3); + } + if (in.format == PConstants.ALPHA || in.format == PConstants.GRAY) { + imgOut = cvCreateImage(outSize, opencv_core.IPL_DEPTH_8U, // depth + 1); + } + if (in.format == PConstants.ARGB) { + imgOut = cvCreateImage(outSize, opencv_core.IPL_DEPTH_8U, // depth + 4); + } + // imgIn.w + return imgOut; + } + + public static void byteBufferBRGtoARGB(ByteBuffer bgr, ByteBuffer argb) { + byte[] tmpArr = new byte[3]; + for (int i = 0; i < bgr.capacity(); i += 3) { + bgr.get(tmpArr); + argb.put(tmpArr[2]); + argb.put(tmpArr[1]); + argb.put(tmpArr[0]); + argb.put((byte) 255); + } + argb.rewind(); + } + + /** + * + * Deprecated + */ + // static public void PImageToIplImage(PImage src, IplImage dst) { + // dst.copyFrom((BufferedImage) src.getImage()); + // } + public static void PImageToIplImage2(opencv_core.IplImage img, boolean RGB, PImage ret) { + ByteBuffer buff = img.getByteBuffer(); + ret.loadPixels(); + if (RGB) { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + ret.pixels[i] = (buff.get(offset) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset + 2) & 255); + } + } else { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + ret.pixels[i] = (buff.get(offset + 2) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset) & 255); + } + } + ret.updatePixels(); + } + + public static opencv_core.IplImage createNewSizeImageFrom(opencv_core.IplImage imgIn, int width, int height) { + // TODO: avoid this creation !! + opencv_core.CvSize outSize = new opencv_core.CvSize(); + outSize.width(width); + outSize.height(height); + opencv_core.IplImage imgOut = cvCreateImage(outSize, // size + imgIn.depth(), // depth + imgIn.nChannels()); + // imgIn.w + return imgOut; + } + + public static void byteBufferRGBtoARGB(ByteBuffer bgr, ByteBuffer argb) { + byte[] tmpArr = new byte[3]; + for (int i = 0; i < bgr.capacity(); i += 3) { + bgr.get(tmpArr); + argb.put(tmpArr[0]); + argb.put(tmpArr[1]); + argb.put(tmpArr[2]); + argb.put((byte) 255); + } + argb.rewind(); + } + + public static void remapImage(PVector[] in, PVector[] out, opencv_core.IplImage imgIn, opencv_core.IplImage imgTmp, PImage Pout) { + opencv_core.CvMat srcPoints; + opencv_core.CvMat dstPoints; + int nbPoints = in.length; + opencv_core.CvMat homography; + // TODO: no create map + srcPoints = cvCreateMat(2, in.length, opencv_core.CV_32FC1); + dstPoints = cvCreateMat(2, in.length, opencv_core.CV_32FC1); + homography = cvCreateMat(3, 3, opencv_core.CV_32FC1); + for (int i = 0; i < in.length; i++) { + srcPoints.put(i, in[i].x); + srcPoints.put(i + nbPoints, in[i].y); + dstPoints.put(i, out[i].x); + dstPoints.put(i + nbPoints, out[i].y); + } + cvFindHomography(srcPoints, dstPoints, homography); + // It is better to use : GetPerspectiveTransform + opencv_imgproc.cvWarpPerspective(imgIn, imgTmp, homography); + // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); + // getFillColor()); + IplImageToPImage(imgTmp, false, Pout); + } + + public static void remapImage(opencv_core.CvMat homography, opencv_core.IplImage imgIn, opencv_core.IplImage imgTmp, PImage Pout) { + remapImage(homography, imgIn, imgTmp, Pout, false); + } + + public static void remapImage(opencv_core.CvMat homography, opencv_core.IplImage imgIn, opencv_core.IplImage imgTmp, PImage Pout, boolean isRgb) { + opencv_imgproc.cvWarpPerspective(imgIn, imgTmp, homography); + // opencv_imgproc.CV_INTER_LINEAR ); // opencv_imgproc.CV_WARP_FILL_OUTLIERS); + // getFillColor()); + IplImageToPImage(imgTmp, isRgb, Pout); + } + + // TO USE INSIDE THE DRAW FUNCTION + // TODO: Experimental -> To validate... + // static public Texture createTextureFrom(PApplet parent, IplImage img) { + // Texture tex = null; + // + // // We suppose... Depth = 3 : BGR and Depth = 4 : RGBA (even though it is written ARGB for Processing...) + // if (img.nChannels() == 3) { + // tex = new Texture(img.width(), img.height(), PApplet.RGB); + // } + // if (img.nChannels() == 4) { + // tex = new Texture(img.width(), img.height(), PApplet.ARGB); + // } + // return tex; + // } + public static void updateTexture(opencv_core.IplImage img, Texture tex) { + System.out.println("Update Texture broken ? May Require CustomTexture..."); + // if (img.nChannels() == 3) { + // tex.putBuffer(GL.GL_BGR, GL.GL_UNSIGNED_BYTE, img.getIntBuffer()); + // } + // if (img.nChannels() == 4) { + // tex.putBuffer(GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, img.getIntBuffer()); + // } + } + + public static void byteBufferDepthK2toARGB(ByteBuffer gray, ByteBuffer argb) { + FloatBuffer floatGray = gray.asFloatBuffer(); + float[] tmpArr = new float[1]; + for (int i = 0; i < argb.capacity(); i += 4) { + floatGray.get(tmpArr); + // 8 meters + byte v = (byte) (tmpArr[0] / 8000 * 255); + // byte v = (byte) (tmpArr[0] << 8 | tmpArr[1]); + argb.put((byte) (v)); + argb.put((byte) (v)); + argb.put((byte) (v)); + argb.put((byte) 255); + } + argb.rewind(); + } + + // TODO: clean all this ! + public static void IplImageToPImage(opencv_core.IplImage img, PApplet applet, boolean RGB, PImage ret) { + IplImageToPImage(img, RGB, ret); + } + + public static void IplImageToPImage(opencv_core.IplImage img, Camera.PixelFormat format, PImage ret) { + if (format == Camera.PixelFormat.RGB) { + IplImageToPImage(img, true, ret); + } + if (format == Camera.PixelFormat.BGR) { + IplImageToPImage(img, false, ret); + } + } + + public static void IplImageToPImage(opencv_core.IplImage img, PImage ret) { + IplImageToPImage(img, true, ret); + } + + public static void IplImageToPImage(opencv_core.IplImage img, boolean RGB, PImage ret) { + // conversionCount++; + // if (conversionCount % 600 == 0) { + // System.gc(); + // } + assert (img.width() == ret.width); + assert (img.height() == ret.height); + ret.loadPixels(); + if (img.nChannels() == 3) { + ByteBuffer buff = img.getByteBuffer(); + // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); + if (RGB) { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + ret.pixels[i] = (buff.get(offset) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset + 2) & 255); + } + } else { + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 3; + ret.pixels[i] = (buff.get(offset + 2) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset) & 255); + } + } + } + if (img.nChannels() == 4) { + ByteBuffer buff = img.getByteBuffer(); + // PImage ret = new PImage(img.width(), img.height(), PApplet.RGB); + for (int i = 0; i < img.width() * img.height(); i++) { + int offset = i * 4; + // ret.pixels[i] = applet.color(buff.get(offset + 0) & 0xff, buff.get(offset + 1) & 0xFF, buff.get(offset + 2) & 0xff); + ret.pixels[i] = (255) << 24 | (buff.get(offset) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset + 2) & 255); + } + } + if (img.nChannels() == 1) { + // TODO: no more allocations. + ByteBuffer buff = img.getByteBuffer(); + byte[] tmpArr = new byte[1]; + // byte[] arr = new byte[img.width() * img.height()]; + // buff.get(arr); + for (int i = 0; i < img.width() * img.height(); i++) { + buff.get(tmpArr); + byte d = tmpArr[0]; + // int d = (arr[i] & 0xFF); + ret.pixels[i] = (255) << 24 | (d & 255) << 16 | (d & 255) << 8 | (d & 255); + } + } + ret.updatePixels(); + } + + public static void byteBufferGRAY32toARGB(ByteBuffer gray, ByteBuffer argb) { + FloatBuffer floatGray = gray.asFloatBuffer(); + float[] tmpArr = new float[1]; + for (int i = 0; i < argb.capacity(); i += 4) { + floatGray.get(tmpArr); + byte v = (byte) (tmpArr[0] / 65535.0 * 255); + // byte v = (byte) (tmpArr[0] << 8 | tmpArr[1]); + argb.put((byte) (v)); + argb.put((byte) (v)); + argb.put((byte) (v)); + argb.put((byte) 255); + } + argb.rewind(); + } + +} diff --git a/papart/src/fr/inria/papart/utils/LibraryUtils.java b/papart/src/fr/inria/papart/utils/LibraryUtils.java new file mode 100644 index 00000000..dc479942 --- /dev/null +++ b/papart/src/fr/inria/papart/utils/LibraryUtils.java @@ -0,0 +1,103 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package fr.inria.papart.utils; + +import fr.inria.papart.procam.Papart; +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.net.URL; +import toxi.geom.Matrix4x4; + +/** + * + * @author jiii + */ +public class LibraryUtils { + + public static Process runExample(String exampleName, boolean silent) { + try { + StringBuilder commandLine = new StringBuilder(); + String papartFolder = getPapartFolder(); + String sketchFolder = "/examples/" + exampleName + "/"; + // On linux only + commandLine.append("nohup "); + // TODO: find processing-java even when not installed ! + // Or make an easy install... + commandLine.append("processing-java "); + commandLine.append("--sketch=").append(papartFolder).append(sketchFolder).append(" --output=").append(papartFolder).append(sketchFolder).append("build").append(" --force --run"); + // commandLine.append("\""); + // processing-java --sketch=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/ --output=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/build --force --run + // println("Starting... \n" + commandLine.toString()); + // TODO: Alternative on Windows... when /bin/sh is not installed. + Process p = Runtime.getRuntime().exec(commandLine.toString()); + // Process p = Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", commandLine.toString()}); + // Process p = Runtime.getRuntime().exec(new String[]{"nohup", commandLine.toString()}); + if (!silent) { + String line; + BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream())); + BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream())); + while ((line = bri.readLine()) != null) { + System.out.println(line); + } + bri.close(); + while ((line = bre.readLine()) != null) { + System.out.println(line); + } + bre.close(); + } + return p; + // p.waitFor(); + } catch (Exception e) { + System.out.println("Could not start the Papart example : " + exampleName + "\n" + e); + } + ; + return null; + } + // sketchbook + + public static String getPapartFolder() { + String sketchbook = System.getenv("SKETCHBOOK"); + if (sketchbook != null) { + System.out.println("Found SKETCHBOOK environment variable."); + return sketchbook + "/libraries/" + ARToolkitPlusUtils.LibraryName; + } + return getLibrariesFolder() + "/" + ARToolkitPlusUtils.LibraryName; + } + + public static String getLibrariesFolder() { + // This is used, as Papart classes are often linked to another folder... + URL main = Matrix4x4.class.getResource("Matrix4x4.class"); +// URL main = Papart.class.getResource("Papart.class"); + String tmp = main.getPath(); + System.out.println("path " + tmp); + // its in a jar + if (tmp.contains("!")) { + tmp = tmp.substring(0, tmp.indexOf('!')); + tmp = tmp.replace("file:", ""); + // tmp = tmp.replace("file:/", ""); TODO: OS check ? + } + File f = new File(tmp); + if (!f.exists()) { + System.err.println("Error in loading the Sketchbook folder."); + } + // if the file is within a library/lib folder + if (f.getParentFile().getAbsolutePath().endsWith("/lib")) { + // pathToSketchbook/libraries/myLib/library/lib/myLib.jar + f = f.getParentFile().getParentFile().getParentFile().getParentFile(); + } else { + // pathToSketchbook/libraries/myLib/library/myLib.jar + f = f.getParentFile().getParentFile().getParentFile(); + } + return f.getAbsolutePath(); + } + + // processing-java --sketch=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/ --output=/home/jiii/papart/sketches/papartExamples/Kinect/MultiTouchKinect/build --force --run + public static String getLibraryFolder(String libname) { + return getLibrariesFolder() + "/libraries/" + libname; + } + +} diff --git a/papart/src/fr/inria/papart/utils/MathUtils.java b/papart/src/fr/inria/papart/utils/MathUtils.java new file mode 100644 index 00000000..359d4ace --- /dev/null +++ b/papart/src/fr/inria/papart/utils/MathUtils.java @@ -0,0 +1,334 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package fr.inria.papart.utils; + +import fr.inria.papart.procam.PaperTouchScreen; +import fr.inria.papart.procam.camera.Camera; +import java.io.FileNotFoundException; +import java.nio.ByteBuffer; +import org.bytedeco.javacpp.opencv_core; +import processing.core.PApplet; +import static processing.core.PApplet.abs; +import processing.core.PGraphics; +import processing.core.PImage; +import processing.core.PMatrix3D; +import processing.core.PVector; +import toxi.geom.Vec3D; + +/** + * + * @author Jérémy Laviole + */ +public class MathUtils { + + // ---- Vector Utility ---- + /** + * Vec3D to PVector + * + * @param p + * @return + */ + public static PVector toPVector(Vec3D p) { + return new PVector(p.x, p.y, p.z); + } + + /** + * PVector to Vec3D + * + * @param p + * @return + */ + public static Vec3D toVec(PVector p) { + return new Vec3D(p.x, p.y, p.z); + } + + // ---- Matrix Utility ---- + // TODO: finish this, find another source... + // + /** + * * + * Get the Rotations, in the Unity3D format. [WARNING] Work in progress. + * http://planning.cs.uiuc.edu/node103.html + * + * @param mat + * @return + */ + public static PVector getRotations(PMatrix3D mat) { + PVector r = new PVector(); + r.z = PApplet.atan(mat.m10 / mat.m00); + r.y = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22)); + r.x = PApplet.atan(-mat.m21 / PApplet.sqrt(mat.m21 * mat.m21 + mat.m22 * mat.m22)); + return null; + } + + /** + * Add two matrices, src += toAdd + * + * @param src + * @param toAdd + */ + public static void addPMatrix3D(PMatrix3D src, PMatrix3D toAdd) { + src.m00 += toAdd.m00; + src.m01 += toAdd.m01; + src.m02 += toAdd.m02; + src.m03 += toAdd.m03; + src.m10 += toAdd.m10; + src.m11 += toAdd.m11; + src.m12 += toAdd.m12; + src.m13 += toAdd.m13; + src.m20 += toAdd.m20; + src.m21 += toAdd.m21; + src.m22 += toAdd.m22; + src.m23 += toAdd.m23; + src.m30 += toAdd.m30; + src.m31 += toAdd.m31; + src.m32 += toAdd.m32; + src.m33 += toAdd.m33; + } + + /** + * Multiply a vector by a Matrix. + * + * @param mat source matrix + * @param source vector to multiply + * @param target output, will be created if null. + * @return + */ + public static PVector mult(PMatrix3D mat, PVector source, PVector target) { + if (target == null) { + target = new PVector(); + } + target.x = mat.m00 * source.x + mat.m01 * source.y + mat.m02 * source.z + mat.m03; + target.y = mat.m10 * source.x + mat.m11 * source.y + mat.m12 * source.z + mat.m13; + target.z = mat.m20 * source.x + mat.m21 * source.y + mat.m22 * source.z + mat.m23; + float tw = mat.m30 * source.x + mat.m31 * source.y + mat.m32 * source.z + mat.m33; + if (tw != 0 && tw != 1) { + target.div(tw); + } + return target; + } + + /** + * Load a PMatrix3D from a file. Really simple file format, using + * loadStrings. + * + * @param pa + * @param filename + * @return + * @throws FileNotFoundException + */ + public static PMatrix3D loadPMatrix3D(PApplet pa, String filename) throws FileNotFoundException { + String[] lines = pa.loadStrings(filename); + if (lines == null) { + throw new FileNotFoundException(filename); + } + PMatrix3D mat = new PMatrix3D(Float.parseFloat(lines[0]), Float.parseFloat(lines[1]), Float.parseFloat(lines[2]), Float.parseFloat(lines[3]), Float.parseFloat(lines[4]), Float.parseFloat(lines[5]), Float.parseFloat(lines[6]), Float.parseFloat(lines[7]), Float.parseFloat(lines[8]), Float.parseFloat(lines[9]), Float.parseFloat(lines[10]), Float.parseFloat(lines[11]), Float.parseFloat(lines[12]), Float.parseFloat(lines[13]), Float.parseFloat(lines[14]), Float.parseFloat(lines[15])); + return mat; + } + + // TODO: throws ... + /** + * Save a PMatrix3D to a file. Really simple file format, using saveStrings. + * + * @param pa + * @param mat + * @param filename + */ + public static void savePMatrix3D(PApplet pa, PMatrix3D mat, String filename) { + String[] lines = new String[16]; + lines[0] = Float.toString(mat.m00); + lines[1] = Float.toString(mat.m01); + lines[2] = Float.toString(mat.m02); + lines[3] = Float.toString(mat.m03); + lines[4] = Float.toString(mat.m10); + lines[5] = Float.toString(mat.m11); + lines[6] = Float.toString(mat.m12); + lines[7] = Float.toString(mat.m13); + lines[8] = Float.toString(mat.m20); + lines[9] = Float.toString(mat.m21); + lines[10] = Float.toString(mat.m22); + lines[11] = Float.toString(mat.m23); + lines[12] = Float.toString(mat.m30); + lines[13] = Float.toString(mat.m31); + lines[14] = Float.toString(mat.m32); + lines[15] = Float.toString(mat.m33); + pa.saveStrings(filename, lines); + } + + /** + * Multiply each element of a PMatrix3D by the scale. mat.m00 *= scale and + * so on... + * + * @param mat + * @param scale + */ + public static void scaleMat(PMatrix3D mat, float scale) { + mat.m00 *= scale; + mat.m01 *= scale; + mat.m02 *= scale; + mat.m03 *= scale; + mat.m10 *= scale; + mat.m11 *= scale; + mat.m12 *= scale; + mat.m13 *= scale; + mat.m20 *= scale; + mat.m21 *= scale; + mat.m22 *= scale; + mat.m23 *= scale; + mat.m30 *= scale; + mat.m31 *= scale; + mat.m32 *= scale; + mat.m33 *= scale; + } + + // ---- Color Utility ---- + /** + * Get a pixel from a PImage. + * + * @param img incoming image. + * @param x image space coordinate. + * @param y image space coordinate. + * @param RGB true if RGB, false if BGR + * @return + */ + public static int getColor(opencv_core.IplImage img, int x, int y, boolean RGB) { + if (img.nChannels() == 3) { + ByteBuffer buff = img.getByteBuffer(); + int offset = (img.width() * y + x) * 3; + if (RGB) { + return (buff.get(offset) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset + 2) & 255); + } else { + return (buff.get(offset + 2) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset) & 255); + } + } + // Operation not supported + return 0; + } + + /** + * RGB distance of two colors. Return true if all channels differences are + * below the difference threshold. + * + * @param c1 + * @param c2 + * @param threshold + * @return + */ + public static boolean colorDistRGB(int c1, int c2, int threshold) { + int r1 = c1 >> 16 & 255; + int g1 = c1 >> 8 & 255; + int b1 = c1 >> 0 & 255; + int r2 = c2 >> 16 & 255; + int g2 = c2 >> 8 & 255; + int b2 = c2 >> 0 & 255; + int dr = PApplet.abs(r1 - r2); + int dg = PApplet.abs(g1 - g2); + int db = PApplet.abs(b1 - b2); + return dr < threshold && dg < threshold && db < threshold; + } + + /** + * Color distance on the HSB scale. The incomingPix is compared with the + * baseline. The method returns true if each channel validates the condition + * for the given threshold. + * + * @param g + * @param baseline + * @param incomingPix + * @param hueTresh + * @param saturationTresh + * @param brightnessTresh + * @return + */ + public static boolean colorDistHSB(PGraphics g, int baseline, int incomingPix, + float hueTresh, float saturationTresh, float brightnessTresh) { + float h1 = g.hue(baseline); + float h2 = g.hue(incomingPix); + + return abs(h1 - h2) < hueTresh + && // Avoid desaturated pixels + g.saturation(incomingPix) > saturationTresh + && // avoid pixels not bright enough + g.brightness(incomingPix) > brightnessTresh; + } + + /** + * Warning here, the threshold is the same for each channel. Often the range + * depends on the declaration. To change the intensity of each, try to call + * HSB(100, 100, 100) for even thresholding or HSB(100, 200, 50) to be less + * picky on the brigthness and more picky on the saturation. + * + * @param g + * @param baseline + * @param incomingPix + * @param threshold + * @return + */ + public static boolean colorDistHSBAutoThresh(PGraphics g, int baseline, int incomingPix, + float threshold) { + float h1 = g.hue(baseline); + float h2 = g.hue(incomingPix); + + float d1 = abs(h1 - h2); + float d2 = abs(g.saturation(baseline) - g.saturation(incomingPix)); + float d3 = abs(g.brightness(baseline) - g.brightness(incomingPix)); + + return (d1 + d2 + d3) < (threshold * 3); + } + + /** + * Unsafe do not use unless you are sure. + */ + public static int getColorOccurencesFrom(Camera camera, PVector coord, int radius, int col, int threshold, PaperTouchScreen paperTouchScreen) { + int x = (int) coord.x; + int y = (int) coord.y; + int minX = PApplet.constrain(x - radius, 0, camera.width() - 1); + int maxX = PApplet.constrain(x + radius, 0, camera.width() - 1); + int minY = PApplet.constrain(y - radius, 0, camera.height() - 1); + int maxY = PApplet.constrain(y + radius, 0, camera.height() - 1); + ByteBuffer buff = camera.getIplImage().getByteBuffer(); + int k = 0; + for (int j = minY; j <= maxY; j++) { + for (int i = minX; i <= maxX; i++) { + int offset = i + j * camera.width(); + int pxCol = getColor(buff, offset); + if (MathUtils.colorDistRGB(col, pxCol, threshold)) { + k++; + } + } + } + return k; + } + + private static int getColor(ByteBuffer buff, int offset) { + offset = offset * 3; + return (buff.get(offset + 2) & 255) << 16 | (buff.get(offset + 1) & 255) << 8 | (buff.get(offset) & 255); + } + + /** + * Unsafe do not use unless you are sure. + */ + public int getColorOccurencesFrom(PVector coord, PImage cameraImage, int radius, int col, int threshold, PaperTouchScreen paperTouchScreen) { + int x = (int) coord.x; + int y = (int) coord.y; + int minX = PApplet.constrain(x - radius, 0, cameraImage.width - 1); + int maxX = PApplet.constrain(x + radius, 0, cameraImage.width - 1); + int minY = PApplet.constrain(y - radius, 0, cameraImage.height - 1); + int maxY = PApplet.constrain(y + radius, 0, cameraImage.height - 1); + int k = 0; + for (int j = minY; j <= maxY; j++) { + for (int i = minX; i <= maxX; i++) { + int offset = i + j * cameraImage.width; + int pxCol = cameraImage.pixels[offset]; + if (colorDistRGB(col, pxCol, threshold)) { + k++; + } + } + } + return k; + } + +} diff --git a/papart/test/fr/inria/papart/UtilsTest.java b/papart/test/fr/inria/papart/UtilsTest.java index 7ee6d7a3..056b59c3 100644 --- a/papart/test/fr/inria/papart/UtilsTest.java +++ b/papart/test/fr/inria/papart/UtilsTest.java @@ -19,7 +19,7 @@ */ package fr.inria.papart; -import fr.inria.papart.procam.Utils; +import fr.inria.papart.utils.ARToolkitPlusUtils; import org.bytedeco.javacpp.opencv_core.IplImage; import processing.core.PApplet; @@ -30,8 +30,12 @@ public class UtilsTest extends PApplet { @Override - public void setup() { + public void settings() { size(200, 200); + } + + @Override + public void setup() { stroke(155, 0, 0); } diff --git a/removeExamples.sh b/removeExamples.sh new file mode 100644 index 00000000..24c1a6b0 --- /dev/null +++ b/removeExamples.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +rm papart/src/papart-examples