├── doc
└── tagdesign.png
├── platforms
├── javascript
│ ├── todo.txt
│ ├── Makefile
│ ├── src
│ │ └── chilitags-javascript.js
│ └── samples
│ │ └── detection-2d
│ │ └── index.html
└── jni
│ ├── samples
│ ├── android-estimate3d
│ │ ├── res
│ │ │ ├── drawable-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ └── layout
│ │ │ │ └── activity_chilitags_sample_estimate3d.xml
│ │ ├── .classpath
│ │ ├── project.properties
│ │ ├── .project
│ │ ├── AndroidManifest.xml
│ │ └── src
│ │ │ └── ch
│ │ │ └── epfl
│ │ │ └── chili
│ │ │ └── chilitags
│ │ │ └── samples
│ │ │ └── estimate3d
│ │ │ └── Estimate3DActivity.java
│ ├── android-estimate3d-gui
│ │ ├── res
│ │ │ └── drawable-mdpi
│ │ │ │ └── ic_launcher.png
│ │ ├── .classpath
│ │ ├── project.properties
│ │ ├── proguard-project.txt
│ │ ├── .project
│ │ ├── src
│ │ │ └── ch
│ │ │ │ └── epfl
│ │ │ │ └── chili
│ │ │ │ └── chilitags
│ │ │ │ └── samples
│ │ │ │ └── estimate3d_gui
│ │ │ │ ├── shader
│ │ │ │ ├── LineShader.java
│ │ │ │ ├── YUV2RGBShader.java
│ │ │ │ └── Shader.java
│ │ │ │ ├── CameraPreviewGLSurfaceView.java
│ │ │ │ ├── Estimate3DGUIActivity.java
│ │ │ │ ├── GLESLine.java
│ │ │ │ └── CameraController.java
│ │ └── AndroidManifest.xml
│ └── README.md
│ └── src
│ ├── CMakeLists.txt
│ └── ch
│ └── epfl
│ └── chili
│ └── chilitags
│ ├── CVSize.java
│ └── ObjectTransform.java
├── .gitmodules
├── .gitignore
├── chilitags.pc.in
├── test
├── README.md
├── CMakeLists.txt
├── find-crash.cpp
├── integration.cpp
├── codec.cpp
├── Filter.cpp
├── float-precision.cpp
├── drawer.cpp
└── test-metadata.hpp
├── .travis.yml
├── samples
├── detection
│ ├── README.md
│ └── detect-from-file.cpp
├── CMakeLists.txt
├── 3destimation
│ └── estimate3d.cpp
└── multithreaded
│ └── async-detection.cpp
├── src
├── GrowRoi.hpp
├── Refine.hpp
├── EnsureGreyscale.hpp
├── ScreenOut.hpp
├── FindQuads.hpp
├── ReadBits.hpp
├── EnsureGreyscale.cpp
├── Track.hpp
├── ScreenOut.cpp
├── Decode.hpp
├── GrowRoi.cpp
├── Filter.hpp
├── Detect.hpp
├── Decode.cpp
├── CMakeLists.txt
├── Refine.cpp
├── Track.cpp
├── Filter.cpp
├── Codec.hpp
├── EstimatePose3D.cpp
├── Detect.cpp
├── EstimatePose3D.hpp
└── FindQuads.cpp
├── share
└── tag_configuration_sample.yml
├── tools
├── CMakeLists.txt
└── creator
│ ├── creator.cpp
│ └── README.md
├── .ycm_extra_conf.py
├── cmake
├── UseJavaExtensions.cmake
└── TargetDoc.cmake
└── CMakeLists.txt
/doc/tagdesign.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/royshil/chilitags/master/doc/tagdesign.png
--------------------------------------------------------------------------------
/platforms/javascript/todo.txt:
--------------------------------------------------------------------------------
1 | * Allow JSON files as camera calibration and marker configuration
2 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "test/data"]
2 | path = test/data
3 | url = https://github.com/chili-epfl/chilitags-testdata.git
4 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/royshil/chilitags/master/platforms/jni/samples/android-estimate3d/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/royshil/chilitags/master/platforms/jni/samples/android-estimate3d-gui/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #Build caches
2 | build*/
3 | bin/
4 | gen/
5 | libs/
6 |
7 | #Eclipse files
8 | /.cproject
9 | /.project
10 | .settings
11 | .directory
12 |
13 | #Markdown cache
14 | *.md.html
15 |
16 | #???
17 | /Default
18 |
19 | #Python cache
20 | *.pyc
21 |
22 |
--------------------------------------------------------------------------------
/chilitags.pc.in:
--------------------------------------------------------------------------------
1 | prefix=@CMAKE_INSTALL_PREFIX@
2 | exec_prefix=${prefix}
3 | libdir=${exec_prefix}/lib
4 | includedir=${prefix}/include
5 |
6 | Name: chilitags
7 | Description: Robust Fiducial Markers for Augmented Reality
8 | Version: @CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@
9 | Libs: -L${libdir} -lchilitags
10 | Cflags: @COMPILE_FLAGS@ -I${includedir}/chilitags
11 |
--------------------------------------------------------------------------------
/platforms/javascript/Makefile:
--------------------------------------------------------------------------------
1 | chilitags.js: src/jschilitags.cpp src/chilitags-javascript.js
2 | em++ -std=c++11 -O2 -s OUTLINING_LIMIT=40000 src/jschilitags.cpp -lchilitags -lopencv_core -lopencv_imgproc -lopencv_calib3d -lhighgui -o $@ --post-js src/chilitags-javascript.js -s EXPORTED_FUNCTIONS="['_setFilter', '_find', '_set3DFilter', '_set2DFilter', '_estimate', '_readTagConfiguration', '_setDefaultTagSize', '_readCalibration', '_getCameraMatrix', '_getDistortionCoeffs']"
3 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/test/README.md:
--------------------------------------------------------------------------------
1 | Chilitags have been extensively used in the past years, providing "real word"
2 | tests. Automated tests are a more recent addition.
3 |
4 | To run automated tests, you need to activate them in the CMake configuration
5 | (option `WITH_TESTS`). The test data is a submodule, you need to get it before
6 | being able to run tests.
7 |
8 | Example on Unix :
9 | ```
10 | git clone --recursive git@github.com:chili-epfl/chilitags
11 | cd chilitags
12 | mkdir build
13 | cd build
14 | ccmake .. # set the option `WITH_TESTS` to `ON`
15 | make
16 | cd test && ctest
17 | ```
18 |
19 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-19
15 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 |
3 | compiler:
4 | - clang
5 | - gcc
6 |
7 | before_install:
8 | - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
9 | - sudo add-apt-repository -y ppa:kubuntu-ppa/backports
10 | - sudo apt-get update -qq
11 | - sudo apt-get install -qq g++-4.8 libopencv-dev
12 | - if [ "$CXX" = "g++" ]; then sudo apt-get install -qq g++-4.8; fi
13 | - if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
14 | - sudo apt-get install -qq openjdk-7-jdk
15 | - export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
16 |
17 | before_script:
18 | - mkdir build
19 | - cd build
20 |
21 | script:
22 | - cmake -DWITH_TESTS=ON -DWITH_TOOLS=ON -DWITH_SAMPLES=ON -DWITH_JNI_BINDINGS=ON ..
23 | - make
24 | - cd test && ctest -V
25 |
26 | branches:
27 | only:
28 | - master
29 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/res/layout/activity_chilitags_sample_estimate3d.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | chilitags-sample-estimate3d
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | chilitags-sample-estimate3d-gui
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/src/ch/epfl/chili/chilitags/samples/estimate3d_gui/shader/LineShader.java:
--------------------------------------------------------------------------------
1 | package ch.epfl.chili.chilitags.samples.estimate3d_gui.shader;
2 |
3 | /**
4 | * Simple line shader, paints all of the interpolated pixels the same color
5 | * @author Ayberk Özgür
6 | */
7 | public class LineShader extends Shader {
8 |
9 | @Override
10 | protected String getVertexShader() {
11 | return "attribute vec4 a_position; \n" +
12 | "void main() { \n" +
13 | " gl_Position = a_position; \n" +
14 | "} \n";
15 | }
16 |
17 | @Override
18 | protected String getFragmentShader() {
19 | return "#ifdef GL_ES \n" +
20 | "precision highp float; \n" +
21 | "#endif \n" +
22 | "uniform vec4 v_color; \n" +
23 | "void main() { \n" +
24 | " gl_FragColor = v_color; \n" +
25 | "} \n";
26 | }
27 |
28 | @Override
29 | protected void loadUniforms() { /*No auto uniforms*/ }
30 |
31 | @Override
32 | protected void getUniformHandles() { /*No auto uniforms*/ }
33 | }
34 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
15 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
16 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/samples/detection/README.md:
--------------------------------------------------------------------------------
1 | Chilitags Detector Sample
2 | =========================
3 |
4 | `detect-live` has two purposes: allowing to quickly test the detection of chilitags, and illustrate the use of the library.
5 |
6 |
7 |
8 | Usage of `detect-live`
9 | ----------------------
10 |
11 | `detect-live` displays the identifier and the size of the tags detected on the live feed of a camera.
12 |
13 | ### Synopsis
14 |
15 | detect-live [x-res y-res [camera-index]]
16 |
17 | ### Description
18 |
19 | *x-res y-res* are the resolution parameter to give to the camera.
20 | By default, `detect-live` grabs 640x480 images.
21 |
22 | *camera-index* is the index of the camera to use to grab images.
23 | By default, it is 0.
24 | If multiple cameras are attached to the computer, you can select them by increasing the index.
25 | For example, 1 is the second camera attached to the computer.
26 |
27 |
28 |
29 | Using chilitags in your code.
30 | -----------------------------
31 |
32 | The source code provided here shows how to use the chilitags library.
33 | The comments in `detect-live.cpp` are meant to be a tutorial on how to integrate the detection in your application.
34 | They also explain how to use the information produced by the detection of tags, i.e. the position and identifier of the detected tags.
35 | More detailed documentation can be found in the headers of the library.
36 | If you are more curious, you will have to dive into the source code of the library.
37 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/src/ch/epfl/chili/chilitags/samples/estimate3d_gui/CameraPreviewGLSurfaceView.java:
--------------------------------------------------------------------------------
1 | package ch.epfl.chili.chilitags.samples.estimate3d_gui;
2 |
3 | import ch.epfl.chili.chilitags.Chilitags3D;
4 | import android.content.Context;
5 | import android.opengl.GLSurfaceView;
6 |
7 | public class CameraPreviewGLSurfaceView extends GLSurfaceView {
8 |
9 | /**
10 | * Our GL surface. It will hold the rendered the camera image on the background and the frames of all detected tags.
11 | *
12 | * @param context Current context
13 | * @param camController The camera controller that holds the camera image buffer
14 | * @param chilitags The Chilitags3D object that detects tags and calculates their transforms w.r.t the camera
15 | * @param camCalib Camera calibration matrix that was fed to Chilitags3D
16 | * @param xScale The inverse of the downscale value that was induced to the Chilitags processing image width vs. the camera image width
17 | * @param yScale The inverse of the downscale value that was induced to the Chilitags processing image height vs. the camera image height
18 | */
19 | public CameraPreviewGLSurfaceView(Context context, CameraController camController, Chilitags3D chilitags, double[] camCalib, double xScale, double yScale) {
20 | super(context);
21 | setEGLContextClientVersion(2); //We're declaring that we're using GLES 2.0
22 | setRenderer(new CameraPreviewRenderer(camController,chilitags,camCalib,xScale,yScale));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/platforms/jni/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CMAKE_FIND_ROOT_PATH_OLD ${CMAKE_FIND_ROOT_PATH}) #A small hack to search for Java in our host system
2 | set(CMAKE_FIND_ROOT_PATH /)
3 | find_package(Java REQUIRED)
4 | include(UseJava)
5 | include(UseJavaExtensions) #Our custom Java extensions
6 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH_OLD})
7 |
8 | #For finding jni.h while we're not on an Android toolchain
9 | if(NOT ANDROID)
10 | find_package(JNI REQUIRED)
11 | include_directories(${JNI_INCLUDE_DIRS})
12 | endif()
13 |
14 | file(GLOB_RECURSE chilitags_jni_bindings_source *.cpp)
15 | file(GLOB_RECURSE chilitags_jni_wrapper_source *.java)
16 |
17 | add_library(
18 | chilitags_jni_bindings
19 | SHARED
20 | ${chilitags_jni_bindings_source}
21 | )
22 |
23 | target_link_libraries(chilitags_jni_bindings chilitags)
24 |
25 | install (TARGETS chilitags_jni_bindings
26 | LIBRARY DESTINATION lib
27 | ARCHIVE DESTINATION lib
28 | )
29 |
30 | set(CMAKE_JAVA_COMPILE_FLAGS ${CMAKE_JAVA_COMPILE_FLAGS} -encoding UTF-8)
31 | add_jar(chilitags-jni-wrapper ${chilitags_jni_wrapper_source})
32 | add_jar_no_compile(chilitags-jni-wrapper-sources ${chilitags_jni_wrapper_source})
33 |
34 | if(ANDROID_INSTALL_LIBRARIES)
35 |
36 | install(TARGETS chilitags_jni_bindings
37 | LIBRARY DESTINATION ${ANDROID_PROJECT_ROOT}/libs/$ENV{ANDROID_ABI}/
38 | ARCHIVE DESTINATION ${ANDROID_PROJECT_ROOT}/libs/$ENV{ANDROID_ABI}/
39 | )
40 |
41 | install_jar(chilitags-jni-wrapper ${ANDROID_PROJECT_ROOT}/libs/)
42 | install_jar(chilitags-jni-wrapper-sources ${ANDROID_PROJECT_ROOT}/libs/)
43 | endif()
44 |
--------------------------------------------------------------------------------
/platforms/jni/src/ch/epfl/chili/chilitags/CVSize.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2014 EPFL *
3 | * *
4 | * This file is part of chilitags. *
5 | * *
6 | * Chilitags is free software: you can redistribute it and/or modify *
7 | * it under the terms of the Lesser GNU General Public License as *
8 | * published by the Free Software Foundation, either version 3 of the *
9 | * License, or (at your option) any later version. *
10 | * *
11 | * Chilitags is distributed in the hope that it will be useful, *
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 | * GNU Lesser General Public License for more details. *
15 | * *
16 | * You should have received a copy of the GNU Lesser General Public License *
17 | * along with Chilitags. If not, see . *
18 | *******************************************************************************/
19 |
20 | package ch.epfl.chili.chilitags;
21 |
22 | /**
23 | * Simple wrapper for CV::Size.
24 | *
25 | * @author Ayberk Özgür
26 | *
27 | */
28 | public class CVSize{
29 | public int height;
30 | public int width;
31 |
32 | public CVSize(){
33 | height = -1;
34 | width = -1;
35 | }
36 | }
--------------------------------------------------------------------------------
/src/GrowRoi.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef GrowRoi_HPP
22 | #define GrowRoi_HPP
23 |
24 | #include
25 |
26 | namespace chilitags {
27 |
28 | cv::Rect growRoi(
29 | const cv::Mat &inputImage,
30 | cv::InputArray points,
31 | float growthRatio);
32 |
33 | }
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/share/tag_configuration_sample.yml:
--------------------------------------------------------------------------------
1 | %YAML:1.0
2 | # This file describes how tags are placed on objects.
3 | #
4 | # This can also be used to provide tag aliases, or transform the computed
5 | # origin of a tag.
6 | #
7 | # This sample file define 3 objects, and covers the different options
8 | # available.
9 |
10 | # This first object has only one tag (ID 0). 'myobject1' is the name returned
11 | # by the object detector. The size of the tag is 20x20 (the unit does not
12 | # matter, but must be consistent with the calibration unit. We recommend to use
13 | # millimeters).
14 | # This simple declaration allows to define name aliases for tags. 'tag'
15 | # and 'size' are the only two mandatory fields.
16 | myobject1:
17 | - tag: 0
18 | size: 20
19 |
20 | # The second object also has a single tag, but translated and rotated. The
21 | # origin of 'myobject2' is will be 10 units *below* the tag, on the object's X
22 | # axis, and the tag is rotated by 90 degrees along the object's Z axis.
23 | # Rotations must be specified in degrees as XYZ Euler rotations, ie a rotation
24 | # on the X axis followed by a rotation on the Y axis, followed by a rotation on
25 | # the Z axis.
26 | myobject2:
27 | - tag: 1
28 | size: 30
29 | translation: [10., 0., 0.]
30 | rotation: [0., 0., 90.]
31 |
32 | # The third object features 3 tags, of various size, and at various positions.
33 | # Here, the rotation is omitted (defaults to [0.,0.,0.]).
34 | # If a tag sets the option 'keep' to '1', the tag 3D position is
35 | # returned besides the object. By default, object components are not kept, but
36 | # you can explicitely set keep to '0'.
37 | myobject3:
38 | - tag: 2
39 | size: 20
40 | translation: [-50., -100., 0.0]
41 | keep: 1
42 | - tag: 3
43 | size: 30
44 | translation: [50., -100., 0.0]
45 | keep: 0
46 | - tag: 4
47 | size: 30
48 | translation: [50., 100., 0.0]
49 |
50 |
--------------------------------------------------------------------------------
/tools/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Copyright 2013-2014 EPFL #
3 | # Copyright 2013-2014 Quentin Bonnard #
4 | # #
5 | # This file is part of chilitags. #
6 | # #
7 | # Chilitags is free software: you can redistribute it and/or modify #
8 | # it under the terms of the Lesser GNU General Public License as #
9 | # published by the Free Software Foundation, either version 3 of the #
10 | # License, or (at your option) any later version. #
11 | # #
12 | # Chilitags is distributed in the hope that it will be useful, #
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 | # GNU Lesser General Public License for more details. #
16 | # #
17 | # You should have received a copy of the GNU Lesser General Public License #
18 | # along with Chilitags. If not, see . #
19 | ################################################################################
20 |
21 | if(NOT OPENCV_HIGHGUI_FOUND)
22 | message(FATAL_ERROR "OpenCV compiled without support for highgui! Can not compile detector.")
23 | endif()
24 |
25 | add_executable(chilitags-creator creator/creator.cpp)
26 | target_link_libraries( chilitags-creator ${OpenCV_LIBS} )
27 | target_link_libraries( chilitags-creator chilitags )
28 | install(TARGETS chilitags-creator RUNTIME DESTINATION bin)
29 |
--------------------------------------------------------------------------------
/src/Refine.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef Refine_HPP
22 | #define Refine_HPP
23 |
24 | #include
25 |
26 | #include
27 |
28 | #include
29 |
30 | namespace chilitags {
31 |
32 | class Refine
33 | {
34 | public:
35 |
36 | Refine();
37 |
38 | Quad operator()(
39 | const cv::Mat &inputImage,
40 | const Quad &quad,
41 | const float proximityRatio);
42 |
43 | };
44 |
45 |
46 | }
47 |
48 | #endif
49 |
--------------------------------------------------------------------------------
/src/EnsureGreyscale.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef EnsureGreyscale_HPP
22 | #define EnsureGreyscale_HPP
23 |
24 | #include
25 |
26 | #include
27 |
28 | namespace chilitags {
29 |
30 | class EnsureGreyscale
31 | {
32 | public:
33 |
34 | EnsureGreyscale();
35 |
36 | const cv::Mat & operator()(const cv::Mat & inputImage);
37 |
38 | protected:
39 |
40 | cv::Mat mOutputImage;
41 |
42 | };
43 |
44 |
45 | }
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/src/ScreenOut.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef SCREENOUT_HPP
22 | #define SCREENOUT_HPP
23 |
24 | /**
25 | * @file ScreenOut.hpp
26 | * @brief Contains fast and simple methods to screen out things that are obviously not tags
27 | * @author Ayberk Özgür
28 | */
29 |
30 | #include
31 |
32 | namespace chilitags {
33 |
34 | class ScreenOut
35 | {
36 | public:
37 |
38 | static bool isConvex(Quad const& quad);
39 | };
40 |
41 | } /* namespace chilitags */
42 |
43 | #endif /* SCREENOUT_HPP */
44 |
--------------------------------------------------------------------------------
/src/FindQuads.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef FindQuads_H
22 | #define FindQuads_H
23 |
24 | #include
25 | #include
26 |
27 | #include
28 |
29 | namespace chilitags {
30 |
31 | class FindQuads
32 | {
33 | public:
34 | FindQuads();
35 |
36 | std::vector operator()(const cv::Mat &greyscaleImage);
37 |
38 | void setMinInputWidth(int minWidth) {mMinInputWidth = minWidth;}
39 |
40 | protected:
41 |
42 | std::vector mGrayPyramid;
43 | std::vector mBinaryPyramid;
44 | int mMinInputWidth;
45 |
46 | };
47 |
48 | }
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/src/ch/epfl/chili/chilitags/samples/estimate3d_gui/Estimate3DGUIActivity.java:
--------------------------------------------------------------------------------
1 | package ch.epfl.chili.chilitags.samples.estimate3d_gui;
2 |
3 | import ch.epfl.chili.chilitags.Chilitags3D;
4 | import android.os.Bundle;
5 | import android.app.Activity;
6 |
7 | public class Estimate3DGUIActivity extends Activity {
8 |
9 | private CameraController camController; //The camera controller object that holds the device camera object and
10 | private Chilitags3D chilitags; //The chilitags object
11 |
12 | @Override
13 | protected void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 |
16 | //Create and initialize the camera controller
17 | camController = new CameraController();
18 | camController.onStart();
19 |
20 | //Create the Chilitags object (which also creates its native counterpart)
21 | //The default Android camera color space is YUV_NV21
22 | chilitags = new Chilitags3D(camController.cameraWidth,camController.cameraHeight,
23 | camController.processingWidth,camController.processingHeight,Chilitags3D.InputType.YUV_NV21);
24 |
25 | //A simple camera calibration based on a lot of assumptions
26 | double[] cc = {
27 | 270, 0, camController.processingWidth/2,
28 | 0, 270, camController.processingHeight/2,
29 | 0, 0, 1};
30 | double[] dc = {};
31 | chilitags.setCalibration(cc,dc);
32 |
33 | //Create the surface that we will draw on using GLES 2.0
34 | setContentView(new CameraPreviewGLSurfaceView(this,camController,chilitags,cc,
35 | (double)camController.cameraWidth/camController.processingWidth,
36 | (double)camController.cameraHeight/camController.processingHeight));
37 | }
38 |
39 | @Override
40 | protected void onStart(){
41 | super.onStart();
42 | camController.onStart();
43 | }
44 |
45 | @Override
46 | protected void onResume(){
47 | super.onResume();
48 | camController.onResume();
49 | }
50 |
51 | @Override
52 | protected void onPause(){
53 | super.onPause();
54 | camController.onPause();
55 | }
56 |
57 | @Override
58 | protected void onStop(){
59 | super.onStop();
60 | camController.onStop();
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/ReadBits.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef ReadBits_HPP
22 | #define ReadBits_HPP
23 |
24 | #include
25 | #include
26 |
27 | #include
28 |
29 | namespace chilitags {
30 |
31 | class ReadBits
32 | {
33 | public:
34 | ReadBits();
35 |
36 | const std::vector &operator()(const cv::Mat &inputImage, const Quad &corners);
37 |
38 | protected:
39 |
40 | std::vector mSamplePoints;
41 | std::vector mTransformedSamplePoints;
42 | cv::Mat mSamples;
43 |
44 | std::vector mBits;
45 |
46 | };
47 |
48 |
49 | }
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/src/EnsureGreyscale.cpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #include "EnsureGreyscale.hpp"
22 | #include
23 |
24 | namespace chilitags{
25 |
26 | EnsureGreyscale::EnsureGreyscale() : mOutputImage(){
27 | }
28 |
29 | const cv::Mat &EnsureGreyscale::operator()(const cv::Mat &inputImage)
30 | {
31 | if (inputImage.channels() != 1) {
32 | // assuming BGR
33 | cv::cvtColor(inputImage, mOutputImage, cv::COLOR_BGR2GRAY);
34 | } else {
35 | // Shallow copy
36 | mOutputImage = inputImage;
37 | }
38 | return mOutputImage;
39 | }
40 |
41 | } /* namespace chilitags */
42 |
--------------------------------------------------------------------------------
/platforms/jni/src/ch/epfl/chili/chilitags/ObjectTransform.java:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2014 EPFL *
3 | * *
4 | * This file is part of chilitags. *
5 | * *
6 | * Chilitags is free software: you can redistribute it and/or modify *
7 | * it under the terms of the Lesser GNU General Public License as *
8 | * published by the Free Software Foundation, either version 3 of the *
9 | * License, or (at your option) any later version. *
10 | * *
11 | * Chilitags is distributed in the hope that it will be useful, *
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 | * GNU Lesser General Public License for more details. *
15 | * *
16 | * You should have received a copy of the GNU Lesser General Public License *
17 | * along with Chilitags. If not, see . *
18 | *******************************************************************************/
19 |
20 | package ch.epfl.chili.chilitags;
21 |
22 | /**
23 | * Simple wrapper for the Chilitags3D object transform.
24 | *
25 | * @author Ayberk Özgür
26 | *
27 | */
28 | public class ObjectTransform{
29 | /**
30 | * The name of this object.
31 | */
32 | public String name;
33 |
34 | /**
35 | * The transform 4x4 matrix, relative to the camera frame.
36 | */
37 | public double[][] transform;
38 |
39 | /**
40 | * Creates a new ObjectTransform with empty name and identity transform.
41 | */
42 | public ObjectTransform(){
43 | name = "";
44 | transform = new double[4][4];
45 | for(int i=0;i<4;i++)
46 | for(int j=0;j<4;j++)
47 | transform[i][j] = i == j ? 1 : 0;
48 | }
49 | }
--------------------------------------------------------------------------------
/platforms/jni/samples/android-estimate3d-gui/src/ch/epfl/chili/chilitags/samples/estimate3d_gui/shader/YUV2RGBShader.java:
--------------------------------------------------------------------------------
1 | package ch.epfl.chili.chilitags.samples.estimate3d_gui.shader;
2 |
3 | /**
4 | * YUV to RGB conversion shader.
5 | * @author Ayberk Özgür
6 | */
7 | public class YUV2RGBShader extends Shader {
8 |
9 | @Override
10 | protected String getVertexShader() {
11 | return "attribute vec4 a_position; \n" +
12 | "attribute vec2 a_texCoord; \n" +
13 | "varying vec2 v_texCoord; \n" +
14 |
15 | "void main(){ \n" +
16 | " gl_Position = a_position; \n" +
17 | " v_texCoord = a_texCoord; \n" +
18 | "} \n";
19 | }
20 |
21 | @Override
22 | protected String getFragmentShader() {
23 | return "#ifdef GL_ES \n" +
24 | "precision highp float; \n" +
25 | "#endif \n" +
26 |
27 | "varying vec2 v_texCoord; \n" +
28 | "uniform sampler2D y_texture; \n" +
29 | "uniform sampler2D uv_texture; \n" +
30 |
31 | "void main (void){ \n" +
32 | " float r, g, b, y, u, v; \n" +
33 |
34 | //We had put the Y values of each pixel to the R,G,B components by GL_LUMINANCE,
35 | //that's why we're pulling it from the R component, we could also use G or B
36 | " y = texture2D(y_texture, v_texCoord).r; \n" +
37 |
38 | //We had put the U and V values of each pixel to the A and R,G,B components of the
39 | //texture respectively using GL_LUMINANCE_ALPHA. Since U,V bytes are interspread
40 | //in the texture, this is probably the fastest way to use them in the shader
41 | " u = texture2D(uv_texture, v_texCoord).a - 0.5; \n" +
42 | " v = texture2D(uv_texture, v_texCoord).r - 0.5; \n" +
43 |
44 | //The numbers are just YUV to RGB conversion constants
45 | " r = y + 1.13983*v; \n" +
46 | " g = y - 0.39465*u - 0.58060*v; \n" +
47 | " b = y + 2.03211*u; \n" +
48 |
49 | //We finally set the RGB color of our pixel
50 | " gl_FragColor = vec4(r, g, b, 1.0); \n" +
51 | "} \n";
52 | }
53 |
54 | @Override
55 | protected void loadUniforms() { /*No auto uniforms*/ }
56 |
57 | @Override
58 | protected void getUniformHandles() { /*No auto uniforms*/ }
59 | }
60 |
--------------------------------------------------------------------------------
/samples/detection/detect-from-file.cpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #include
22 |
23 | #include // imread
24 |
25 | #include
26 | using std::cout;
27 |
28 |
29 | int main(int argc, char* argv[])
30 | {
31 | if (argc != 2) {
32 | cout
33 | << "Usage: chilitags-detect \n\n"
34 | << "Returns the list of detected tag id's in the image, one per line.\n";
35 | return 1;
36 | }
37 |
38 | cv::Mat image = cv::imread(argv[1]);
39 | if(image.data) {
40 | for (const auto &tag : chilitags::Chilitags().find(image))
41 | cout << tag.first << "\n";
42 |
43 | return 0;
44 | }
45 | return 1;
46 | }
47 |
--------------------------------------------------------------------------------
/src/Track.hpp:
--------------------------------------------------------------------------------
1 | /*******************************************************************************
2 | * Copyright 2013-2014 EPFL *
3 | * Copyright 2013-2014 Quentin Bonnard *
4 | * *
5 | * This file is part of chilitags. *
6 | * *
7 | * Chilitags is free software: you can redistribute it and/or modify *
8 | * it under the terms of the Lesser GNU General Public License as *
9 | * published by the Free Software Foundation, either version 3 of the *
10 | * License, or (at your option) any later version. *
11 | * *
12 | * Chilitags is distributed in the hope that it will be useful, *
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 | * GNU Lesser General Public License for more details. *
16 | * *
17 | * You should have received a copy of the GNU Lesser General Public License *
18 | * along with Chilitags. If not, see . *
19 | *******************************************************************************/
20 |
21 | #ifndef Track_HPP
22 | #define Track_HPP
23 |
24 | #include