Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
adujardin committed Jun 12, 2019
1 parent 666411f commit 83be9a5
Show file tree
Hide file tree
Showing 14 changed files with 49,233 additions and 0 deletions.
Binary file added 6x6_1000-25.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Stereolabs ZED - ArUco sample

This sample shows how to reset the ZED camera tracking to a known reference using an ArUco marker.

![http://chev.me/arucogen/](6x6_1000-25.png)

## Mono

The Mono camera sample located in the [mono folder](./mono) provides an easy way to reset the positional tracking using a marker as a known fixed position in space.

## Multi Camera

The [multi camera sample](./multi-camera) use the marker location to calibrates multiples ZED camera in space. By pointing all the camera to a unique marker, the position of each can be deduced.
The point cloud of every camera is then displayed in the same referential.

## Other

Feel free to modify either sample to fit your need, the marker detection is very convenient and robust and can be used to a number of application where an external position has to be known.

## ArUco markers

This [website](http://chev.me/arucogen/) can be used to easily display Aruco patterns.

The sample is expecting a `6x6 Aruco` Dictionary with a 160mm marker by default. The bigger the marker, the better the camera position will be.
It's important to make sure that the real-world size of the marker matches the size set in the samples (160mm) to avoid scale issues in the tracking.

## ArUco detection

The Aruco detection code is taken from OpenCV Contrib module, please refer to the source files for the license information (BSD 3).
43 changes: 43 additions & 0 deletions mono/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
SET(ProjectName ZED_Reloc_Aruco)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
PROJECT(${ProjectName})

option(LINK_SHARED_ZED "Link with the ZED SDK shared executable" ON)

if (NOT LINK_SHARED_ZED AND MSVC)
message(FATAL_ERROR "LINK_SHARED_ZED OFF : ZED SDK static libraries not available on Windows")
endif()

if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 OLD)
cmake_policy(SET CMP0015 OLD)
endif(COMMAND cmake_policy)

SET(EXECUTABLE_OUTPUT_PATH ".")

find_package(ZED 2 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} EXACT REQUIRED)

include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
include_directories(${OPENCV_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)

link_directories(${ZED_LIBRARY_DIR})
link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(${CUDA_LIBRARY_DIRS})

FILE(GLOB_RECURSE SRC_FILES src/*.cpp)
FILE(GLOB_RECURSE HDR_FILES include/*.hpp)

ADD_EXECUTABLE(${ProjectName} ${HDR_FILES} ${SRC_FILES})
add_definitions(-std=c++11 -O3)

if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_NPP_LIBRARIES_ZED})
else()
SET(ZED_LIBS ${ZED_STATIC_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_LIBRARY})
endif()

TARGET_LINK_LIBRARIES(${ProjectName} ${ZED_LIBS} ${OpenCV_LIBRARIES})
59 changes: 59 additions & 0 deletions mono/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Stereolabs ZED - ArUco Positional Tracking sample

This sample shows how to reset the ZED camera tracking to a known reference using an ArUco marker.

![http://chev.me/arucogen/](../6x6_1000-25.png)

Point the camera to this marker and press the space bar to reset the positional tracking reference.
This feature can be useful to avoid accumulating drift when moving the camera or to get multiple cameras in the same referential.


## Getting started

- First, download the latest version of the ZED SDK on [stereolabs.com](https://www.stereolabs.com).
- For more information, read the ZED [API documentation](https://www.stereolabs.com/developers/documentation/API/).

### Prerequisites

- Windows 7 64bits or later, Ubuntu 16.04 or later
- [ZED SDK](https://www.stereolabs.com/developers/) and its dependencies ([CUDA](https://developer.nvidia.com/cuda-downloads))

## Build the program

Download the sample and follow the instructions below: [More](https://www.stereolabs.com/docs/getting-started/application-development/)

### Build for Windows

- Create a "build" folder in the source folder
- Open cmake-gui and select the source and build folders
- Generate the Visual Studio `Win64` solution
- Open the resulting solution and change configuration to `Release`
- Build solution

### Build for Linux

Open a terminal in the sample directory and execute the following command:

mkdir build
cd build
cmake ..
make

## Run the program

- Navigate to the build directory and launch the executable file
- Or open a terminal in the build directory and run the sample :

./ZED_Reloc_Aruco


## ArUco markers

This [website](http://chev.me/arucogen/) can be used to easily display Aruco patterns.

The sample is expecting a `6x6 Aruco` Dictionary with a 160mm marker by default. The bigger the marker, the better the camera position will be.
It's important to make sure that the real-world size of the marker matches the size set in the samples (160mm) to avoid scale issues in the tracking.

## ArUco detection

The Aruco detection code is taken from OpenCV Contrib module, please refer to the source files for the license information (BSD 3).
Loading

0 comments on commit 83be9a5

Please sign in to comment.