This blog entry was posted by peter on July 15, 2008.
It is tagged with InstantPlayer, instantreality, music, Python, and X3D.
So far there are 0 comments. Feel free to add one.
The previous entry chronologically is A “resizable” plugin for WYMeditor.
An updated and renamed version of the script can now be found on GoogleCode:
http://code.google.com/p/hoc-csv2x3d/
Here’s a little Python script for converting Radiohead’s 3D laser data into an X3D file. The script creates an animated X3D version of the video data, which can be explored in realtime using the InstantPlayer framework.
The script was initially developed by Michael Zöllner and optimized by me. Head over to Michael’s i.document for some images and videos showing the converted data on the new Fraunhofer IGD heyewall 2.0.
Currently the script is generating non-X3D-conform code which will only work in the InstantPlayer. I will provide a version which generates X3D-conform code to be viewed in other X3D browsers next week.
The script must be run two times (two-passes). The first pass will convert the csv files to separate X3D files (stored in the specified target dir).
The second pass will generate an X3D file which inlines the generated data files and drives the animation.
The script provides several options to customize the conversion process. You can display the available options like so:
1 | python radiohead2X3D.py -h |
This will show the following usage text:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | usage:radiohead2X3D.py [options]
Convert Radiohead csv data to X3D.
options:
-h, —help
show this help message and exit
-d DATA_DIR, —dir=DATA_DIR
The directory containing the original csv data files.
-x TARGET_DIR, —targetdir=TARGET_DIR
The target directory containing the converted X3D files.
-s START_FRAME, —startframe=START_FRAME
The index of the frame to start with.
-e END_FRAME, —endframe=END_FRAME
The index of the frame to end with.
-f INTENSITY_SIZEFACTOR, —sizefactor=INTENSITY_SIZEFACTOR
intensity value (4th parameter) is multiplied by this (for scaling).
-b, —binary
When given the inline files will be written as x3db (binary files).
Requires aopt tool from instantReality.
-g, —globalfile
When given the main file containing the inlines will be
created (using frames between STARTFRAME and
ENDFRAME reading from DATA_DIR writing to TARGET_DIR).
|
You can specify the DATA_DIR, TARGET_DIR as well as the START_FRAME and END_FRAME.
E.g. to convert the first twenty csv files, use the script like this:
1 | ./radiohead2X3D.py -d csv -x x3d -s 1 -e 20 |
This will convert the first twenty csv files in the csv directory and generate twenty X3D files in the subdirectory x3d.
To convert all csv files, use the script like this:
1 | ./radiohead2X3D.py -d csv -x x3d -s 1 -e 2101 |
But be warned! This will generate about 900MB of data on your harddrive.
Now you can generate a main X3D file like so (mind the -g option):
1 | ./radiohead2X3D.py -d csv -x x3d -s 1 -e 20 -g |
That’s it. You can now view the converted data using InstantPlayer to start the generated main.x3d file:
1 | InstantPlayer main.x3d |
The Python script is released under the new BSD license.
There are no comments yet.