Ask Your Question

ROS camera snapshot save as jpg

asked 2012-09-07 15:41:37 -0500

ncr7 gravatar image

I'm working to detect circles using cv.houghcirles, which I have working... but as soon as the camera moves cv.houghcircles crashes. So my next plan was to take snap shots and save the images run cv.houghcircles on the images to get point location back.

So long story short, I need a way to save a ROS gazebo camera as a jpg, bmp, etc.

any help would be greatly appreciated!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-09-07 18:41:56 -0500

ncr7 gravatar image

Ah... I was hoping to find something to create it automatically through code. I think there might be a way in by using cv.EncodeImage, but I haven't been able to get the code working the way I want yet. Found an example used here

As for my OpenCV circle problem, I was able to get cv.HoughCircles to work without crashing... basically by just drawing a circle in a corner of the ROS camera and making sure the camera feed was not moving to fast for opencv by using rospy.sleep(1.0), I posted the code here... might be useful for anyone using a camera feed in ROS and opencv.

    cv_image = self.convert_image(data)
    cv.Circle(cv_image, (100,100), 100, 255, 3, 8, 0)
    gray = cv.CreateImage(cv.GetSize(cv_image), 8, 1)
    #edges = cv.CreateImage(cv.GetSize(cv_image), 8, 1)
    cvSize = cv.GetSize(cv_image)
    cv.CvtColor(cv_image, gray, cv.CV_BGR2GRAY)
    cv.Canny(gray, gray, 50, 200, 3)
    cv.Smooth(gray, gray, cv.CV_GAUSSIAN, 7, 7)

    storage = cv.CreateMat(cv_image.rows, 1, cv.CV_32FC3)

    cv.HoughCircles(gray, storage, cv.CV_HOUGH_GRADIENT, 2, cvSize[0]/4, 100, 250)
edit flag offensive delete link more

answered 2012-09-07 17:44:15 -0500

joq gravatar image

The image_view package will save a JPG file each time you click on the viewing window.

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


Asked: 2012-09-07 15:41:37 -0500

Seen: 546 times

Last updated: Sep 07 '12