how to get stageros GUI image??

asked 2020-10-13 00:55:07 -0500

Hi! I want to modify this github repository.

I want to make Deep RL model for mobile robot's action.

the network's input is GUI screenshot and output is each robot's direction and velocity

I can get the image file using GUI menu bar but I don't know how to get screenshot image or any image message in Python code.

help me..

edit retag flag offensive close merge delete


This is not dependent with ros but of course you can save screenshot with python. There are many lib for this process but you can use with this code

import gtk.gdk

w = gtk.gdk.get_default_root_window()
sz = w.get_size()
print "The size of the window is %d x %d" % sz
pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,False,8,sz[0],sz[1])
pb = pb.get_from_drawable(w,w.get_colormap(),0,0,0,0,sz[0],sz[1])
if (pb != None):"screenshot.png","png")
    print "Screenshot saved to screenshot.png."
    print "Unable to get the screenshot."
bekirbostanci gravatar image bekirbostanci  ( 2020-10-19 15:29:09 -0500 )edit