WorldViz User Forum  

Go Back   WorldViz User Forum > Plug-in development

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 07-15-2009, 01:15 PM
Brett Lindberg Brett Lindberg is offline
Member
 
Join Date: Jul 2008
Posts: 18
Video Stream plugin

Does anyone have an example of how to write a plugin to read a camera (say, a webcam): I know it's already in Vizard, but I want to add a different camera.

And is this a sensor, image generator, python plugin, or custom node?
Reply With Quote
  #2  
Old 07-16-2009, 10:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The Vizard SDK comes with an image generator plugin example. It simply generates random RGB data and puts it into a texture. You could use that example and use the image data coming from the camera instead of generating it randomly.

To create a plugin you will need to be familiar with OpenSceneGraph and OpenGL.

An alternative is to create a blank texture and feed the image data into the texture using the texture.setImageData command. This can be all done within the Python script, without needing to write a plugin.
Reply With Quote
  #3  
Old 08-13-2009, 03:46 PM
Brett Lindberg Brett Lindberg is offline
Member
 
Join Date: Jul 2008
Posts: 18
I'm trying to do the second method: is there an easy way to determine the location of the image data, say a buffer in jpg format?
Reply With Quote
  #4  
Old 08-13-2009, 04:40 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Do you mean accessing the image data of a Vizard texture? If so, you can use the texture.getImageData command to get the raw RGB buffer of a texture. If not, can you be more clear about what exactly you want to do?
Reply With Quote
  #5  
Old 08-13-2009, 05:59 PM
Brett Lindberg Brett Lindberg is offline
Member
 
Join Date: Jul 2008
Posts: 18
After some looking, I think I'm trying to set the image data of a texture to the contents of an OpenGL ARB_pixel_buffer_object. Can that be done using PyOpenGL?
Reply With Quote
  #6  
Old 08-18-2009, 09:21 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Is the PBO created within the Vizard OpenGL context or a separate context? Either way, it seems inefficient to download the data from a PBO and copy it into a texture then upload it back to the graphics card. Ideally you would want to get direct access to the video source and copy it into the Vizard texture.

Does the video camera provide some sort of API for accessing the data? If so you could create a Python extension that accesses the data and returns it to your script. From there you could use the texture.setImageData command.
Reply With Quote
  #7  
Old 08-18-2009, 02:59 PM
Brett Lindberg Brett Lindberg is offline
Member
 
Join Date: Jul 2008
Posts: 18
Is there an example for the texture.setImageData command?
More precisely, how would you specify the buffer in the "data" parameter?
Reply With Quote
  #8  
Old 08-18-2009, 03:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
This knowledge base article describes how to convert a Python Imaging Library image to a Vizard texture. The concept is pretty much the same. The data parameter needs to be a string or buffer object that contains the raw image data.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Vizard Sensor Plugin farshizzo Plug-in development 24 04-18-2013 04:45 AM
video help nasr Vizard 2 05-26-2009 11:42 AM
Howto debug a custom plugin? reedev Plug-in development 3 04-23-2009 02:16 PM
lat long mapped video Brett Lindberg Vizard 3 02-25-2009 07:41 PM
Could not find plugin to load objects... halley Vizard 1 05-30-2006 11:01 AM


All times are GMT -7. The time now is 04:43 AM.


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