SIV – a stereoscopic jps viewer for Linux
As promised in JPS-viewer for linux, here comes the very first release of SIV, the first available Stereoscopic Image Viewer for Linux supporting quad buffered stereo. Well this is not 100% correct, since it is build upon OpenSceneGraph it is somewhat platform independant and schould compile well on windows, mac and unix platforms. However, I only tried with linux since there are enough alternatives available for most other platforms.
SIV is capable of displaying jps stereo images in different stereo modes. I tried it in fullscreen/windowed mode with anaglyphic and quad buffered stereo mode. Different output devices I tested were my Vuzix VR920 and relevator shutter glasses on Nvidia Quadro FX 350M and FX 3400. It still lacks some convenience functions like a diashow mode.
Screenshot of the viewer as window in anaglyphic mode:
A note about the name SIV, SIV stands for Stereoscopic Image Viewer, but as I found out Siv is also the name of the wife of the god Thor in the norse mythology. See: Wikipedia: Sif and Behindthename: Siv. Sif and Siv are the same name, both writings are possible. Once I found out this, I thought that’s a cool name for this piece of work.
Usage:
./siv [options] jpsfile(s)
Options:
–CullDrawThreadPerContext Select CullDrawThreadPerContext
threading model for viewer.
–CullThreadPerCameraDrawThreadPerContext Select
CullThreadPerCameraDrawThreadPerCo-
ntext threading model for viewer.
–DrawThreadPerContext Select DrawThreadPerContext
threading model for viewer.
–SingleThreaded Select SingleThreaded threading
model for viewer.
–accum-rgb Request a rgb accumulator buffer
visual
–accum-rgba Request a rgb accumulator buffer
visual
–cc Request use of compile contexts and
threads
–clear-color <color> Set the background color of the
viewer in the form “r,g,b[,a]”.
–display <type> MONITOR | POWERWALL |
REALITY_CENTER |
HEAD_MOUNTED_DISPLAY
–rgba Request a RGBA color buffer visual
–samples <num> Request a multisample visual
–screen <num> Set the screen to use when multiple
screens are present.
–serialize-draw <mode> OFF | ON – set the serialization of
draw dispatch
–stencil Request a stencil buffer visual
–stereo Use default stereo mode which is
ANAGLYPHIC if not overriden by
environmental variable
–stereo <mode> ANAGLYPHIC | QUAD_BUFFER |
HORIZONTAL_SPLIT | VERTICAL_SPLIT |
LEFT_EYE | RIGHT_EYE |
HORIZONTAL_INTERLACE |
VERTICAL_INTERLACE | CHECKERBOARD |
ON | OFF
–window <x y w h> Set the position (x,y) and size
(w,h) of the viewer window.
-O <option_string> Provide an option string to
reader/writers used to load
databases
-e <extension> Load the plugin associated with
handling files with specified
extension
-h or –help Display this information
-l <library> Load the plugin
You may notice that most of the options come from osgViewer, which is the base class for the viewer. This gives the advantage, that one can use the “normal” osgViewer controls such as flying around the scene. Try holding the right mouse button and moving the mouse up or down for zooming out or in. Or press F for toggling fullscreen mode or press S for toggling the stats (fps, etc.) display.
You may supply multiple .jps files at the command line. I.e. ./siv *.jps will display all jps files in the current folder 😉
Once the first image of the list is being displayed you may use CURSOR_UP/DOWN or the mouse wheel to select a different image for being displayed. In future versions I may implement a diashow function…
When displaying an image the filename of the image is displayed in the lower left corner.
You can find some jps images for trying out the viewer on: Stereo Images From Juneau.
Possible Problems:
As default SIF starts in fullscreen quad buffered stereo mode. Thus if your graphics hardware does not support this mode, the viewer will exit with the following error:
Error: Not able to create requested visual.
GraphicsWindow has not been created successfully.
Viewer::realize() – failed to set up any windows
In this case try anaglyphic mode or the apropiate 3D mode for your hardware (see the –stereo option).
You may experience the application segfaulting. Most possibly the reason is that your OpenSceneGraph lacks the library osgdb_jp2.so in the lib/osgPlugins folder. If you strace the application and the last thing it tries before segfaulting is to access osgdb_jp2.so, this is the reason. The Problem will be corrected in the next version of SIV. For now install Jasper and rebuild OpenSceneGraph.
Do not download these files anymore unless you explicitely want this version. New version is available at: SIV-1.0 released
I decided to publish the viewer under the creative common noncommercial license. Make sure you have the OpenScenegraph library installed before trying to compile or run the viewer. You may download the full source (Eclipse Project) from here: [download#5] or an x86_64 binary from here: [download#6]. More binary formats may be available in the future. Fore the x86_64 binary you’ll need OpenSceneGraph-2.8.
Binaries for most linux distributions can be downloaded from www.openscenegraph.org. Instructions on how to build OpenSceneGraph on gentoo can be found on PlopByte.
Building from source:
For building from source unpack the zip and cd to siv/Release and run make.
Future plans:
For the future I’d like to implement a diashow function and to integrate the VR920 headtracking into the viewer. It would be really cool to view a sea panorama image in 3D by turning the head This is the reason why the image is not being displayed plain, but on a cylinder segment. For the tracking I’ll have to write a driver for the VR920 headtracking first, to get the camera viewmatrix for the viewer. Since in Vuzix Forums I found a non working driver, from which I was able to learn how to read the sensor data, I only have to implement the neccesary calculations and calibration methods.
Well, I hope you enjoy the 3rd dimension. If you like the viewer feel free to link to MyGNU.de.
Stay tuned for updates
Jürgen
March 19th, 2009 at 7:46 pm
[…] the future I plan to extend the jps viewer I published in SIV – a stereoscopic jps viewer for Linux to use the tracking data from the driver, so one can look around the scene by turning his […]
April 6th, 2009 at 2:01 am
[…] proud to present a new version of SIV, the stereoscopic jps viewer for Linux I published first in SIV – a stereoscopic jps viewer for Linux. SIV is capable of displaying jps stereo images in different stereo modes. I tried it in […]
April 27th, 2009 at 6:11 pm
Merci de votre aide !
July 7th, 2009 at 10:26 am
Hello,
thank you for siv. On so what I am waiting for a long time.
But please also integrate black-white-anaglyphs and halbfarb-anaglyphs. Full color anaglyphs are the worst variant. As an example, I recommend the images on the http://www.bilder-der-dritten-dimension.de
Please compare the different types of anaglyphs.
Thanks.
July 7th, 2009 at 10:54 am
Hallo mohikaner,
did you experience any problems in getting siv to run? Which version did you use on which distribution?
I think I can add a commandline parameter to set the color for the left and the right eye. What do you mean with “black-white-anaglyphs”? Black-white images should be no problem, or do you expect siv to convert colour images to black-white? What are halbfarb-anaglyphs?
regards
Jürgen
July 7th, 2009 at 10:43 pm
Hello Jürgen,
black-white-anaglyphs are pure red-cyan-anaglyph, without further colors. With an anaglyph-glasses, the images appear in black white. I expect of ‘siv’ no conversion but ‘siv’ could the images accordingly present.
“halbfarb-Anaglyphen” = “half-color-anaglyphs” (Sorry)
————————————————–
Hallo Jürgen,
schwarz-weis Anaglyphen sind reine rot-cyan Anaglyphen ohne weitere Farbanteile. Mit einer Anaglyphen-Brille betrachtet erscheinen die Bilder schwarz-weis. Ich erwarte von ‘siv’ keine Konvertierung aber ‘siv’ könnte die Bilder entsprechend darstellen.
mohikaner
July 9th, 2009 at 7:22 am
I’ll see what I can do in V1.1.
regards
Jürgen
August 10th, 2009 at 11:22 am
Hey, das ist ein interessantes Projekt. Die Idee an sich ist auch sehr gut… weitermachen
January 7th, 2010 at 12:16 am
Hi,Jürgen,
I just wonder if functions such as bright/contrast adjustment, zoom and pan are available within Siv.
If not, is it easy to add those functions in?
Thanks!
best,
Qian
January 7th, 2010 at 8:32 pm
Hi,
zoom is available with the mouse (right click and move the mouse up and down) or with the distance switch at the command line. Try siv –help to see all commandline switches. Brightness/contrast adjustment shouldn´t be much of a problem. I´ll put this onto the list for the next version. What should a pan function do?
Jürgen
January 7th, 2010 at 11:14 pm
Thanks, Jürgen,
To pan is to drag and drop the image. Just to move it around.
I just wonder when will the next version available.
Also, any suggestion for compiling SIV for windows platform?
Thanks!
best,
Qian
January 8th, 2010 at 3:02 pm
Hi,
you can move the image around using the mouse. Try holding the different mouse buttons and move the mouse around. You may select different mouse behaviour using the keys 1 to 5 when the –vr920 switch is given, else you can use the keys 1 to 4. Trackball mode seems to be the most useful for me (press 2 to use it when in vr920 mode, you may return to headtracking mode pressing 1) When in vr920 mode you can move the image around by moving your head, but this requires my headtracking driver running and of course a vr920 HMD attached. When not in vr920 mode, the trackball behaviour is default.
Compiling siv on another platform (windows, OSX) should work more or less out of the box. For more information on this see http://www.openscenegraph.org and http://www.macs.hw.ac.uk/modules/F24VS2/Labs/OpenSceneGraphTutorial.pdf .
Jürgen
January 10th, 2010 at 3:01 am
Thankyou for the great post – I loved reading it! I always enjoy this blog. 🙂
February 16th, 2010 at 6:28 am
Hi, Jürgen,
When compiling SIV on Windows with Visual Studio 2005 and OSG-2.8.2, I got an error message like:
Unhandled exception at 0x00692498 in siv.exe:0xc0000005: access violation reading location 0x00133000
and the error was pointed to the line:
“text->setText(“Default Text”);”
in osd.cpp
Would you please tell me any hint about this problem and possible solution?
Thanks!
best,
Qian
February 16th, 2010 at 7:36 pm
Hi Qian,
you can try to debug. Set a breakpoint at the settext line and check if the text variable contains a valid reference, but normally it should…
You could try to remove that line, it is not important, but then I suspect the problem will occur later.
Please also try to build another osg program, for example the osgtext example. If this works, compare the build settings with the ones you set for siv.
Jürgen
February 26th, 2010 at 5:26 pm
Thanks, Jürgen
This problem has been solved by resetting the build setting.
I want to add Brightness and contrast adjustment, they are not available currently in osgviewer or the jp2 plugin. Any hints to do it? thanks!
Qian
March 7th, 2010 at 1:08 pm
Hi Qian,
in my opinion the most elegant way to perform this is to use a custom pixel shader, since then the GPU will do the work. Of course you could also loop over the textures and increase/decrease the colour values, but in this case the CPU has to do the work.
best regards
Jürgen
March 31st, 2010 at 4:01 pm
Thanks, Jürgen,
I’ve got the custom pixel shader, but not sure how
to embed it into SIV seamlessly. Also, how to
attach this kind of functions to keybroad or mouse
manipulation? Is it straightforward to add a control panel inside the window?
Wish you can help me with those simple questions.
Thanks a lot!
best,
Qian
April 8th, 2010 at 9:57 pm
Qian, to do so you have to attach the shader to a Node. how this is done and how the shader can be loaded is described here:
http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/ShadersIntroduction
For getting the stateset you should use
imageGroup–>getOrCreateStateSet();
in the createScene() function after its creation and continue as described in the tutorial.
Hoping this works, best regards,
Jürgen
May 15th, 2010 at 3:19 am
Hi Jürgen,
nice work:) for your headtracking project have a look at johnny lees wiimote headtracking project: http://www.youtube.com/watch?v=Jd3-eiid-Uw
maybe this could help you
best regards
repat
May 6th, 2012 at 3:54 pm
I can often get things to run on linux, but I’ll have to give up on this one.
I got the binary to start after back chaining through old version of OGS and its dependencies using rpm command (required old versions not available to yum). Now it fails for lack of a Microsoft font and not recognising -stereo option:
Warning: font file “fonts/arial.ttf” not found.
./siv: unrecognized option -stereo
Please could you find time to do a spot of maintenance or something?
May 6th, 2012 at 4:00 pm
I actually first tried compiling from source but no matter which /include file I used from OSG 2.8.0 to 2.8.5 it always failed with:
osg/Export:17:21: fatal error: osg/Config: No such file or directory
With OSG 3.0.1 /include file it fails with:
fatal error: osgGA/CameraManipulator: No such file or directory
I presume there must be a version of OSG it compiles successfully against, but which one?
May 6th, 2012 at 5:01 pm
Hi Peter,
the Option is not “-stereo”, but “–stereo”(with two minus). For all command line options try –help (again two minus). I just recognized, that two minus characters look nearly the same as a single one in the blog. For a better reference read the README.txt in the download. The warning regarding the font is not really an error, it just indicates, that the osg data files are not installed (for details on this see http://www.mygnu.de/index.php/2011/03/improved-openscenegraph-2-8-3-ebuild/ ), or the OSG_FILE_PATH environment variable is not set correctly. With the missing font, the filename display just does not look nice. To get the font working, just download and install the sample dataset for your osg version from openscenegraph.org. For 3.0.1 it is available from http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-3.0/data/OpenSceneGraph-Data-3.0.0.zip, for 2.8.2 it is available from http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-2.8/data/OpenSceneGraph-Data-2.8.0.zip. Afterwards set the OSG_FILE_PATH environment variable according to where you unzipped the data files.
Jürgen
May 6th, 2012 at 5:04 pm
Hi Peter,
have you tried the 1.1 siv version from http://www.mygnu.de/index.php/2010/12/siv-1-1-released/? I just have tried it against OSG-3.0.1 and it just compiled fine.
Jürgen
September 7th, 2012 at 8:45 pm
I wanted to thank you for this. There are no other viewers that I know of for Linux. I have been using mposplit/mpoconv to create 3d JPGs from the MPOs, but that doesn’t always work as expected. I have to tweak the parallax in GIMP. I like that I can adjust the parallax in siv, but it would be GREAT if, after adjusting the parallax, there was an option to save the image on the screen as a JPG. Any chance of that in a future release? 🙂
September 8th, 2012 at 8:12 pm
Hi Derek,
thank you for the flowers 😉 Saving as jpeg is not really an option, since the siv does not alter the bitmap data and just modifies the transformation used for displaying the images. More senseful would be writing the modified parallax value to the MPO file. Since writing exif data to mpo is a bit complicated and I am currently working on another spare time project this will take some time. But I already thought about implementing this.
However, as a workaround see this post: http://www.mygnu.de/index.php/2011/03/adjusting-parallax-in-mpo-stereo-images/
Use the adjusted parallax value displayed by siv as input for the setparallax script.
regards
Jürgen