Skip to content

Commit

Permalink
update sample code and fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hzcyf committed Jun 17, 2024
1 parent 8e2b475 commit 666873d
Show file tree
Hide file tree
Showing 38 changed files with 111 additions and 181 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019

cmake_minimum_required(VERSION 3.1.15)

set(CMAKE_CXX_STANDARD 11)
Expand Down
4 changes: 1 addition & 3 deletions examples/0.basic.enumerate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ add_executable(ob_enumerate enumerate.cpp)

set_property(TARGET ob_enumerate PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_enumerate OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_enumerate PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties (ob_enumerate PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_enumerate)
# ob_install_example_current_source("/cpp/0.basic.enumerate")
Empty file.
5 changes: 2 additions & 3 deletions examples/0.basic.quick_start/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ add_executable(ob_quick_start quick_start.cpp)

set_property(TARGET ob_quick_start PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_quick_start openobsdk ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_quick_start PROPERTIES FOLDER "Examples")
ENDIF()

set_target_properties (ob_quick_start PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_quick_start)
# ob_install_example_current_source("/cpp/3.advanced.post_processing")
2 changes: 0 additions & 2 deletions examples/1.stream.color/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ add_executable(ob_color color.cpp)
set_property(TARGET ob_color PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_color OrbbecSDK ${OpenCV_LIBS})

IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_color PROPERTIES FOLDER "Examples")
ENDIF()

# ob_install_example_target(ob_color)
# ob_install_example_current_source("/cpp/1.stream.color")
9 changes: 3 additions & 6 deletions examples/1.stream.depth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_depth)
Expand All @@ -7,9 +7,6 @@ add_executable(ob_depth depth.cpp)

set_property(TARGET ob_depth PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_depth OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_depth PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_depth PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_depth)
# ob_install_example_current_source("/cpp/1.stream.depth")
# ob_install_example_target(ob_depth) ob_install_example_current_source("/cpp/1.stream.depth")
11 changes: 4 additions & 7 deletions examples/1.stream.imu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_imu)

add_executable(ob_imu imu.cpp)

set_property(TARGET ob_imu PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_imu OrbbecSDK )
target_link_libraries(ob_imu OrbbecSDK)

IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_imu PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_imu PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_imu)
# ob_install_example_current_source("/cpp/1.stream.imu")
# ob_install_example_target(ob_imu) ob_install_example_current_source("/cpp/1.stream.imu")
2 changes: 0 additions & 2 deletions examples/1.stream.infrared/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ add_executable(ob_infrared infrared.cpp)

set_property(TARGET ob_infrared PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_infrared OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_infrared PROPERTIES FOLDER "Examples")
ENDIF()


# ob_install_example_target(ob_infrared)
Expand Down
9 changes: 3 additions & 6 deletions examples/1.stream.multi_streams/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_multi_streams)
Expand All @@ -7,9 +7,6 @@ add_executable(ob_multi_streams multi_streams.cpp)

set_property(TARGET ob_multi_streams PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_multi_streams OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_multi_streams PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_multi_streams PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_multi_streams)
# ob_install_example_current_source("/cpp/1.stream.multi_streams")
# ob_install_example_target(ob_multi_streams) ob_install_example_current_source("/cpp/1.stream.multi_streams")
11 changes: 3 additions & 8 deletions examples/3.advanced.hdr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_hdr)
Expand All @@ -7,10 +7,5 @@ add_executable(ob_hdr hdr.cpp)

set_property(TARGET ob_hdr PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_hdr OrbbecSDK ${OpenCV_LIBS})

IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_hdr PROPERTIES FOLDER "Examples")
ENDIF()

# ob_install_example_target(ob_hdr)
# ob_install_example_current_source("/cpp/3.advanced.hdr")
set_target_properties(ob_hdr PROPERTIES FOLDER "Examples")
# ob_install_example_target(ob_hdr) ob_install_example_current_source("/cpp/3.advanced.hdr")
9 changes: 3 additions & 6 deletions examples/3.advanced.point_cloud/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_point_cloud)
Expand All @@ -8,9 +8,6 @@ add_executable(ob_point_cloud point_cloud.cpp)
set_property(TARGET ob_point_cloud PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_point_cloud OrbbecSDK)

IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_point_cloud PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_point_cloud PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_point_cloud)
# ob_install_example_current_source("/cpp/3.advanced.point_cloud")
# ob_install_example_target(ob_point_cloud) ob_install_example_current_source("/cpp/3.advanced.point_cloud")
9 changes: 3 additions & 6 deletions examples/3.advanced.post_processing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_post_processing)
Expand All @@ -7,9 +7,6 @@ add_executable(ob_post_processing post_processing.cpp)

set_property(TARGET ob_post_processing PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_post_processing OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_post_processing PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_post_processing PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_post_processing)
# ob_install_example_current_source("/cpp/3.advanced.post_processing")
# ob_install_example_target(ob_post_processing) ob_install_example_current_source("/cpp/3.advanced.post_processing")
9 changes: 3 additions & 6 deletions examples/3.advanced.preset/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# minimum required cmake version: 3.1.15 support vs2019


cmake_minimum_required(VERSION 3.1.15)
project(ob_preset)
Expand All @@ -7,9 +7,6 @@ add_executable(ob_preset preset.cpp)

