leggedrobotics / darknet_ros

YOLO ROS: Real-Time Object Detection for ROS
BSD 3-Clause "New" or "Revised" License
2.19k stars 1.18k forks source link

Use encoding reported by camera driver #321

Closed kdhansen closed 3 years ago

kdhansen commented 3 years ago

I use a RealSense D455, which encodes the colors in RGB8 instead of BGR8. As the reported encoding string from sensor_msgs::Image is the same used in cv_bridge, this string can just be used.

I did not put a check in to keep the camera call back fast.

The strings from include/sensor_msgs/image_encodings.h that is also accepted by cv_bridge: "mono8" "bgr8" "bgra8" "rgb8" "rgba8" "mono16"

tomlankhorst commented 3 years ago

Thanks for your contribution. I'll check with my colleague.

mbjelonic commented 3 years ago

Looks great @kdhansen! Thanks

Wuxinxiaoshifu commented 2 years ago

I also meet this problem! when i training,the picture's format is rgb8. when i test the weights that i trained using bag,the colors of pictures in windows(yolo_v4) is different from my training pictures. i also changed BGR8 to RGB8 in YoloObjectDetector.CPP, but the colors in window(yolo_v4) didn't change! how did you handled this problem?