Ask Your Question
0

Getting webcam images using ROS and openCV in python

asked 2013-09-17 10:31:20 -0600

u_will_neva_no gravatar image

updated 2013-09-17 13:22:54 -0600

berak gravatar image

Hi everyone, I am able to get webcam images using ROS and openCV and manipulate the image using C++ however I want to achieve the same for python.

I am using cv_bridge to convert images from ROS to openCV and vice versa so I looked at the code from the tutorials. I want to convert the following C++ code into python:

int main(int argc, char** argv)
{
ros::init(argc, argv, "image_converter");
ros::NodeHandle nh;
image_transport::ImageTransport it(nh);
cv::namedWindow(WINDOW, CV_WINDOW_AUTOSIZE);
image_transport::Subscriber sub = it.subscribe("camera/image_raw", 1, imageCb);
cv::destroyWindow(WINDOW);
image_pub_ = it.advertise("camera/image_processed", 1);
ros::spin();

return 0;
}

I am trying to get the camera feed from my webcam and also publish this over ROS. I have achieved this using C++ but want to do the same all in python. I learnt this from: link:text

I am converting between ROS and openCV images using the cv_bridge. This is using cv and not cv2. If anyone has a tutorial on doing this for cv2 do let me know.

Thanks :)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-11-26 08:19:05 -0600

did you get any answer or solution ??? if yes then plx send let me know

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-09-17 10:31:20 -0600

Seen: 4,039 times

Last updated: Nov 26 '14