WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Plug-in development (https://forum.worldviz.com/forumdisplay.php?f=8)
-   -   Video Stream plugin (https://forum.worldviz.com/showthread.php?t=2159)

Brett Lindberg 07-15-2009 01:15 PM

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?

farshizzo 07-16-2009 10:19 AM

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.

Brett Lindberg 08-13-2009 03:46 PM

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?

farshizzo 08-13-2009 04:40 PM

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?

Brett Lindberg 08-13-2009 05:59 PM

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?

farshizzo 08-18-2009 09:21 AM

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.

Brett Lindberg 08-18-2009 02:59 PM

Is there an example for the texture.setImageData command?
More precisely, how would you specify the buffer in the "data" parameter?

farshizzo 08-18-2009 03:06 PM

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.


All times are GMT -7. The time now is 08:34 AM.

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