Skip to content

Commit

Permalink
3.7 sample upgrade (stereolabs#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
adujardin authored May 11, 2022
1 parent fa4bf50 commit 3cd9c19
Show file tree
Hide file tree
Showing 154 changed files with 4,111 additions and 675 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.5)
PROJECT(SamplesAndTutos)

OPTION(INSTALL_SAMPLES "Once build, deploy samples into bin" ON)
Expand All @@ -10,6 +10,8 @@ else()
SET(TYPE "csharp")
endif()

SET(CMAKE_BUILD_TYPE "Release")

SET(SAMPLE_LIST "")
add_subdirectory("camera control/${TYPE}")
add_subdirectory("depth sensing/${TYPE}")
Expand All @@ -34,4 +36,4 @@ add_subdirectory("tutorials")

if(${INSTALL_SAMPLES} AND ${BUILD_CPP})
INSTALL(TARGETS ${SAMPLE_LIST} RUNTIME DESTINATION ${CMAKE_SOURCE_DIR}/bin)
endif()
endif()
36 changes: 13 additions & 23 deletions body tracking/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
cmake_minimum_required(VERSION 2.4)
cmake_minimum_required(VERSION 3.5)
PROJECT(ZED_Body_Tracking_Viewer)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_BUILD_TYPE "Release")

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 CMP0004 OLD)
cmake_policy(SET CMP0015 OLD)
endif(COMMAND cmake_policy)

SET(EXECUTABLE_OUTPUT_PATH ".")
SET(SPECIAL_OS_LIBS "")

