Commit 82ab4e22 authored by Barcis, Michal's avatar Barcis, Michal
Browse files

proper frame numbers

parent 3a09dbb4
...@@ -77,7 +77,7 @@ void adapt( ...@@ -77,7 +77,7 @@ void adapt(
size_t* adapted_width, size_t* adapted_width,
size_t* adapted_height) size_t* adapted_height)
{ {
*rate_adaptation = 0.2; *rate_adaptation = 0.1;
if(factor >= 1) { if(factor >= 1) {
*adapted_width = 640; *adapted_width = 640;
*adapted_height = 480; *adapted_height = 480;
...@@ -205,6 +205,7 @@ int main(int argc, char * argv[]) ...@@ -205,6 +205,7 @@ int main(int argc, char * argv[])
msg->is_bigendian = false; msg->is_bigendian = false;
size_t i = 1; size_t i = 1;
size_t frame_id = 1;
double rate_adaptation; double rate_adaptation;
size_t adapted_width; size_t adapted_width;
size_t adapted_height; size_t adapted_height;
...@@ -236,7 +237,7 @@ int main(int argc, char * argv[]) ...@@ -236,7 +237,7 @@ int main(int argc, char * argv[])
if (!frame.empty()) { if (!frame.empty()) {
// Convert to a ROS image // Convert to a ROS image
if (!is_flipped) { if (!is_flipped) {
convert_frame_to_message(frame, i, msg); convert_frame_to_message(frame, frame_id, msg);
} else { } else {
// Flip the frame if needed // Flip the frame if needed
cv::flip(frame, flipped_frame, 1); cv::flip(frame, flipped_frame, 1);
...@@ -253,8 +254,9 @@ int main(int argc, char * argv[]) ...@@ -253,8 +254,9 @@ int main(int argc, char * argv[])
} }
// Publish the image message and increment the frame_id. // Publish the image message and increment the frame_id.
if(i%(int)(1/rate_adaptation) == 0) { if(i%(int)(1/rate_adaptation) == 0) {
RCLCPP_DEBUG(node_logger, "Publishing image #%zd", i) RCLCPP_INFO(node_logger, "Publishing image #%zd", frame_id)
pub->publish(msg); pub->publish(msg);
++frame_id;
}else{ }else{
RCLCPP_DEBUG(node_logger, "Skipping image #%zd", i) RCLCPP_DEBUG(node_logger, "Skipping image #%zd", i)
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment