how to visualize OpenPTV calibration result in 3D using Python and Plot.ly


In [105]:
import numpy as np
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
# print __version__ # requires version >= 1.9.0
init_notebook_mode(connected=True)

# from plotly.graph_objs import Scatter, Figure, Layout
import plotly.graph_objs as go
In [106]:
xyz = np.loadtxt('cal/target.txt')

trace1 = go.Scatter3d(
    x=xyz[:,1],
    y=xyz[:,2],
    z=xyz[:,3],
    mode='markers',
    marker=dict(
        size=8,
        line=dict(
            color='rgba(217, 217, 217, 0.14)',
            width=0.1
        ),
        opacity=0.5
    )
)

data = np.loadtxt('res/dt_lsq',skiprows=1)

trace2 = go.Scatter3d(
    x=data[:,1],
    y=data[:,2],
    z=data[:,3],
    mode='markers',
    marker=dict(
        color='rgb(127, 127, 127)',
        size=4,
        symbol='x',
        line=dict(
            color='rgb(204, 204, 204)',
            width=1
        ),
        opacity=0.9
    )
)
data = [trace1, trace2]
layout = go.Layout(
    margin=dict(
        l=0,
        r=0,
        b=0,
        t=0
    )
)
fig = go.Figure(data=data, layout=layout)
iplot(fig, filename='simple-3d-scatter')

http://interior-decorator-gas-32638.bitballoon.com/

comments powered by Disqus