Skip to content

Commit

Permalink
Merge pull request #20 from stereolabs/feat_depth_tapi
Browse files Browse the repository at this point in the history
Feat depth tapi
  • Loading branch information
Myzhar authored Sep 10, 2021
2 parents 830d9d0 + 96f56b0 commit 969d153
Show file tree
Hide file tree
Showing 27 changed files with 1,356 additions and 216 deletions.
35 changes: 0 additions & 35 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

20 changes: 0 additions & 20 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/question.md

This file was deleted.

69 changes: 56 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ project(${PROJECT_NAME} CXX)
############################################################################
# Flags

cmake_policy(SET CMP0054 NEW)

# if CMAKE_BUILD_TYPE is not specified, take 'Release' as default
set(${PROJECT_NAME}_CXX_FLAGS "-std=c++14")
set(CMAKE_CXX_FLAGS "${${PROJECT_NAME}_CXX_FLAGS} -Wall -pedantic -g")
Expand All @@ -25,6 +27,8 @@ else()
message("* Release mode")
endif()



############################################################################
# Options
option(BUILD_VIDEO "Build the ZED Open Capture Video Modules (only for Linux)" ON)
Expand Down Expand Up @@ -135,41 +139,80 @@ if(BUILD_EXAMPLES)
include_directories(${OpenCV_INCLUDE_DIRS})

