Lyrical support.
This commit is contained in:
parent
2ba0f2e9f6
commit
7eda1b11f7
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(image2rtsp)
|
||||
|
||||
# Default to C99
|
||||
|
|
@ -34,7 +34,10 @@ include_directories(${OpenCV_INCLUDE_DIRS})
|
|||
file(GLOB SOURCES src/video.cpp)
|
||||
|
||||
add_executable(image2rtsp src/image2rtsp.cpp ${SOURCES})
|
||||
ament_target_dependencies(image2rtsp rclcpp sensor_msgs)
|
||||
target_link_libraries(image2rtsp
|
||||
rclcpp::rclcpp
|
||||
${sensor_msgs_TARGETS}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${GST_INCLUDE_DIRS}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void Image2rtsp::topic_callback(const sensor_msgs::msg::Image::SharedPtr msg){
|
|||
void Image2rtsp::compressed_topic_callback(const sensor_msgs::msg::CompressedImage::SharedPtr msg){
|
||||
if (appsrc == NULL) return;
|
||||
// Decompress the image
|
||||
cv::Mat img = cv::imdecode(cv::Mat(msg->data), cv::IMREAD_UNCHANGED);
|
||||
cv::Mat img = cv::imdecode(cv::Mat(msg->data.to_vector()), cv::IMREAD_UNCHANGED);
|
||||
if (img.empty()) {
|
||||
RCLCPP_ERROR(this->get_logger(), "Failed to decompress image");
|
||||
return;
|
||||
|
|
@ -207,4 +207,4 @@ void Image2rtsp::compressed_topic_callback(const sensor_msgs::msg::CompressedIma
|
|||
|
||||
// Push the buffer to GStreamer
|
||||
gst_app_src_push_buffer(appsrc, buf);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue