#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
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. |
#3
|
|||
|
|||
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?
|
#4
|
|||
|
|||
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?
|
#5
|
|||
|
|||
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?
|
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
Is there an example for the texture.setImageData command?
More precisely, how would you specify the buffer in the "data" parameter? |
#8
|
|||
|
|||
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.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating a Vizard Sensor Plugin | farshizzo | Plug-in development | 25 | 08-01-2019 01:24 AM |
video help | nasr | Vizard | 2 | 05-26-2009 12:42 PM |
Howto debug a custom plugin? | reedev | Plug-in development | 3 | 04-23-2009 03:16 PM |
lat long mapped video | Brett Lindberg | Vizard | 3 | 02-25-2009 08:41 PM |
Could not find plugin to load objects... | halley | Vizard | 1 | 05-30-2006 12:01 PM |