Skip to content
Sven Wanner edited this page Jun 3, 2014 · 37 revisions

Installation

dependencies: vigra, numpy, scipy, cython, pcl (http://pointclouds.org/downloads/), python-pcl (http://strawlab.github.io/python-pcl/)

  • $ git clone [email protected]:svenwanner/pylibs.git
  • add to .bashrc: export PYTHONPATH=$PYTHONPATH:/home/where/you/cloned/pylibs

Recommendations

if the PYTHONPATH is added to your .bashrc, install dreampie or IPython and ensure that the following is executed when the interpreter is started in a console (In dreampie go to Edit -> Preferences. In the Tab Shell paste the code below and press CTRL+F6 or restart the interpreter):


# This import some other useful modules necessary packages are # vigra, numpy, scipy and matplotlib

import vigra
import sys,os
import scipy as sp
import pylab as plt
import numpy as np
from scipy import misc
from scipy import ndimage as nd

# This imports all available modules from pylib so you
# can use all defined structures immediately within the interpreter

import mypy.image.io as imio
import mypy.lightfield.io as lfio
import mypy.lightfield.helpers as helpers
import mypy.utils.filesystem as filesystem
import mypy.visualization.imshow as imshow
import mypy.pointclouds.depthToCloud as D2Cl
import mypy.lightfield.depth.structureTensor2D as st2D
import mypy.lightfield.depth.structureTensor3D as st3D
import mypy.workflows.StructureTensor2D as st2D_wflow
import mypy.workflows.StructureTensor3D as st3D_wflow


Examples

load a 3D light field and show an EPI

from mypy.lightfield import io as lfio

from mypy.visualization.imshow import epishow

lf3dh = lfio.load_3d(path_to_image_sequence)

epishow(lf3dh, position=100, direction='h', shift=0)

show finals.exr

import mypy.visualization.imshow as myvis

# force range for the channels depth, disp or coh, None means it is computed automatically

rs={"depth":[0.6,0.77],"disp":[8,10]}

myvis.finalsViewer("final.exr",ranges=rs)

transform and join pointclouds

import numpy as np

from mypy.pointclouds.PointCloud import Cloud

cloud1 = Cloud()

cloud1.from_file("/home/myclouds/pos1.ply")

cloud1.transform(translation=np.array([2.2861, -4.7266, 3.6840]), rotation_x=1.1554, rotation_y=0.0108, rotation_z=0.5563)

cloud2 = Cloud()

cloud2.from_file("/home/myclouds/pos2.ply")

cloud2.transform(translation=np.array([4.2479, -3.4913, 3.8500]), rotation_x=1.1457, rotation_y=0.0108, rotation_z=0.8585)

cloud1.merge(cloud2)

cloud1.save("/home/myclouds/merged.ply")

Workflows

Structure Tensor 2D workflow

examples can be found in: workflows/examples/structureTensor2D_example.py or workflows/examples/structureTensor2D_batchProcessExample.py

if you've set the PYTHONPATH you can copy the script, adapt the
parameter to your needs and execute it from everywhere in a terminal via

$ python my_example.py