how to get rgb value from sensor_msgs/image
hello, i need to use rgb value from /camera/color/image_raw topic. i want to know how to get rgb value from this topic. thank you for answer
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
hello, i need to use rgb value from /camera/color/image_raw topic. i want to know how to get rgb value from this topic. thank you for answer
Hi, First you might need to convert the image from ros message image to open cv image using cv_bridge, then use the available functions of Opencv to read color values, like
cv:: Mat image ;
Point3_<uchar>* p =image.ptr< Point3_<uchar> > (y,x);
p->x //B
p->y //R
p->z //G
and probably you can find other methods here
the last question what is a y and x in p =image.ptr< Point3_<uchar> > (y,x) ? width and and height right ?
Asked: 2019-02-07 21:46:34 -0600
Seen: 1,757 times
Last updated: Feb 08 '19