find_package(ZED 3 REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)
find_package(OpenCV REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLEW REQUIRED)
SET(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
find_package(CUDA REQUIRED)

IF(NOT WIN32)
SET(SPECIAL_OS_LIBS "pthread" "X11")
add_definitions(-Wno-write-strings)
ENDIF()

include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
Expand All @@ -46,7 +37,6 @@ FILE(GLOB_RECURSE SRC_FILES src/*.c*)
FILE(GLOB_RECURSE HDR_FILES include/*.h*)

add_executable(${PROJECT_NAME} ${HDR_FILES} ${SRC_FILES})
add_definitions(-std=c++14)

if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY} ${CUDA_DEP_LIBRARIES_ZED})
Expand All @@ -55,12 +45,12 @@ else()
endif()

target_link_libraries(${PROJECT_NAME}
${SPECIAL_OS_LIBS}
${ZED_LIBS}
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${OpenCV_LIBRARIES}
${GLEW_LIBRARIES})
${ZED_LIBS}
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${OpenCV_LIBRARIES}
${GLEW_LIBRARIES}
)

if(INSTALL_SAMPLES)
LIST(APPEND SAMPLE_LIST ${PROJECT_NAME})
Expand Down
3 changes: 2 additions & 1 deletion body tracking/cpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down Expand Up @@ -53,6 +53,7 @@ int main(int argc, char **argv) {
// On Jetson the object detection combined with an heavy depth mode could reduce the frame rate too much
init_parameters.depth_mode = isJetson ? DEPTH_MODE::PERFORMANCE : DEPTH_MODE::ULTRA;
init_parameters.coordinate_system = COORDINATE_SYSTEM::RIGHT_HANDED_Y_UP;
init_parameters.sdk_verbose=1;

parseArgs(argc, argv, init_parameters);

Expand Down
2 changes: 1 addition & 1 deletion body tracking/csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES

set(CMAKE_SUPPRESS_REGENERATION true)
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_PACKAGE_REFERENCES
"Stereolabs.zed_3.6.0"
"Stereolabs.zed_3.7.*"
"OpenGL.Net_0.8.4"
"OpenGL.Net.CoreUI_0.8.4"
"OpenCvSharp4.Windows_4.5.0.20201013"
Expand Down
2 changes: 1 addition & 1 deletion body tracking/csharp/MainWindow.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down
2 changes: 1 addition & 1 deletion body tracking/python/body_tracking.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
########################################################################
#
# Copyright (c) 2021, STEREOLABS.
# Copyright (c) 2022, STEREOLABS.
#
# All rights reserved.
#
Expand Down
32 changes: 6 additions & 26 deletions camera control/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(ZED_Camera_Control)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_BUILD_TYPE "Release")

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 3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} EXACT REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)

include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
Expand All @@ -27,23 +24,6 @@ link_directories(${OpenCV_LIBRARY_DIRS})
link_directories(${CUDA_LIBRARY_DIRS})

ADD_EXECUTABLE(${PROJECT_NAME} src/main.cpp)
add_definitions(-std=c++14 -O3)

## DEBUG/ SANITIZER options
IF(NOT WIN32)
add_definitions(-Werror=return-type)
IF (BUILD_WITH_SANITIZER)
message("!! Building with address sanitizer and -g !!")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address -Wall -Wextra -g")
set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address -Wall -Wextra -g")
add_definitions(-g -fsanitize=address -fno-omit-frame-pointer -static-libasan -Wall -Wextra)
ENDIF()

IF (BUILD_WITH_DEBUGINFOS)
message("!! Building with -g !!")
add_definitions(-g)
ENDIF()
ENDIF()

if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
Expand Down
11 changes: 3 additions & 8 deletions camera control/cpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down Expand Up @@ -91,21 +91,16 @@ static void onMouse(int event, int x, int y, int, void*)
}

int main(int argc, char **argv) {

// Create a ZED Camera object

std::cout<<" Reboot CAMERA "<<std::endl;
sl::ERROR_CODE errcode= sl::Camera::reboot(0);
sl::sleep_ms(3000);
std::cout<<" Reboot CAMERA --> "<<errcode<<std::endl;
Camera zed;

sl::InitParameters init_parameters;
init_parameters.sdk_verbose = true;
init_parameters.camera_resolution= sl::RESOLUTION::HD720;
init_parameters.depth_mode = sl::DEPTH_MODE::NONE; // no depth computation required here
parseArgs(argc,argv, init_parameters);


// Open the camera
auto returned_state = zed.open(init_parameters);
if (returned_state != ERROR_CODE::SUCCESS) {
Expand Down
2 changes: 1 addition & 1 deletion camera control/csharp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DOTNET_REFERENCES

set(CMAKE_SUPPRESS_REGENERATION true)
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_PACKAGE_REFERENCES
"Stereolabs.zed_3.6.0"
"Stereolabs.zed_3.7.*"
"OpenCvSharp4.Windows_4.5.0.20201013"
)
3 changes: 1 addition & 2 deletions camera control/csharp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down Expand Up @@ -49,7 +49,6 @@ static void Main(string[] args)

InitParameters initParameters = new InitParameters()
{
sdkVerbose = true,
resolution = RESOLUTION.HD720,
depthMode = DEPTH_MODE.NONE
};
Expand Down
2 changes: 1 addition & 1 deletion camera control/python/camera_control.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
########################################################################
#
# Copyright (c) 2021, STEREOLABS.
# Copyright (c) 2022, STEREOLABS.
#
# All rights reserved.
#
Expand Down
2 changes: 1 addition & 1 deletion camera streaming/receiver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

### Features
- Connects to a network ZED device.
- Uses SDK to retrieve the RGB image and control the image properties.
- Uses SDK to compute point cloud and displays it with OpenGL.
20 changes: 8 additions & 12 deletions camera streaming/receiver/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(ZED_Streaming_Receiver)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_BUILD_TYPE "Release")

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 3 REQUIRED)
find_package(OpenCV REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} EXACT REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)

include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})

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

ADD_EXECUTABLE(${PROJECT_NAME} src/main.cpp)
add_definitions(-std=c++14 -O3)

if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
Expand All @@ -40,4 +36,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ZED_LIBS} ${OpenCV_LIBRARIES})
if(INSTALL_SAMPLES)
LIST(APPEND SAMPLE_LIST ${PROJECT_NAME})
SET(SAMPLE_LIST "${SAMPLE_LIST}" PARENT_SCOPE)
endif()
endif()
4 changes: 2 additions & 2 deletions camera streaming/receiver/cpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down Expand Up @@ -131,7 +131,7 @@ int main(int argc, char **argv) {
Camera zed;
// Set configuration parameters for the ZED
InitParameters init_parameters;
init_parameters.depth_mode = DEPTH_MODE::PERFORMANCE;
init_parameters.depth_mode = DEPTH_MODE::NONE;
init_parameters.coordinate_system = COORDINATE_SYSTEM::RIGHT_HANDED_Y_UP; // OpenGL's coordinate system is right_handed
init_parameters.sdk_verbose = true;

Expand Down
2 changes: 1 addition & 1 deletion camera streaming/receiver/python/streaming_receiver.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
########################################################################
#
# Copyright (c) 2021, STEREOLABS.
# Copyright (c) 2022, STEREOLABS.
#
# All rights reserved.
#
Expand Down
22 changes: 7 additions & 15 deletions camera streaming/sender/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
PROJECT(ZED_Streaming_Sender)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_BUILD_TYPE "Release")

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 3 REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} EXACT REQUIRED)
find_package(CUDA ${ZED_CUDA_VERSION} REQUIRED)

IF(NOT WIN32)
SET(SPECIAL_OS_LIBS "pthread" "X11")
ENDIF()

include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${ZED_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
Expand All @@ -29,7 +22,6 @@ link_directories(${ZED_LIBRARY_DIR})
link_directories(${CUDA_LIBRARY_DIRS})

ADD_EXECUTABLE(${PROJECT_NAME} include/utils.hpp src/main.cpp)
add_definitions(-std=c++14 -O3)

if (LINK_SHARED_ZED)
SET(ZED_LIBS ${ZED_LIBRARIES} ${CUDA_CUDA_LIBRARY} ${CUDA_CUDART_LIBRARY})
Expand All @@ -42,4 +34,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${ZED_LIBS} ${OpenCV_LIBRARIES})
if(INSTALL_SAMPLES)
LIST(APPEND SAMPLE_LIST ${PROJECT_NAME})
SET(SAMPLE_LIST "${SAMPLE_LIST}" PARENT_SCOPE)
endif()
endif()
2 changes: 1 addition & 1 deletion camera streaming/sender/cpp/include/utils.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down
4 changes: 2 additions & 2 deletions camera streaming/sender/cpp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2021, STEREOLABS.
// Copyright (c) 2022, STEREOLABS.
//
// All rights reserved.
//
Expand Down Expand Up @@ -48,7 +48,7 @@ int main(int argc, char **argv) {
InitParameters init_parameters;
init_parameters.camera_resolution = sl::RESOLUTION::HD720;
init_parameters.depth_mode = DEPTH_MODE::NONE;
init_parameters.sdk_verbose = true;
init_parameters.sdk_verbose = 1;
int res_arg = parseArgs(argc, argv, init_parameters);

// Open the camera
Expand Down
Loading

0 comments on commit 3cd9c19

Please sign in to comment.