set_property(TARGET ob_preset PROPERTY CXX_STANDARD 11)
target_link_libraries(ob_preset OrbbecSDK ${OpenCV_LIBS})
IF(USE_PROJECT_FOLDERS)
set_target_properties (ob_preset PROPERTIES FOLDER "Examples")
ENDIF()
set_target_properties(ob_preset PROPERTIES FOLDER "Examples")

# ob_install_example_target(ob_preset)
# ob_install_example_current_source("/cpp/3.advanced.preset")
# ob_install_example_target(ob_preset) ob_install_example_current_source("/cpp/3.advanced.preset")
16 changes: 5 additions & 11 deletions examples/c_examples/0.c_quick_start/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ cmake_minimum_required(VERSION 3.1.15)

set(CMAKE_CXX_STANDARD 11)
project(ob_quick_start_c)
add_executable( ob_quick_start_c
quick_start.c
)
add_executable(ob_quick_start_c quick_start.c)

target_link_libraries(ob_quick_start_c openobsdk)
target_link_libraries(ob_quick_start_c PRIVATE ob::openobsdk ob::examples::common)

if(USE_PROJECT_FOLDERS)
set_target_properties(ob_quick_start_c PROPERTIES FOLDER "Examples_c")
set_target_properties(ob_quick_start_c PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
endif()

# ob_install_example_target(ob_quick_start_c)
# ob_install_example_current_source("/c/0.c_quick_start")
set_target_properties(ob_quick_start_c PROPERTIES FOLDER "Examples_c")
set_target_properties(ob_quick_start_c PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
# ob_install_example_target(ob_quick_start_c) ob_install_example_current_source("/c/0.c_quick_start")
11 changes: 6 additions & 5 deletions examples/c_examples/0.c_quick_start/quick_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ static uint64_t depth_timestamp_current = 0;
// helper function to check for errors and exit if there is one.
void check_ob_error(ob_error **err) {
if(*err) {
const char* error_message = ob_error_get_message(*err);
ob_delete_error(*err);
const char *error_message = ob_error_get_message(*err);
fprintf(stderr, "Error: %s\n", error_message);
ob_delete_error(*err);
exit(-1);
}
*err = NULL;
}

int main(){

ob_error *error = NULL;

// Create a pipeline to open the Color and Depth streams after connecting the device.
Expand All @@ -54,10 +55,10 @@ int main(){

if(frameset != NULL) {
// Get color frame from frameset.
ob_frame *color_frame = ob_frameset_get_frame(frameset, OB_FRAME_COLOR, & error);
const ob_frame *color_frame = ob_frameset_get_frame(frameset, OB_FRAME_COLOR, &error);
check_ob_error(&error);
// Get deoth frame from frameset.
ob_frame *depth_frame = ob_frameset_get_frame(frameset, OB_FRAME_DEPTH, &error);
// Get depth frame from frameset.
const ob_frame *depth_frame = ob_frameset_get_frame(frameset, OB_FRAME_DEPTH, &error);
check_ob_error(&error);

if(color_frame != NULL) {
Expand Down
16 changes: 0 additions & 16 deletions examples/c_examples/1.c_depth/CMakeLists.txt

This file was deleted.

11 changes: 11 additions & 0 deletions examples/c_examples/1.c_enumerate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.1.15)

project(ob_enumerate_c)
add_executable(ob_enumerate_c enumerate.c)

target_link_libraries(ob_enumerate_c OrbbecSDK)

set_target_properties(ob_enumerate_c PROPERTIES FOLDER "Examples_c")
set_target_properties(ob_enumerate_c PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")

# ob_install_example_target(ob_enumerate_c) ob_install_example_current_source("/c/2.c_enumerate")
8 changes: 0 additions & 8 deletions examples/c_examples/1.c_hello/CMakeLists.txt

This file was deleted.

52 changes: 0 additions & 52 deletions examples/c_examples/1.c_hello/hello.c

This file was deleted.

11 changes: 11 additions & 0 deletions examples/c_examples/2.c_depth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.1.15)

project(ob_depth_c)
add_executable(ob_depth_c depth.c)

target_link_libraries(ob_depth_c OrbbecSDK ${OpenCV_LIBS})

set_target_properties(ob_depth_c PROPERTIES FOLDER "Examples_c")
set_target_properties(ob_depth_c PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")

# ob_install_example_target(ob_depth_c) ob_install_example_current_source("/c/1.c_depth")
File renamed without changes.
16 changes: 0 additions & 16 deletions examples/c_examples/2.c_enumerate/CMakeLists.txt

This file was deleted.

10 changes: 10 additions & 0 deletions examples/common/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

cmake_minimum_required(VERSION 3.1.15)
project(ob_examples_common)

add_library(ob_examples_common INTERFACE)

target_include_directories(ob_examples_common INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})

add_library(ob::examples::common ALIAS ob_examples_common)
set_target_properties(ob_examples_common PROPERTIES FOLDER "Examples")
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/core/stream/StreamProfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ std::shared_ptr<StreamProfile> VideoStreamProfile::clone() const {
return sp;
}


OBDisparityProcessParam DisparityStreamProfile::getDisparityProcessParam() const {
return StreamDisparityParamManager::getInstance()->getVideoStreamDisparityParam(shared_from_this());
}
Expand Down
Loading

0 comments on commit 666873d

Please sign in to comment.