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:
I finally got our 3D setup in the lab working with Ubuntu Linux. Using nVidia's 3D Vision glasses and emitter, we are able to visualize data in 3D, view movies, and play video games ;-) Until now, we've been using Windows 7 and it has been an extremely buggy experience. We've seen the BSOD, lockups, and the 3D just not working. Now that is works in Linux, I think we can kiss the instability goodbye.
nVidia officially supported the Mitsubishi line of DLP TV's in a recent driver release: 256.35. Here is nVidia's list of supported devices. We've got an 82" DLP TV in the lab. You'll need a Quadro graphics card to do Quad-Buffered Stereo in Linux (and Windows).
To get 3D working, you'll need to install the latest nVidia Quadro driver. For a DLP display, you will plug the VESA connector into the back of the TV. The USB plugs into the computer.
The first thing you will have to do is disable compositing and make sure you have no over-scan compensation set for the 3D to work. Here's my xorg.conf file for reference:
# nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 256.53 (buildmeister@builder97.nvidia.com) Fri Aug 27 20:55:22 PDT 2010
You'll notice the Option for disabling compositing at the bottom. If you do this, it should work. I'll be updating this post when I get the correct DPI settings and see if I can correct the over-scan issues that seem to be a problem in DLP displays. If you have any problems you can look in your xorg.log file in /var/log. You will have to turn log verbosity to 6 to see modeline information for your TV.
Recently on Stack Overflow, there was a post about how to do file handling and input and output in any language. I thought it was an interesting post even though it was closed for not following Stack Overflow's objective of a simple Q/A site. Here's a link to the post, which includes a LOLCODE example as well for File I/O:
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() >>>
The grep makes sure only files that contain the old string are looked at by the perl script, that way you don't waste execution time - important on really large directory trees.
For whatever reason, sometimes debugging a program on a unix system requires more than just gdb. I came across two tools recently that can be used for more advanced debugging. strace and it's brother ltrace are applications that will trace system calls during runtime. This means that they will trace the interaction between the process and the system. ltrace is the more featured of the two because it has the ability to trace dynamic library calls. Common usage can be seen in this example, below:
You can see both system calls and library calls in this example. You'll notice I piped the output to grep to search for a specific call. The "-S" option allow you to trace system calls, making ltrace's functionality a superset of strace's. In addition, the flag "-f" causes ltrace to also follow any child processes the main process may create.
One big difference between the two is that ltrace does not currently support multi-threaded applications because the kernel will send a SIGTRAP command to a traced process, causing premature termination. strace does work with multi-threaded applications, however. See this link for more info.
These trace applications can be very useful for finding out exactly what the code is doing at the system level, and can you you better understand how the code really works. By searching the net it seems that it is very useful for hackers and crackers and reverse engineering as well!
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()