Ask Your Question
0

How to realize image processing with ROS and opencv

asked 2013-05-28 12:13:13 -0500

anthonyli gravatar image

updated 2013-05-28 12:14:34 -0500

Hello,

I try to realize image processing with ROS and opencv, and I follow the tutorial of cvBridge. Then I really want to know, whether it is true that we can only do the image processing in the callback function of subscribe message? Is there another way?

As for my experiment, I have realize the image processing with the camera on my PC, then I try to wotk with ROS image,however, there are always problems. So if there is other ways? I don't want to use the callback function to realize image processing.....

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2013-05-28 12:39:18 -0500

Bill Smart gravatar image

ROS is a callback-based system, so on that level, the answer is that you have to do all of the processing in the callback. You can, of course, work around this by using the callback to store the image somewhere, and the working on it later, or in another thread, or something like that.

What would help people answer your question, though, is an explanation of why you don't want to do the processing in the callback function. Without knowing what you want to do, it's hard to offer concrete advice.

edit flag offensive delete link more

Comments

In the other question it sounded like there were callback for user input as well as callbacks from the image message that were confusing the OP http://answers.ros.org/question/63595/ros-iamge-to-opencv-image-and-image-processing/?answer=63774#post-id-63774

SL Remy gravatar image SL Remy  ( 2013-05-28 13:30:56 -0500 )edit

Didn't see that bit. I can reopen the other question, if you think it's suitably distinct.

Bill Smart gravatar image Bill Smart  ( 2013-05-28 13:34:13 -0500 )edit

I think it's essentially the same question, just a little detail came out in the comments.

SL Remy gravatar image SL Remy  ( 2013-05-28 13:40:25 -0500 )edit

Thank you for your answer! In my program, I don't want to deal image processing each time receive a image and the image process for each frame maybe 100ms. So when I try the webcam, I grab the image when I want to use, now I am trying to do that with ROS… Thank you!

anthonyli gravatar image anthonyli  ( 2013-05-28 20:44:53 -0500 )edit

I am going to be crazy and so worry about my program. Compared with my program of webcam, there only difference in getting the image data. In order to say clearly, let me make an example. I try to draw several boxes in the window of image.

anthonyli gravatar image anthonyli  ( 2013-05-29 03:16:54 -0500 )edit

When I deal with webcam, I can draw several boxes in the window and name them: "0", "1", "2"...When I deal with ROS, I cam only draw the box "0" and suddenly it will disappear, then I draw again, it will show box "0" again and disapper again.It seems it will refresh. The problem it's like this way.

anthonyli gravatar image anthonyli  ( 2013-05-29 03:19:42 -0500 )edit

Hello Anthony, you can choose the rate at which the camera messages are published. You can also choose when you update the images that you're merging (I assume that you're using something like http://dasl.mem.drexel.edu/~noahKuntz/openCVTut2.html#Step%202)

SL Remy gravatar image SL Remy  ( 2013-05-29 05:21:10 -0500 )edit

I have tried several ways with it all the day, and I will try to set the loop_rate as you said! Moreover, if you'd like, you could see my code(http://www.zlzdesign.com/pet_drone.cpp) and help me to find the problem! Anyway, you really do me a favor! I will make effect to make it not refresh!

anthonyli gravatar image anthonyli  ( 2013-05-29 05:41:09 -0500 )edit
0

answered 2013-06-24 18:11:14 -0500

arronlee gravatar image

It seems that it is a little complicated to process images with ROS and opencv. I'm a green hand on this field. But as for myself, I used to process image with the help of a third party image processing SDK. It is just one of many but I do appreciate its simple way of processing. Even though I only tried its free trial package and didn′t check the cost and licensing conditions, it works great for me. Share with you. I hope you success.

Best regards, Arron

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-05-28 12:13:13 -0500

Seen: 1,288 times

Last updated: Jun 24 '13