From 12e1038c4210c3f9072020b8396608c4596e2052 Mon Sep 17 00:00:00 2001 From: Ferenc Balint-Benczedi Date: Mon, 24 Feb 2020 13:51:20 +0100 Subject: [PATCH 1/4] codecs in compressed_depth_image_transport as standalone library --- compressed_depth_image_transport/CMakeLists.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/compressed_depth_image_transport/CMakeLists.txt b/compressed_depth_image_transport/CMakeLists.txt index 3d0b527..27af50e 100644 --- a/compressed_depth_image_transport/CMakeLists.txt +++ b/compressed_depth_image_transport/CMakeLists.txt @@ -13,20 +13,26 @@ generate_dynamic_reconfigure_options(cfg/CompressedDepthPublisher.cfg) catkin_package( INCLUDE_DIRS include - LIBRARIES ${PROJECT_NAME} + LIBRARIES ${PROJECT_NAME} ${PROJECT_NAME}_codecs CATKIN_DEPENDS cv_bridge dynamic_reconfigure image_transport DEPENDS OpenCV ) include_directories(include ${catkin_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS}) -set(SOURCE_FILES src/compressed_depth_publisher.cpp src/compressed_depth_subscriber.cpp src/manifest.cpp src/codec.cpp src/rvl_codec.cpp) +set(CODEC_SOURCE_FILES src/codec.cpp src/rvl_codec.cpp) +set(SOURCE_FILES src/compressed_depth_publisher.cpp src/compressed_depth_subscriber.cpp src/manifest.cpp) + +add_library(${PROJECT_NAME}_codecs ${CODEC_SOURCE_FILES}) +target_link_libraries(${PROJECT_NAME}_codecs ${catkin_LIBRARIES} ${OpenCV_LIBRARIES}) + add_library(${PROJECT_NAME} ${SOURCE_FILES}) add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_gencfg) -target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} ${OpenCV_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_codecs ${catkin_LIBRARIES} ${OpenCV_LIBRARIES}) class_loader_hide_library_symbols(${PROJECT_NAME}) + install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} From 1db1cb8ee43f6e7119ca7f68c0ad1c59cd86b7f8 Mon Sep 17 00:00:00 2001 From: Ferenc Balint-Benczedi Date: Mon, 24 Feb 2020 14:25:39 +0100 Subject: [PATCH 2/4] fix unit test --- compressed_depth_image_transport/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compressed_depth_image_transport/CMakeLists.txt b/compressed_depth_image_transport/CMakeLists.txt index 27af50e..e1e4282 100644 --- a/compressed_depth_image_transport/CMakeLists.txt +++ b/compressed_depth_image_transport/CMakeLists.txt @@ -49,7 +49,7 @@ install(FILES compressed_depth_plugins.xml if(CATKIN_ENABLE_TESTING) # Build ${PROJECT_NAME}_test library with symbols exported. - add_library(${PROJECT_NAME}_test ${SOURCE_FILES}) + add_library(${PROJECT_NAME}_test ${SOURCE_FILES} ${CODEC_SOURCE_FILES}) add_dependencies(${PROJECT_NAME}_test ${PROJECT_NAME}_gencfg) target_link_libraries(${PROJECT_NAME}_test ${catkin_LIBRARIES} ${OpenCV_LIBRARIES}) From 1198bc7923f3fac9501c76cffabac548370c5857 Mon Sep 17 00:00:00 2001 From: Ferenc Balint-Benczedi Date: Sun, 1 Mar 2020 20:10:29 +0100 Subject: [PATCH 3/4] added new lib to installation --- compressed_depth_image_transport/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compressed_depth_image_transport/CMakeLists.txt b/compressed_depth_image_transport/CMakeLists.txt index e1e4282..933c3bd 100644 --- a/compressed_depth_image_transport/CMakeLists.txt +++ b/compressed_depth_image_transport/CMakeLists.txt @@ -33,7 +33,7 @@ target_link_libraries(${PROJECT_NAME} ${PROJECT_NAME}_codecs ${catkin_LIBRARIES} class_loader_hide_library_symbols(${PROJECT_NAME}) -install(TARGETS ${PROJECT_NAME} +install(TARGETS ${PROJECT_NAME} ${PROJECT_NAME}_codecs ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} From b7385bca187385a39da9f9d29a4ab9ac0d4a935c Mon Sep 17 00:00:00 2001 From: Ferenc Balint-Benczedi Date: Sun, 1 Mar 2020 22:44:02 +0100 Subject: [PATCH 4/4] adding fallback option for compression format. --- compressed_depth_image_transport/src/codec.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/compressed_depth_image_transport/src/codec.cpp b/compressed_depth_image_transport/src/codec.cpp index 7ac9c2e..9c86896 100644 --- a/compressed_depth_image_transport/src/codec.cpp +++ b/compressed_depth_image_transport/src/codec.cpp @@ -76,12 +76,15 @@ sensor_msgs::Image::Ptr decodeCompressedDepthImage(const sensor_msgs::Compressed // Older version of compressed_depth_image_transport supports only png. if (split_pos == std::string::npos) { compression_format = "png"; - } else { + } + else { std::string format = message.format.substr(split_pos); - if (format.find("compressedDepth png") != std::string::npos) { - compression_format = "png"; - } else if (format.find("compressedDepth rvl") != std::string::npos) { + if (format.find("compressedDepth rvl") != std::string::npos) { compression_format = "rvl"; + } else if (format.find("compressedDepth png") != std::string::npos) { + compression_format = "png"; + } else if (format.find("compressedDepth") != std::string::npos) { + compression_format = "png"; } else { ROS_ERROR("Unsupported image format: %s", message.format.c_str()); return sensor_msgs::Image::Ptr();