Finishing Touches for Stereo DLP Usage: In the last post I detailed how to set up the Xorg.conf file for nVidia 3D vision in Ubuntu Linux with a Mitsubishi DLP TV and active shutter glasses. Because you cannot use overscan compensation correction during stereoscopic playback, you need to set overscan compensation to "0". This can cause the edges of your image to extend beyond the screen however, and make general system usage difficult.
To fix this, I made two scripts and put them in /usr/bin:
stereo_on: #!/bin/bash -i nvidia-settings -a OverscanCompensation=0 >> /dev/null 2>&1
stereo_off: !/bin/bash -i nvidia-settings -a OverscanCompensation=115 >> /dev/null 2>&1
With these scripts you can turn overscan compensation on and off with a simple command.
Linux Stereoscopic Video Player:
The only thing we were missing with our 3D setup was a stereoscopic video player. Luckily, the video player Bino was just released. It requires the newest version of the ffmpeg libraries, so I built them and then built bino. Here's my steps:
There are at least two ways to get VTK working in Ubuntu with Python wrapping. The first and easiest is to just install the packages with the Aptitude Package Manager:
sudo apt-get install libvtk5-dev python-vtk
Once you do that, you can run vtkpython and it just works. Unfortunately, the version of VTK in the packages for Ubuntu 10.04 is 5.2. That's a little out of date, and I needed a newer version. Here's how to install VTK 5.6 or newer with Python wrapping enabled:
That sets up your library and python paths for the vtkpython executable. To test this, you can run
brandt@amaterasu:~/work$ vtkpython vtk version 5.6.0 Python 2.6.5 (r265:79063, Apr 16 2010, 14:15:55) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from vtk import * >>> renderer = vtkRenderer() >>>
It is possible to interact with a dataset and generate a plot dynamically by probing the dataset. In VTK, you can do this with a few useful classes: vtkLineWidget, vtkSplineWidget, vtkProbeFilter, and vtkXYPlotActor.
Here is video of the dynamic plot in action:
It's impressive but simple. You can expand this capability by adding additional probes and using a spline instead of a line for probing, but to get the functionality you see in the video here's a python script.
The class interactionEvent will be used as a callback function for the lineWidget (or splineWidget):
#!/bin/python
from vtk import *;
#callbacks class interactionEvent(): def execute(self, obj, event): self.spline.GetPolyData(self.poly) self.probe.Update()
This just sets up the pipeline for reading in the dataset and all of the rendering window classes, etc...:
#Read in and set up dataset reader = vtkDataSetReader() reader.SetFileName("/Users/brandt/Work/pythonVTK/mummy.128.vtk") reader.ReadAllScalarsOn() reader.ReadAllVectorsOn() reader.Update()