WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-29-2006, 03:58 PM
pbeeson pbeeson is offline
Member
 
Join Date: Aug 2006
Posts: 31
Grabbing screen shots (but not to file)

I would like to be able to capture the current screen to a python object of some sort (list, string, I don't really care). Is this possilbe in Vizard, or can I only dump to .BMP files?

I can install PIL then open and read in the BMP file, but reading the file it not optimal as it may begin before the file writing ends (plus it involves using another third-party software along with Vizard). It would be much nicer if it could be done within Vizard.

---------

If this is not possible, any suggestions on how to quickly get the screen buffer would be appreciated.

Last edited by pbeeson; 08-29-2006 at 04:11 PM.
Reply With Quote
  #2  
Old 08-29-2006, 06:48 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
There is no command that will return the raw data of the screen capture. Capturing to a file and reading the file is probably the easiest solution. Do you need this for real-time use?

When you issue the viz.screencapture command the file is not created immediately. It is created at the end of the next frame. So when you issue the command wait until the next frame before reading the file.
Reply With Quote
  #3  
Old 08-29-2006, 09:10 PM
pbeeson pbeeson is offline
Member
 
Join Date: Aug 2006
Posts: 31
It would be nice to get this in real-time. I thought it might be possible to install pyopengl and grab the screen buffer, but I'm not sure exactly how to tell the python OpenGl code which OpenGL buffer it should care about. Does Vizard store the ID of the OpenGl window it opens?

This is mostly just for displaying the Vizard display on a linux machine that is running software that interacts with Vizard via an xmlrpc server I set up (using Vizard as a robot simulation environment). I'm thinking the easiest thing might just be to run a vncserver in Windows and view the Windows desktop in Linuz through a vnc-client, but it would have been nice to send the Vizard screen buffer (as a string) through the xmlrpc interface.
----------
Any more suggestions are welcome.

BTW, I'm new to Vizard, so where can I report bugs?
Reply With Quote
  #4  
Old 08-29-2006, 09:56 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You want to stream the frame buffer uncompressed at 60 hz? What window size are you running in?

Quote:
Does Vizard store the ID of the OpenGl window it opens?
There is no built-in way to get the OpenGL ID from Vizard.

A plugin could be made to capture the screen contents of the graphics window and return it as a string in python. If you are using Vizard 3.0 then I could create this plugin for you.

Quote:
BTW, I'm new to Vizard, so where can I report bugs?
You can report bugs on the forum.
Reply With Quote
  #5  
Old 08-30-2006, 08:29 AM
pbeeson pbeeson is offline
Member
 
Join Date: Aug 2006
Posts: 31
Thumbs up

Quote:
Originally Posted by farshizzo
You want to stream the frame buffer uncompressed at 60 hz? What window size are you running in?
Once I have the (630x480) buffer, I can always run it through libz or something to get out a compressed string, then unpack it on the other end of the socket I'll post it on. Plus, 20-30 Hz will probably be good enough to get a sense of what the agent sees (to compare with the metrical and symbolic maps that our research software creates---using the "virtual robot sensors" I built for the Vizard agent).

Quote:
Originally Posted by farshizzo
A plugin could be made to capture the screen contents of the graphics window and return it as a string in python. If you are using Vizard 3.0 then I could create this plugin for you.
That would be extrememly helpful. I am not familiar with programming in Windows (in fact the machine I'm using doesn't even have Visual Studio), so unless its something I could do in python with minimal knowledge of Vizard or OpenGL, it would be best to have someone else write this for me.

Unfortunately, I'm running Vizard 2.53g. Is that a deal breaker? Regardless, I'll contact support to beta test v3.0, but I'll have to ask my employer about his plans to upgrade our Vizard purchase an upgrade to v3 when it comes out. Let me know.

Last edited by pbeeson; 08-30-2006 at 08:55 AM.
Reply With Quote
  #6  
Old 08-30-2006, 02:49 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Quote:
Unfortunately, I'm running Vizard 2.53g. Is that a deal breaker? Regardless, I'll contact support to beta test v3.0, but I'll have to ask my employer about his plans to upgrade our Vizard purchase an upgrade to v3 when it comes out. Let me know.
It should be possible to create this plugin for 2.5 as well. If you plan on signing up for the beta release then I would prefer to make it for 3.0.
Reply With Quote
  #7  
Old 08-30-2006, 03:55 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I just finished implementing the plugin for 3.0. Here are some notes about the plugin:

- It grabs the screen buffer directly from windows, not OpenGL. The benefit is that it can capture a little faster and it can run in a separate thread.

- The image is in raw BGR format.

- The image is inverted vertically because in Windows the origin of an image is the top left corner.

I've attached a zip file which contains the plugin and an example file. Again, this will only work with Vizard 3.0
Attached Files
File Type: zip VizardScreenCapturePlugin.zip (3.0 KB, 1858 views)
Reply With Quote
  #8  
Old 08-30-2006, 04:29 PM
pbeeson pbeeson is offline
Member
 
Join Date: Aug 2006
Posts: 31
Thanks a million. Although I definately plan to beta test v3.0, would it be selfish for me to request a plugin for 2.5 as well ?

I'm assuming of course that it is similar is strucutre, so that I won't steal too much of your time. But, we are trying to get a pilot experiment up and running in a VERY short period, so keeping with Vizard 2.5 for the next few weeks might be the best bet.

Again, thanks. And if this is asking too much, please let me know, and I'll make due.

Last edited by pbeeson; 08-30-2006 at 04:32 PM.
Reply With Quote
  #9  
Old 08-30-2006, 05:42 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a version of the plugin that should work with Vizard 2.53g. Let me know if it doesn't suite your needs.
Attached Files
File Type: zip Vizard25_ScreenCapturePlugin.zip (3.0 KB, 1879 views)
Reply With Quote
  #10  
Old 08-30-2006, 07:14 PM
pbeeson pbeeson is offline
Member
 
Join Date: Aug 2006
Posts: 31
Thumbs up

This is perfect. Works great. Thanks for all your help.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 09:16 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC