Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codecs in compressed_depth_image_transport as standalone library #50

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions compressed_depth_image_transport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,27 @@ 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}

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}
Expand All @@ -43,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})

Expand Down
11 changes: 7 additions & 4 deletions compressed_depth_image_transport/src/codec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down