##### Video Example
add_executable(${PROJECT_NAME}_video_example "${PROJECT_SOURCE_DIR}/examples/zed_oc_video_example.cpp")
set_target_properties(${PROJECT_NAME}_video_example PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}_video_example
set(VIDEO_EXAMPLE ${PROJECT_NAME}_video_example)
add_executable(${VIDEO_EXAMPLE} "${PROJECT_SOURCE_DIR}/examples/zed_oc_video_example.cpp")
set_target_properties(${VIDEO_EXAMPLE} PROPERTIES PREFIX "")
target_link_libraries(${VIDEO_EXAMPLE}
${PROJECT_NAME}
${OpenCV_LIBS}
)
install(TARGETS ${PROJECT_NAME}_video_example
install(TARGETS ${VIDEO_EXAMPLE}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)

##### Control Example
add_executable(${PROJECT_NAME}_control_example "${PROJECT_SOURCE_DIR}/examples/zed_oc_control_example.cpp")
set_target_properties(${PROJECT_NAME}_control_example PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}_control_example
set(CONTROL_EXAMPLE ${PROJECT_NAME}_control_example)
add_executable(${CONTROL_EXAMPLE} "${PROJECT_SOURCE_DIR}/examples/zed_oc_control_example.cpp")
set_target_properties(${CONTROL_EXAMPLE} PROPERTIES PREFIX "")
target_link_libraries(${CONTROL_EXAMPLE}
${PROJECT_NAME}
${OpenCV_LIBS}
)
install(TARGETS ${PROJECT_NAME}_control_example
install(TARGETS ${CONTROL_EXAMPLE}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)

##### Rectify Example
set(RECTIFY_EXAMPLE ${PROJECT_NAME}_rectify_example)
include_directories( ${PROJECT_SOURCE_DIR}/examples/include)
add_executable(${RECTIFY_EXAMPLE} "${PROJECT_SOURCE_DIR}/examples/zed_oc_rectify_example.cpp")
set_target_properties(${RECTIFY_EXAMPLE} PROPERTIES PREFIX "")
target_link_libraries(${RECTIFY_EXAMPLE}
${PROJECT_NAME}
${OpenCV_LIBS}
)
install(TARGETS ${RECTIFY_EXAMPLE}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)

##### Depth Example
find_package(OpenMP)

set(DEPTH_EXAMPLE ${PROJECT_NAME}_depth_example)
include_directories( ${PROJECT_SOURCE_DIR}/examples/include)
add_executable(${DEPTH_EXAMPLE} "${PROJECT_SOURCE_DIR}/examples/zed_oc_depth_example.cpp")
set_target_properties(${DEPTH_EXAMPLE} PROPERTIES PREFIX "")

if(OpenMP_CXX_FOUND)
include_directories(${OpenMP_CXX_INCLUDE_DIRS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
target_link_libraries(${DEPTH_EXAMPLE}
OpenMP::OpenMP_CXX
${PROJECT_NAME}
${OpenCV_LIBS}
)
else()
target_link_libraries(${DEPTH_EXAMPLE}
${PROJECT_NAME}
${OpenCV_LIBS}
)
endif()

##### Depth Tune Stereo
set(STEREO_TUNE_APP ${PROJECT_NAME}_depth_tune_stereo)
include_directories( ${PROJECT_SOURCE_DIR}/examples/include)
add_executable(${PROJECT_NAME}_rectify_example "${PROJECT_SOURCE_DIR}/examples/zed_oc_rectify_example.cpp")
set_target_properties(${PROJECT_NAME}_rectify_example PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}_rectify_example
add_executable(${STEREO_TUNE_APP} "${PROJECT_SOURCE_DIR}/examples/tools/zed_oc_tune_stereo_sgbm.cpp")
set_target_properties(${STEREO_TUNE_APP} PROPERTIES PREFIX "")
target_link_libraries(${STEREO_TUNE_APP}
${PROJECT_NAME}
${OpenCV_LIBS}
)
install(TARGETS ${PROJECT_NAME}_rectify_example
install(TARGETS ${STEREO_TUNE_APP}
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)

if(DEBUG_CAM_REG)
##### Video with AEG/AGC reisters log
##### Video with AEG/AGC registers log
add_executable(${PROJECT_NAME}_video_reg_log "${PROJECT_SOURCE_DIR}/examples/zed_oc_video_reg_log.cpp")
set_target_properties(${PROJECT_NAME}_video_reg_log PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}_video_reg_log
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Stereolabs
Copyright (c) 2021 Stereolabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
* Video Capture
- YUV 4:2:2 data format
- Camera controls
* Sensor Data Capture
* Sensor Data Capture [Not available for ZED]
- 6-DOF IMU (3-DOF accelerometer + 3-DOF gyroscope)
- 3-DOF Magnetometer
- Barometer
- Sensors temperature
- 3-DOF Magnetometer [Only ZED2 and ZED2i]
- Barometer [Only ZED2 and ZED2i]
- Sensors temperature [Only ZED2 and ZED2i]
* Sensors/video Synchronization
* Portable
- Tested on Linux
Expand All @@ -39,14 +39,16 @@
- Stereo rectification
- IMU, magnetometer and barometer data capture
- Video and sensors synchronization
- Disparity/Depth/Point Cloud extraction using OpenCV Transparent API
- Depth tuning using OpenCV control GUI

## Description

The ZED Open Capture is a multi-platform, open-source C++ library for low-level camera and sensor capture for the ZED stereo camera family. It doesn't require CUDA and therefore can be used on many desktop and embedded platforms.

The open-source library provides methods to access raw video frames, calibration data, camera controls and raw data from the camera sensors (on ZED 2 and ZED Mini). A synchronization mechanism is provided to get the correct sensor data associated to a video frame.
The open-source library provides methods to access raw video frames, calibration data, camera controls and raw data from the camera sensors (on ZED 2, ZED 2i, and ZED Mini). A synchronization mechanism is provided to get the correct sensor data associated to a video frame.

**Note:** While in the ZED SDK all output data is calibrated and compensated, here the extracted raw data is not corrected by the camera and sensor calibration parameters. You can retrieve camera and sensor calibration data using the [ZED SDK](https://www.stereolabs.com/docs/video/camera-calibration/) to correct your camera data.
**Note:** While in the ZED SDK all output data is calibrated and compensated, here the extracted raw data is not corrected by the camera and sensor calibration parameters. You can retrieve camera and sensor calibration data using the [ZED SDK](https://www.stereolabs.com/docs/video/camera-calibration/) to correct your camera data [see `zed_open_capture_rectify_example` example].

## Build

Expand All @@ -56,6 +58,7 @@ The open-source library provides methods to access raw video frames, calibration
* Linux OS
* GCC (v7.5+)
* CMake (v3.1+)
* OpenCV (v3.4.0+) -Optional for the examples-

### Install prerequisites

Expand Down Expand Up @@ -156,6 +159,8 @@ After installing the library and examples, you will have the following sample ap
* [zed_open_capture_rectify_example](https://github.com/stereolabs/zed-open-capture/blob/fix_doc/examples/zed_oc_rectify_example.cpp): This application downloads factory stereo calibration parameters from Stereolabs server, performs stereo image rectification and displays original and rectified frames.
* [zed_open_capture_sensors_example](https://github.com/stereolabs/zed-open-capture/blob/fix_doc/examples/zed_oc_sensors_example.cpp): This application creates a `SensorCapture` object and displays on the command console the values of camera sensors acquired at full rate.
* [zed_open_capture_sync_example](https://github.com/stereolabs/zed-open-capture/blob/fix_doc/examples/zed_oc_sync_example.cpp): This application creates a `VideoCapture` and a `SensorCapture` object, initialize the camera/sensors synchronization and displays on screen the video stream with the synchronized IMU data.
* [zed_open_capture_depth_example](https://github.com/stereolabs/zed-open-capture/blob/fix_doc/examples/zed_oc_depth_example.cpp): This application captures and displays video frames, calculates disparity map, then extracts the depth map and the point cloud displaying the result and the performances estimation.
* [zed_open_capture_depth_tune_stereo](https://github.com/stereolabs/zed-open-capture/blob/fix_doc/examples/tools/zed_oc_tune_stereo_sgbm.cpp): This application captures the first available stereo frames and provides GUI Controls to tune the disparity map results and save them to be used in the `zed_open_capture_depth_example` example

To run the examples, open a terminal console and enter the following commands:

Expand All @@ -165,9 +170,11 @@ $ zed_open_capture_control_example
$ zed_open_capture_rectify_example
$ zed_open_capture_sensors_example
$ zed_open_capture_sync_example
$ zed_open_capture_depth_example
$ zed_open_capture_depth_tune_stereo
```

**Note:** OpenCV is used in the examples for controls and display.
**Note:** OpenCV is used in the examples for controls, display, and depth extraction.


## Documentation
Expand Down Expand Up @@ -201,3 +208,4 @@ This library is licensed under the MIT License.

## Support
If you need assistance go to our Community site at https://community.stereolabs.com/

7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

v0.5.0 - 2021 09 10
-------------------
* Add example to extract disparity map, depth map and point cloud using OpenCV and T-API (OpenCL)
`cv::StereoSGBM` algorithm based on the paper "Heiko Hirschmuller. Stereo processing by semiglobal matching and mutual information. Pattern Analysis and Machine Intelligence, IEEE Transactions on, 30(2):328–341, 2008."
* Add example to tune disparity map creation
* Add tool to load/save StereoSGBM depth matching parameters

v0.4.1 - 2021 05 28
-------------------
* Fix udev rules to access the sensors module of the new ZED2i
Expand Down
36 changes: 24 additions & 12 deletions doc/api_doc/doxyfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Doxyfile 1.9.3
# Doxyfile 1.9.2

# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
Expand Down Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "ZED Open Capture"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = v0.4.1
PROJECT_NUMBER = v0.5.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down Expand Up @@ -874,6 +874,8 @@ WARN_LOGFILE =
INPUT = ../../src \
../../include \
../../examples \
../../examples/include \
../../examples/tools \
. \
main_page.md

Expand Down Expand Up @@ -955,21 +957,25 @@ EXCLUDE_SYMBOLS =
# that contain example code fragments that are included (see the \include
# command).

EXAMPLE_PATH = ../../examples
EXAMPLE_PATH = ../../examples \
../../examples/include \
../../examples/tools \
../../examples/zed_oc_depth_example.cpp \
../../examples/tools/zed_oc_tune_stereo_sgbm.cpp

# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.

EXAMPLE_PATTERNS = *
EXAMPLE_PATTERNS =

# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
# irrespective of the value of the RECURSIVE tag.
# The default value is: NO.

EXAMPLE_RECURSIVE = NO
EXAMPLE_RECURSIVE = YES

# The IMAGE_PATH tag can be used to specify one or more files or directories
# that contain images that are to be included in the documentation (see the
Expand Down Expand Up @@ -2273,6 +2279,15 @@ EXTERNAL_PAGES = YES
# Configuration options related to the dot tool
#---------------------------------------------------------------------------

# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.

CLASS_DIAGRAMS = YES

# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
Expand Down Expand Up @@ -2329,14 +2344,11 @@ DOT_FONTSIZE = 10

DOT_FONTPATH =

# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
# graph for each documented class showing the direct and indirect inheritance
# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
# to TEXT the direct and indirect inheritance relations will be shown as texts /
# links.
# Possible values are: NO, YES, TEXT and GRAPH.
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.

CLASS_GRAPH = YES

Expand Down
Loading

0 comments on commit 969d153

Please sign in to comment.