how to subscribe to usb_cam/image_raw to process the image from camera?
what is missing in the below code that is used for subscribing to the topic /usb_cam/image_raw.
void chatterCallback(const std_msgs::String::ConstPtr& msg)
{
ROS_INFO("I heard: [%s]", msg->data.c_str());
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "main");
ros::NodeHandle n;
std::cout<<"Subscribing starts!"<<std::endl;
ros::Subscriber sub = n.subscribe("usb_cam/image_raw", 2, chatterCallback);
ros::spin();
return 0;
}
how to get the image from the camera so that i need to process this image. Is there any files missing in the header.
~/usb_cam/launch$ rostopic info /usb_cam/image_raw
Type: std_msgs/String
Publishers: None
Subscribers:
* /listener (http://ubuntu:42711/)
* /main (http://ubuntu:35605/)