Difference between revisions of "Focal Stacks"

From Immersive Visualization Lab Wiki
Jump to: navigation, search
(OBJ Files)
(OBJ Files)
 
(11 intermediate revisions by one user not shown)
Line 3: Line 3:
 
Requirements for OBJ files for CalVR to display:
 
Requirements for OBJ files for CalVR to display:
  
* Material library file needs to be specified with full path and extension, e.g.: <tt>mtllib /home/username/sio/coral-mtl.mtl</tt>.
+
* Material library file needs to be specified with extension, e.g.: <tt>mtllib coral-mtl.mtl</tt>.
* To use a texture image (image map) use the command <tt>usemtl</tt>, not usemap. Example: usemtl <tt>coral-material</tt>. This is for material file coral-mtl.mtl, which has the following content:
+
* To use a texture image (image map) use the command <tt>usemtl</tt>, not <tt>usemap</tt>. Example: <tt>usemtl coral-material</tt>. This is for material file coral-mtl.mtl, which has the following content:
 
<pre>
 
<pre>
 
   newmtl coral-material
 
   newmtl coral-material
Line 10: Line 10:
 
</pre>
 
</pre>
 
* The image referenced by the material file in this example is <tt>coral-map.jpg</tt>.
 
* The image referenced by the material file in this example is <tt>coral-map.jpg</tt>.
 +
* If the image is upside down, flip it with the following ImageMagick command:
 +
<pre>
 +
  convert sourceimage.jpg -flip destimage.jpg
 +
</pre>
 +
* Here's a script that converts Helicon Focus's OBJ files to CalVR's OBJ format:
 +
<pre>
 +
#!/bin/bash
 +
#
 +
# Syntax:  <scriptname> <obj_file_name.obj>
 +
# Example: conv2calvr.sh FS_010.obj
 +
#
 +
chmod 660 *
 +
sed s/usemap/usemtl/ $1 -i
 +
sed s/map.jpg/coral-material/ $1 -i
 +
sed '/map_Kd/ i\newmtl coral-material' $1.mtl -i
 +
convert $1.jpg -flip $1.jpg
 +
</pre>
 +
* To run the script on all OBJ files in a time series:
 +
** Put the above script (<tt>conv2calvr.sh</tt>) in the directory just above the directories for the time series and call the following shell script:
 +
<pre>
 +
#!/bin/bash
 +
find . -type d -exec sh -c 'cd {} && echo `../conv2calvr.sh *.obj`' ';'
 +
</pre>

Latest revision as of 13:44, 23 May 2013

OBJ Files

Requirements for OBJ files for CalVR to display:

  • Material library file needs to be specified with extension, e.g.: mtllib coral-mtl.mtl.
  • To use a texture image (image map) use the command usemtl, not usemap. Example: usemtl coral-material. This is for material file coral-mtl.mtl, which has the following content:
  newmtl coral-material
  map_Kd coral-map.jpg
  • The image referenced by the material file in this example is coral-map.jpg.
  • If the image is upside down, flip it with the following ImageMagick command:
  convert sourceimage.jpg -flip destimage.jpg
  • Here's a script that converts Helicon Focus's OBJ files to CalVR's OBJ format:
#!/bin/bash
#
# Syntax:  <scriptname> <obj_file_name.obj>
# Example: conv2calvr.sh FS_010.obj
#
chmod 660 *
sed s/usemap/usemtl/ $1 -i
sed s/map.jpg/coral-material/ $1 -i
sed '/map_Kd/ i\newmtl coral-material' $1.mtl -i
convert $1.jpg -flip $1.jpg
  • To run the script on all OBJ files in a time series:
    • Put the above script (conv2calvr.sh) in the directory just above the directories for the time series and call the following shell script:
#!/bin/bash
find . -type d -exec sh -c 'cd {} && echo `../conv2calvr.sh *.obj`' ';'