diff --git a/README.md b/README.md
index 6f54b2e..0d7f7b9 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,7 @@ Software package and ROS wrappers of the [Aruco][1] Augmented Reality marker det
+
### ROS API
#### Messages
@@ -39,6 +40,15 @@ Software package and ROS wrappers of the [Aruco][1] Augmented Reality marker det
Header header
aruco_ros/Marker[] markers
+### Kinetic changes
+
+* Updated the [Aruco][1] library to version 3.0.4
+
+* Changed the coordinate system to match the library's, the convention is shown
+ in the image below, following rviz conventions, X is red, Y is green and Z is
+ blue.
+
+
### Test it with REEM
* Open a REEM in simulation with a marker floating in front of the robot. This will start the stereo cameras of the robot too. Since this is only a vision test, there is nothing else in this world apart from the robot and a marker floating in front of it. An extra light source had to be added to compensate for the default darkness.
diff --git a/aruco/CHANGELOG.rst b/aruco/CHANGELOG.rst
index ccc96a2..1112465 100644
--- a/aruco/CHANGELOG.rst
+++ b/aruco/CHANGELOG.rst
@@ -2,6 +2,39 @@
Changelog for package aruco
^^^^^^^^^^^^^^^^^^^^^^^^^^^
+1.0.0 (2019-09-27)
+------------------
+* Fix shadowed variables
+* Add SYSTEN to include dirs
+* Merge pull request `#68 `_ from aPonza/ros_format
+ Autoformatting as per CppStyleGuide
+* removed using namespace declarations
+* autoformatting as per CppStyleGuide
+* Migration to aruco 3.0.4
+* Merge branch 'indigo-devel' into kinetic-devel
+* Completely remove debug print
+* Merge pull request `#37 `_ from pal-robotics/remove-debug-print
+ Remove debug log msg
+* Remove debug log msg
+* Merge pull request `#29 `_ from cehberlin/kinetic-devel
+ forcing opencv3 build for kinetic
+* forcing opencv3 build for kinetic
+* Contributors: Andrea Ponza, Bence Magyar, Christopher Hrabia, Jordi Pages, Victor Lopez
+
+2.1.0 (2020-01-21)
+------------------
+* Add param to correct fisheye distortion with special CV functions
+* Add support for camera extrinsics when dealing with stereo cameras
+* Contributors: Victor Lopez
+
+2.0.2 (2019-11-09)
+------------------
+
+2.0.1 (2019-09-27)
+------------------
+* Fix dependency
+* Contributors: Victor Lopez
+
0.2.2 (2017-07-25)
------------------
diff --git a/aruco/CMakeLists.txt b/aruco/CMakeLists.txt
index 925b0b6..06e4fe3 100644
--- a/aruco/CMakeLists.txt
+++ b/aruco/CMakeLists.txt
@@ -2,41 +2,49 @@ cmake_minimum_required(VERSION 2.8.3)
project(aruco)
find_package(catkin)
-
+find_package(Eigen3 REQUIRED)
find_package(OpenCV 3 REQUIRED)
+set(CMAKE_CXX_STANDARD 11) # C++11...
+set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
+set(CMAKE_CXX_EXTENSIONS ON) #...with compiler extensions like gnu++11
catkin_package(
INCLUDE_DIRS include
LIBRARIES aruco
)
+include_directories(
+ include/aruco/)
include_directories(
- include
+ SYSTEM
${catkin_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
+ ${EIGEN3_INCLUDE_DIRS}
)
add_library(aruco
- src/aruco/arucofidmarkers.cpp
src/aruco/cvdrawingutils.cpp
src/aruco/cameraparameters.cpp
- src/aruco/board.cpp
+ src/aruco/debug.cpp
+ src/aruco/dictionary.cpp
+ src/aruco/ippe.cpp
src/aruco/marker.cpp
- src/aruco/boarddetector.cpp
src/aruco/markerdetector.cpp
+ src/aruco/markerlabeler.cpp
+ src/aruco/markermap.cpp
+ src/aruco/posetracker.cpp
+ src/aruco/markerlabelers/dictionary_based.cpp
+ src/aruco/markerlabelers/svmmarkers.cpp
)
target_link_libraries(aruco
${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
-add_executable(optimalmarkers
- src/aruco/aruco_selectoptimalmarkers.cpp)
-target_link_libraries(optimalmarkers aruco ${catkin_LIBRARIES})
#############
## Install ##
#############
-install(TARGETS aruco optimalmarkers
+install(TARGETS aruco
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
diff --git a/aruco/include/aruco/aruco.h b/aruco/include/aruco/aruco.h
index a7667e0..bd6293a 100644
--- a/aruco/include/aruco/aruco.h
+++ b/aruco/include/aruco/aruco.h
@@ -1,134 +1,35 @@
/**
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-
-
-
- \mainpage ArUco: Augmented Reality library from the University of Cordoba
-
-
-ArUco is a minimal C++ library for detection of Augmented Reality markers based on OpenCv exclusively.
-
-It is an educational project to show student how to detect augmented reality markers and it is provided under BSD license.
-
-
-\section INTRODUCTION INTRODUCTION
-
-The library relies on the use of coded markers. Each marker has an unique code indicated by the black and white colors in it. The libary detect borders, and analyzes into the rectangular regions which of them are likely to be markers. Then, a decoding is performed and if the code is valid, it is considered that the rectangle is a marker.
-
-The codification included into the marker is a slighly modified version of the Hamming Code. It has a total a 25 bits didived in 5 rows of 5 bits each. So, we have 5 words of 5 bits. Each word, contains only 2 bits of real information, the rest is for and error detection/correction (error correction is yet to be done). As a conclusion, a marker contains 10 bits of real information wich allows 1024 different markers.
-
-
-\section BOARDS BOARDS
-
-Aruco allows the possibility to employ board. Boards are markers composed by an array of markers arranged in a known order. The advantages of using boards instead of simple markers are:
- - More robusteness. The misdetection of several markers of the board is not a problem as long as a minimum set of them are detected.
- - More precision. Since there are a larger number of corners, camera pose estimation becomes more precise.
-
-
-\section APPLICATIONS APPLICATIONS
-
-The library comes with five applications that will help you to learn how to use the library:
- - aruco_create_marker: which creates marker and saves it in a jpg file you can print.
- - aruco_simple : simple test aplication that detects the markers in a image
- - aruco_test: this is the main application for detection. It reads images either from the camera of from a video and detect markers. Additionally, if you provide the intrinsics of the camera(obtained by OpenCv calibration) and the size of the marker in meters, the library calculates the marker intrinsics so that you can easily create your AR applications.
- - aruco_test_gl: shows how to use the library AR applications using OpenGL for rendering
- - aruco_create_board: application that helps you to create a board
- - aruco_simple_board: simple test aplication that detects a board of markers in a image
- - aruco_test_board: application that detects boards
- - aruco_test_board_gl: application that detects boards and uses OpenGL to draw
-
-\section LIBRARY LIBRARY DESCRIPTION:
-
-The ArUco library contents are divided in two main directories. The src directory, which contains the library itself. And the utils directory which contains the applications.
-
-The library main classes are:
- - aruco::CameraParameters: represent the information of the camera that captures the images. Here you must set the calibration info.
- - aruco::Marker: which represent a marker detected in the image
- - aruco::MarkerDetector: that is in charge of deteting the markers in a image Detection is done by simple calling the member funcion ArMarkerDetector::detect(). Additionally, the classes contain members to create the required matrices for rendering using OpenGL. See aruco_test_gl for details
- - aruco::BoardConfiguration: A board is an array of markers in a known order. BoardConfiguracion is the class that defines a board by indicating the id of its markers. In addition, it has informacion about the distance between the markers so that extrinsica camera computations can be done.
- - aruco::Board: This class defines a board detected in a image. The board has the extrinsic camera parameters as public atributes. In addition, it has a method that allows obtain the matrix for getting its position in OpenGL (see aruco_test_board_gl for details).
- - aruco::BoardDetector : This is the class in charge of detecting a board in a image. You must pass to it the set of markers detected by ArMarkerDetector and the BoardConfiguracion of the board you want to detect. This class will do the rest for you, even calculating the camera extrinsics.
-
-
-\section COMPILING COMPILING THE LIBRARY:
-\subsection Linux
-Go to the aruco library and do
-\verbatim
->mkdir build
->cd build
->cmake ..
->make
->make install (optional)
-\endverbatim
-
-NOTE ON OPENGL: The library supports eaily the integration with OpenGL. In order to compile with support for OpenGL, you just have installed in your system the develop packages for GL and glut (or freeglut).
-
-\subsection WINDOWS
-
-The library has been compiled using MinGW and codeblocks. Below I describe the best way to compile it that I know. If you know better, please let me know.
- - step 1) codeblocks
- -# Download codeblocks. I recommend to download the version 10.5 with mingw included (codeblocks-10.05mingw-setup.exe)
- -# Install and set the PATH variable so that the codeblock/mingw/bin directory is included. In my case c:/codeblocks/mingw/bin. This will allow cmake to find the compiler.
- -# The codeblock program will not find the mingw path by deafult. So, run codeblocks and go to setting->Compuiler debugger and set the correct path to the MinGW dir.
- - step 2) cmake
- -# Download and install the last version of cmake.
- - step 3) OpenCv
- -# Download the source code and compile it using cmake and codeblocks. Note: install the library in C:\ if you want it to be easily detected by cmake afterwards
- - step 4) aruco
- -# Download and decompress.
- -# Open cmake gui application and set the path to the main library directory and also set a path where the project is going to be built.
- -# Generate the codeblock project.
- -# Open the project with codeblock and compile then, install. The programs will be probably generated into the bin directory
-
-OpenGL: by default, the mingw version installed has not the glut library. So, the opengl programs are not compiled. If you want to compile with OpenGL support, you must install glut, or prefereably freeglut.
-Thus,
- - Download the library (http://www.martinpayne.me.uk/software/development/GLUT/freeglut-MinGW.zip) for mingw.
- - Decompress in a directory X.
- - Then, rerun cmake setting the variable GLU_PATH to that directory (>cmake .. -DGLUT_PATH="C:\X")
- - Finally, recompile and test. Indeed, you should move the freeglut.dll to the directory with the binaries or to any other place in the PATH.
-
-
-CONCLUSION: Move to Linux, things are simpler :P
-
-
-\section Testing
-
-For testing the applications, the library provides videos and the corresponding camera parameters of these videos. Into the directories you will find information on how to run the examples.
-
-\section Final Notes
-
- - REQUIREMENTS: OpenCv >= 2.1.0. and OpenGL for (aruco_test_gl and aruco_test_board_gl)
- - CONTACT: Rafael Munoz-Salinas: rmsalinas@uco.es
- - This libary is free software and come with no guaratee!
-
-*/
-
-#include
-#include
-#include
-
+ Copyright 2017 Rafael Muñoz Salinas. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The views and conclusions contained in the software and documentation are those of the
+ authors and should not be interpreted as representing official policies, either expressed
+ or implied, of Rafael Muñoz Salinas.
+ */
+
+#include "markerdetector.h"
+#include "posetracker.h"
+#include "cvdrawingutils.h"
+#include "dictionary.h"
+#define ARUCO_VERSION_MAJOR 3
+#define ARUCO_VERSION_MINOR 0
diff --git a/aruco/include/aruco/aruco_export.h b/aruco/include/aruco/aruco_export.h
new file mode 100644
index 0000000..2f0ad06
--- /dev/null
+++ b/aruco/include/aruco/aruco_export.h
@@ -0,0 +1,42 @@
+/**
+ Copyright 2017 Rafael Muñoz Salinas. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The views and conclusions contained in the software and documentation are those of the
+ authors and should not be interpreted as representing official policies, either expressed
+ or implied, of Rafael Muñoz Salinas.
+ */
+
+#ifndef __OPENARUCO_CORE_TYPES_H__
+#define __OPENARUCO_CORE_TYPES_H__
+
+#if !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300
+#define _CRT_SECURE_NO_DEPRECATE /* to avoid multiple Visual Studio 2005 warnings */
+#endif /* !defined _CRT_SECURE_NO_DEPRECATE && _MSC_VER > 1300 */
+
+#if (defined WIN32 || defined _WIN32 || defined WINCE) && defined ARUCO_DSO_EXPORTS
+#define ARUCO_EXPORT __declspec(dllexport)
+#else
+#define ARUCO_EXPORT
+#endif /* (defined WIN32 || defined _WIN32 || defined WINCE) && defined ARUCO_DSO_EXPORTS */
+
+#endif /* __OPENARUCO_CORE_TYPES_H__ */
diff --git a/aruco/include/aruco/arucofidmarkers.h b/aruco/include/aruco/arucofidmarkers.h
deleted file mode 100644
index 9baf175..0000000
--- a/aruco/include/aruco/arucofidmarkers.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*****************************
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-********************************/
-
-#ifndef ArucoFiducicalMarkerDetector_H
-#define ArucoFiducicalMarkerDetector_H
-#include
-#include
-#include
-#include
-namespace aruco {
-
-class ARUCO_EXPORTS FiducidalMarkers {
-public:
- /**
- * \brief Creates an ar marker with the id specified using a modified version of the hamming code.
- * There are two type of markers: a) These of 10 bits b) these of 3 bits. The latter are employed for applications
- * that need few marker but they must be small. The two type of markers are distinguished by their ids. While the first type
- * of markers have ids in the interval [0-1023], the second type ids in the interval [2000-2006].
- *
- *
- * 10 bits markers
- * -----------------------
- * There are a total of 5 rows of 5 cols. Each row encodes a total of 2 bits, so there are 2^10 bits:(0-1023).
- *
- * The least significative bytes are first (from left-up to to right-bottom)
- *
- * Example: the id = 110 (decimal) is be represented in binary as : 00 01 10 11 10.
- *
- * Then, it will generate the following marker:
- *
- * -# 1st row encodes 00: 1 0 0 0 0 : hex 0x10
- * -# 2nd row encodes 01: 1 0 1 1 1 : hex 0x17
- * -# 3nd row encodes 10: 0 1 0 0 1 : hex 0x09
- * -# 4th row encodes 11: 0 1 1 1 0 : hex 0x0e
- * -# 5th row encodes 10: 0 1 0 0 1 : hex 0x09
- *
- * Note that : The first bit, is the inverse of the hamming parity. This avoids the 0 0 0 0 0 to be valid
- * These marker are detected by the function getFiduciadlMarker_Aruco_Type1
- */
- static cv::Mat createMarkerImage(int id,int size) throw (cv::Exception);
-
- /** Detection of fiducidal aruco markers (10 bits)
- * @param in input image with the patch that contains the possible marker
- * @param nRotations number of 90deg rotations in clockwise direction needed to set the marker in correct position
- * @return -1 if the image passed is a not a valid marker, and its id in case it really is a marker
- */
- static int detect(const cv::Mat &in,int &nRotations);
-
- /**Similar to createMarkerImage. Instead of returning a visible image, returns a 8UC1 matrix of 0s and 1s with the marker info
- */
- static cv::Mat getMarkerMat(int id) throw (cv::Exception);
-
-
- /**Creates a printable image of a board
- * @param gridSize grid layout (numer of sqaures in x and Y)
- * @param MarkerSize size of markers sides in pixels
- * @param MarkerDistance distance between the markers
- * @param TInfo output
- * @param excludedIds set of ids excluded from the board
- */
- static cv::Mat createBoardImage( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,vector *excludedIds=NULL ) throw (cv::Exception);
-
-
- /**Creates a printable image of a board in chessboard_like manner
- * @param gridSize grid layout (numer of sqaures in x and Y)
- * @param MarkerSize size of markers sides in pixels
- * @param TInfo output
- * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner
- *
- */
- static cv::Mat createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector *excludedIds=NULL) throw (cv::Exception);
-
- /**Creates a printable image of a board in a frame fashion
- * @param gridSize grid layout (numer of sqaures in x and Y)
- * @param MarkerSize size of markers sides in pixels
- * @param MarkerDistance distance between the markers
- * @param TInfo output
- * @param setDataCentered indicates if the center is set at the center of the board. Otherwise it is the left-upper corner
- *
- */
- static cv::Mat createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance, BoardConfiguration& TInfo ,bool setDataCentered=true,vector *excludedIds=NULL ) throw (cv::Exception);
-
-private:
-
- static vector getListOfValidMarkersIds_random(int nMarkers,vector *excluded) throw (cv::Exception);
- static cv::Mat rotate(const cv::Mat & in);
- static int hammDistMarker(cv::Mat bits);
- static int analyzeMarkerImage(cv::Mat &grey,int &nRotations);
-};
-
-}
-
-#endif
diff --git a/aruco/include/aruco/board.h b/aruco/include/aruco/board.h
deleted file mode 100644
index 1bf9bdc..0000000
--- a/aruco/include/aruco/board.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/*****************************
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-********************************/
-#ifndef _Aruco_board_h
-#define _Aruco_board_h
-#include
-#include
-#include
-#include
-#include
-using namespace std;
-namespace aruco {
-/**
- * 3d representation of a marker
- */
-struct ARUCO_EXPORTS MarkerInfo:public vector {
- MarkerInfo() : id(-1) {}
- MarkerInfo(int _id) : id(_id) {}
- MarkerInfo(const MarkerInfo&MI): vector(MI){id=MI.id; }
- MarkerInfo & operator=(const MarkerInfo&MI){
- vector ::operator=(MI);
- id=MI.id;
- return *this;
- }
- int id;//maker id
-};
-
-/**\brief This class defines a board with several markers.
- * A Board contains several markers so that they are more robustly detected.
- *
- * In general, a board is a set of markers. So BoardConfiguration is only a list
- * of the id of the markers along with the position of their corners.
- *
- * The position of the corners can be specified either in pixels (in a non-specific size) or in meters.
- * The first is the typical case in which you generate the image of board and the print it. Since you do not know in advance the real
- * size of the markers, their corners are specified in pixels, and then, the translation to meters can be made once you know the real size.
- *
- * On the other hand, you may want to have the information of your boards in meters. The BoardConfiguration allows you to do so.
- *
- * The point is in the mInfoType variable. It can be either PIX or METERS according to your needs.
- *
-*/
-
-
-class ARUCO_EXPORTS BoardConfiguration: public vector
-{
- friend class Board;
-public:
- enum MarkerInfoType {NONE=-1,PIX=0,METERS=1};//indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
- //variable indicates if the data in MakersInfo is expressed in meters or in pixels so as to do conversion internally
- int mInfoType;
- /**
- */
- BoardConfiguration();
-
- /**
- */
- BoardConfiguration(const BoardConfiguration &T);
-
- /**
- */
- BoardConfiguration & operator=(const BoardConfiguration &T);
- /**Saves the board info to a file
- */
- void saveToFile(string sfile)throw (cv::Exception);
- /**Reads board info from a file
- */
- void readFromFile(string sfile)throw (cv::Exception);
- /**Indicates if the corners are expressed in meters
- */
- bool isExpressedInMeters()const {
- return mInfoType==METERS;
- }
- /**Indicates if the corners are expressed in meters
- */
- bool isExpressedInPixels()const {
- return mInfoType==PIX;
- }
- /**Returns the index of the marker with id indicated, if is in the list
- */
- int getIndexOfMarkerId(int id)const;
- /**Returns the Info of the marker with id specified. If not in the set, throws exception
- */
- const MarkerInfo& getMarkerInfo(int id)const throw (cv::Exception);
- /**Set in the list passed the set of the ids
- */
- void getIdList(vector &ids,bool append=true)const;
-private:
- /**Saves the board info to a file
- */
- void saveToFile(cv::FileStorage &fs)throw (cv::Exception);
- /**Reads board info from a file
- */
- void readFromFile(cv::FileStorage &fs)throw (cv::Exception);
-};
-
-/**
-*/
-class ARUCO_EXPORTS Board:public vector
-{
-
-public:
- BoardConfiguration conf;
- //matrices of rotation and translation respect to the camera
- cv::Mat Rvec,Tvec;
- /**
- */
- Board()
- {
- Rvec.create(3,1,CV_32FC1);
- Tvec.create(3,1,CV_32FC1);
- for (int i=0;i<3;i++)
- Tvec.at(i,0)=Rvec.at(i,0)=-999999;
- }
-
- /**Given the extrinsic camera parameters returns the GL_MODELVIEW matrix for opengl.
- * Setting this matrix, the reference corrdinate system will be set in this board
- */
- void glGetModelViewMatrix(double modelview_matrix[16])throw(cv::Exception);
-
- /**
- * Returns position vector and orientation quaternion for an Ogre scene node or entity.
- * Use:
- * ...
- * Ogre::Vector3 ogrePos (position[0], position[1], position[2]);
- * Ogre::Quaternion ogreOrient (orientation[0], orientation[1], orientation[2], orientation[3]);
- * mySceneNode->setPosition( ogrePos );
- * mySceneNode->setOrientation( ogreOrient );
- * ...
- */
- void OgreGetPoseParameters( double position[3], double orientation[4] )throw(cv::Exception);
-
-
- /**Save this from a file
- */
- void saveToFile(string filePath)throw(cv::Exception);
- /**Read this from a file
- */
- void readFromFile(string filePath)throw(cv::Exception);
-
-};
-}
-
-#endif
diff --git a/aruco/include/aruco/boarddetector.h b/aruco/include/aruco/boarddetector.h
deleted file mode 100644
index 5deab4e..0000000
--- a/aruco/include/aruco/boarddetector.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*****************************
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-********************************/
-#ifndef _Aruco_BoardDetector_H
-#define _Aruco_BoardDetector_H
-#include
-#include
-#include
-#include
-#include
-using namespace std;
-
-namespace aruco
-{
-
-/**\brief This class detects AR boards
- * Version 1.2
- * There are two modes for board detection.
- * First, the old way. (You first detect markers with MarkerDetector and then call to detect in this class.
- *
- * Second: New mode, marker detection is included in the class
- * \code
-
- CameraParameters CP;
- CP.readFromFile(path_cp)
- BoardConfiguration BC;
- BC.readFromFile(path_bc);
- BoardDetector BD;
- BD.setParams(BC,CP); //or only BD.setParams(BC)
- //capture image
- cv::Mat im;
- capture_image(im);
-
- float prob=BD.detect(im);
- if (prob>0.3)
- CvDrawingUtils::draw3DAxis(im,BD.getDetectedBoard(),CP);
-
- \endcode
- *
-*/
-class ARUCO_EXPORTS BoardDetector
-{
-public:
- /** See discussion in @see enableRotateXAxis.
- * Do not change unless you know what you are doing
- */
- BoardDetector(bool setYPerpendicular=true);
-
-
- /**
- * Use if you plan to let this class to perform marker detection too
- */
- void setParams(const BoardConfiguration &bc,const CameraParameters &cp, float markerSizeMeters=-1);
- void setParams(const BoardConfiguration &bc);
- /**
- * Detect markers, and then, look for the board indicated in setParams()
- * @return value indicating the likelihood of having found the marker
- */
- float detect(const cv::Mat &im)throw (cv::Exception);
- /**Returns a reference to the board detected
- */
- Board & getDetectedBoard(){return _boardDetected;}
- /**Returns a reference to the internal marker detector
- */
- MarkerDetector &getMarkerDetector(){return _mdetector;}
- /**Returns the vector of markers detected
- */
- vector &getDetectedMarkers(){return _vmarkers;}
-
-
- //ALTERNATIVE DETECTION METHOD, BASED ON MARKERS PREVIOUSLY DETECTED
-
- /** Given the markers detected, determines if there is the board passed
- * @param detectedMarkers result provided by aruco::ArMarkerDetector
- * @param BConf the board you want to see if is present
- * @param Bdetected output information of the detected board
- * @param camMatrix camera matrix with intrinsics
- * @param distCoeff camera distorsion coeff
- * @param camMatrix intrinsic camera information.
- * @param distCoeff camera distorsion coefficient. If set Mat() if is assumed no camera distorion
- * @param markerSizeMeters size of the marker sides expressed in meters
- * @return value indicating the likelihood of having found the marker
- */
- float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected, cv::Mat camMatrix=cv::Mat(),cv::Mat distCoeff=cv::Mat(), float markerSizeMeters=-1 )throw (cv::Exception);
- float detect(const vector &detectedMarkers,const BoardConfiguration &BConf, Board &Bdetected,const CameraParameters &cp, float markerSizeMeters=-1 )throw (cv::Exception);
-
-
- /**
- * By default, the Y axis is set to point up. However this is not the default
- * operation mode of opencv, which produces the Z axis pointing up instead.
- * So, to achieve this change, we have to rotate the X axis.
- */
- void setYPerpendicular(bool enable){_setYPerpendicular=enable;}
-
-
-
-
-private:
- void rotateXAxis(cv::Mat &rotation);
- bool _setYPerpendicular;
-
- //-- Functionality to detect markers inside
- bool _areParamsSet;
- BoardConfiguration _bconf;
- Board _boardDetected;
- float _markerSize;
- CameraParameters _camParams;
- MarkerDetector _mdetector;//internal markerdetector
- vector _vmarkers;//markers detected in the call to : float detect(const cv::Mat &im);
-
-};
-
-};
-#endif
-
diff --git a/aruco/include/aruco/cameraparameters.h b/aruco/include/aruco/cameraparameters.h
index f4157ea..1023035 100644
--- a/aruco/include/aruco/cameraparameters.h
+++ b/aruco/include/aruco/cameraparameters.h
@@ -1,137 +1,170 @@
-/*****************************
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-********************************/
+/**
+ Copyright 2017 Rafael Muñoz Salinas. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The views and conclusions contained in the software and documentation are those of the
+ authors and should not be interpreted as representing official policies, either expressed
+ or implied, of Rafael Muñoz Salinas.
+ */
+
#ifndef _Aruco_CameraParameters_H
-#define _Aruco_CameraParameters_H
-#include
-#include
+#define _Aruco_CameraParameters_H
+
+#include "aruco_export.h"
+#include
#include
-using namespace std;
+#include
+
namespace aruco
{
-/**\brief Parameters of the camera
- */
-class ARUCO_EXPORTS CameraParameters
+/**
+ * \brief Parameters of the camera
+ */
+class ARUCO_EXPORT CameraParameters
{
public:
-
- // 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
- cv::Mat CameraMatrix;
- //4x1 matrix (k1,k2,p1,p2)
- cv::Mat Distorsion;
- //size of the image
- cv::Size CamSize;
-
- /**Empty constructor
- */
- CameraParameters() ;
- /**Creates the object from the info passed
- * @param cameraMatrix 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
- * @param distorsionCoeff 4x1 matrix (k1,k2,p1,p2)
- * @param size image size
- */
- CameraParameters(cv::Mat cameraMatrix,cv::Mat distorsionCoeff,cv::Size size) throw(cv::Exception);
- /**Sets the parameters
- * @param cameraMatrix 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
- * @param distorsionCoeff 4x1 matrix (k1,k2,p1,p2)
- * @param size image size
- */
- void setParams(cv::Mat cameraMatrix,cv::Mat distorsionCoeff,cv::Size size) throw(cv::Exception);
- /**Copy constructor
- */
- CameraParameters(const CameraParameters &CI) ;
-
- /**Indicates whether this object is valid
- */
- bool isValid()const {
- return CameraMatrix.rows!=0 && CameraMatrix.cols!=0 && Distorsion.rows!=0 && Distorsion.cols!=0 && CamSize.width!=-1 && CamSize.height!=-1;
- }
- /**Assign operator
- */
- CameraParameters & operator=(const CameraParameters &CI);
- /**Reads the camera parameters from a file generated using saveToFile.
- */
- void readFromFile(string path)throw(cv::Exception);
- /**Saves this to a file
- */
- void saveToFile(string path,bool inXML=true)throw(cv::Exception);
-
- /**Reads from a YAML file generated with the opencv2.2 calibration utility
- */
- void readFromXMLFile(string filePath)throw(cv::Exception);
-
- /**Adjust the parameters to the size of the image indicated
- */
- void resize(cv::Size size)throw(cv::Exception);
-
- /**Returns the location of the camera in the reference system given by the rotation and translation vectors passed
- * NOT TESTED
- */
- static cv::Point3f getCameraLocation(cv::Mat Rvec,cv::Mat Tvec);
-
- /**Given the intrinsic camera parameters returns the GL_PROJECTION matrix for opengl.
- * PLease NOTE that when using OpenGL, it is assumed no camera distorsion! So, if it is not true, you should have
- * undistor image
- *
- * @param orgImgSize size of the original image
- * @param size of the image/window where to render (can be different from the real camera image). Please not that it must be related to CamMatrix
- * @param proj_matrix output projection matrix to give to opengl
- * @param gnear,gfar: visible rendering range
- * @param invert: indicates if the output projection matrix has to yield a horizontally inverted image because image data has not been stored in the order of glDrawPixels: bottom-to-top.
- */
- void glGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception);
-
- /**
- * setup camera for an Ogre project.
- * Use:
- * ...
- * Ogre::Matrix4 PM(proj_matrix[0], proj_matrix[1], ... , proj_matrix[15]);
- * yourCamera->setCustomProjectionMatrix(true, PM);
- * yourCamera->setCustomViewMatrix(true, Ogre::Matrix4::IDENTITY);
- * ...
- * As in OpenGL, it assumes no camera distorsion
- */
- void OgreGetProjectionMatrix( cv::Size orgImgSize, cv::Size size,double proj_matrix[16],double gnear,double gfar,bool invert=false )throw(cv::Exception);
-
+ // 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
+ cv::Mat CameraMatrix;
+
+ // 4x1 matrix (k1,k2,p1,p2)
+ cv::Mat Distorsion;
+
+ // size of the image
+ cv::Size CamSize;
+
+ // 3x1 matrix (Tx, Ty, Tz), usually 0 for non-stereo cameras or stereo left cameras
+ cv::Mat ExtrinsicMatrix;
+
+ /**
+ * Empty constructor
+ */
+ CameraParameters();
+
+ /**
+ * Creates the object from the info passed
+ * @param cameraMatrix 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
+ * @param distorsionCoeff 4x1 matrix (k1,k2,p1,p2)
+ * @param size image size
+ */
+ CameraParameters(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, cv::Size size);
+
+ /**
+ * Sets the parameters
+ * @param cameraMatrix 3x3 matrix (fx 0 cx, 0 fy cy, 0 0 1)
+ * @param distorsionCoeff 4x1 matrix (k1,k2,p1,p2)
+ * @param size image size
+ */
+ void setParams(cv::Mat cameraMatrix, cv::Mat distorsionCoeff, cv::Size size);
+
+ /**
+ * Copy constructor
+ */
+ CameraParameters(const CameraParameters& CI);
+
+ /**
+ * Indicates whether this object is valid
+ */
+ bool isValid() const
+ {
+ return CameraMatrix.rows != 0 && CameraMatrix.cols != 0 && Distorsion.rows != 0 && Distorsion.cols != 0
+ && CamSize.width != -1 && CamSize.height != -1;
+ }
+
+ /**
+ * Assign operator
+ */
+ CameraParameters& operator=(const CameraParameters& CI);
+
+ /**
+ * Saves this to a file
+ */
+ void saveToFile(std::string path, bool inXML = true);
+
+ /**
+ * Reads from a YAML file generated with the OpenCV2.2 calibration utility
+ */
+ void readFromXMLFile(std::string filePath);
+
+ /**
+ * Adjust the parameters to the size of the image indicated
+ */
+ void resize(cv::Size size);
+
+ /**
+ * Returns the location of the camera in the reference system given by the rotation and translation vectors passed
+ * NOT TESTED
+ */
+ static cv::Point3f getCameraLocation(cv::Mat Rvec, cv::Mat Tvec);
+
+ /**
+ * Given the intrinsic camera parameters returns the GL_PROJECTION matrix for OpenGL.
+ * Please NOTE that when using OpenGL, it is assumed no camera distortion! So, if it is not true, you should have
+ * undistorted image
+ *
+ * @param orgImgSize size of the original image
+ * @param size of the image/window where to render (can be different from the real camera image). Please not that
+ * it must be related to CamMatrix
+ * @param proj_matrix output projection matrix to give to OpenGL
+ * @param gnear,gfar: visible rendering range
+ * @param invert: indicates if the output projection matrix has to yield a horizontally inverted image because
+ * image data has not been stored in the order of glDrawPixels: bottom-to-top.
+ */
+ void glGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, double proj_matrix[16], double gnear, double gfar,
+ bool invert = false);
+
+ /**
+ * Setup camera for an Ogre project.
+ * Use:
+ * ...
+ * Ogre::Matrix4 PM(proj_matrix[0], proj_matrix[1], ... , proj_matrix[15]);
+ * yourCamera->setCustomProjectionMatrix(true, PM);
+ * yourCamera->setCustomViewMatrix(true, Ogre::Matrix4::IDENTITY);
+ * ...
+ * As in OpenGL, it assumes no camera distortion
+ */
+ void OgreGetProjectionMatrix(cv::Size orgImgSize, cv::Size size, double proj_matrix[16], double gnear, double gfar,
+ bool invert = false);
+
+ /**
+ * Returns the 4x4 homogeneous transform matrix from the R and T vectors computed
+ */
+ static cv::Mat getRTMatrix(const cv::Mat& R_, const cv::Mat& T_, int forceType);
+
+ ARUCO_EXPORT
+ friend std::ostream &operator<<(std::ostream &str, const CameraParameters&cp);
+
+ ARUCO_EXPORT
+ friend std::istream &operator>>(std::istream &str, CameraParameters&cp);
private:
- //GL routines
-
- static void argConvGLcpara2( double cparam[3][4], int width, int height, double gnear, double gfar, double m[16], bool invert )throw(cv::Exception);
- static int arParamDecompMat( double source[3][4], double cpara[3][4], double trans[3][4] )throw(cv::Exception);
- static double norm( double a, double b, double c );
- static double dot( double a1, double a2, double a3,
- double b1, double b2, double b3 );
-
-
+ // GL routines
+ static void argConvGLcpara2(double cparam[3][4], int width, int height, double gnear, double gfar, double m[16],
+ bool invert);
+ static int arParamDecompMat(double source[3][4], double cpara[3][4], double trans[3][4]);
+ static double norm(double a, double b, double c);
+ static double dot(double a1, double a2, double a3, double b1, double b2, double b3);
};
-}
-#endif
-
+} // namespace aruco
+#endif /* _Aruco_CameraParameters_H */
diff --git a/aruco/include/aruco/cvdrawingutils.h b/aruco/include/aruco/cvdrawingutils.h
index 01db869..d08f426 100644
--- a/aruco/include/aruco/cvdrawingutils.h
+++ b/aruco/include/aruco/cvdrawingutils.h
@@ -1,52 +1,57 @@
-/*****************************
-Copyright 2011 Rafael Muñoz Salinas. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without modification, are
-permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this list of
- conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice, this list
- of conditions and the following disclaimer in the documentation and/or other materials
- provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
-WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those of the
-authors and should not be interpreted as representing official policies, either expressed
-or implied, of Rafael Muñoz Salinas.
-********************************/
+/**
+ Copyright 2017 Rafael Muñoz Salinas. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The views and conclusions contained in the software and documentation are those of the
+ authors and should not be interpreted as representing official policies, either expressed
+ or implied, of Rafael Muñoz Salinas.
+ */
+
#ifndef _ArUco_DrawUtils_H_
#define _ArUco_DrawUtils_H_
-#include
-#include
+
+#include "aruco.h"
+#include "aruco_export.h"
+
namespace aruco
{
- /**\brief A set of functions to draw in opencv images
- */
- class ARUCO_EXPORTS CvDrawingUtils
- {
- public:
-
- static void draw3dAxis(cv::Mat &Image,Marker &m,const CameraParameters &CP);
-
- static void draw3dCube(cv::Mat &Image,Marker &m,const CameraParameters &CP);
-
- static void draw3dAxis(cv::Mat &Image,Board &m,const CameraParameters &CP);
-
- static void draw3dCube(cv::Mat &Image,Board &m,const CameraParameters &CP);
-
- };
+
+/**
+ * \brief A set of functions to draw in OpenCV images
+ */
+class ARUCO_EXPORT CvDrawingUtils
+{
+public:
+ static void draw3dAxis(cv::Mat& Image, const CameraParameters& CP, const cv::Mat& Rvec, const cv::Mat& Tvec,
+ float axis_size);
+
+ static void draw3dAxis(cv::Mat& Image, Marker& m, const CameraParameters& CP);
+
+ static void draw3dCube(cv::Mat& Image, Marker& m, const CameraParameters& CP, bool setYperpendicular = false);
+
+// static void draw3dAxis(cv::Mat &Image, MarkerMap &m, const CameraParameters &CP);
+// static void draw3dCube(cv::Mat &Image, MarkerMap &m, const CameraParameters &CP, bool setYperpendicular = false);
};
-#endif
+} // namespace aruco
+#endif /* _ArUco_DrawUtils_H_ */
diff --git a/aruco/include/aruco/debug.h b/aruco/include/aruco/debug.h
new file mode 100644
index 0000000..bc04d6e
--- /dev/null
+++ b/aruco/include/aruco/debug.h
@@ -0,0 +1,122 @@
+/**
+ Copyright 2017 Rafael Muñoz Salinas. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, are
+ permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice, this list of
+ conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ of conditions and the following disclaimer in the documentation and/or other materials
+ provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY Rafael Muñoz Salinas ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Rafael Muñoz Salinas OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ The views and conclusions contained in the software and documentation are those of the
+ authors and should not be interpreted as representing official policies, either expressed
+ or implied, of Rafael Muñoz Salinas.
+ */
+
+#ifndef __Debug_H
+#define __Debug_H
+
+#include
+#include
+#include
+#include "aruco_export.h"
+#include