Forum

Author Topic: photoscan dense cloud viewer in ipython notebook  (Read 5894 times)

MManning

  • Newbie
  • *
  • Posts: 11
    • View Profile
photoscan dense cloud viewer in ipython notebook
« on: November 29, 2016, 02:56:04 AM »
I am wondering if other developers using the Photoscan 1.3 version from an ipython notebook have attempted to view the point cloud inside the notebook. I looked for a viewer which I could use in ipython and  which could read one of Photoscan's output formats. Was hoping that Plotly might work. Has anyone had success with something similar?

Thanks for your help.

reperry

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: photoscan dense cloud viewer in ipython notebook
« Reply #1 on: November 30, 2016, 06:56:40 PM »
WOAH -- you can use Agisoft from an iPython notebook? I thought the scripts had to all be run from within a live instance of Agisoft. Please let me know how to control Agisoft from an iPython shell if you know  how!

As for viewing things in Python -- here are things I would look into:

matplotlib
mayavi http://docs.enthought.com/mayavi/mayavi/
blender (it allows Python scripting)

And for viewing without Python:
meshlab is great for quickly viewing Agisoft output, except .fbx
FBX Review is good for viewing .fbx output

MManning

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: photoscan dense cloud viewer in ipython notebook
« Reply #2 on: December 06, 2016, 12:44:07 AM »
Hello
the ipython notebook I am creating is more of a batch workflow. I write the batch script in one cell then run it (photoscan.sh -r script.py) in the next then rinse and repeat. Between these script executions I would like to view the current  model or points cloud that I am building.

Can you tell me how you load the image into matplotlib? which format are you exporting then loading? Can you show both the points cloud and the model in 3D?  Apologies for being slow on the uptake...

I have:

Code: [Select]
%matplotlib notebook

from IPython.display import set_matplotlib_formats
import matplotlib.pyplot as plt

set_matplotlib_formats('pdf', 'svg')
from IPython.display import Image, SVG

import matplotlib.image as mpimg
import matplotlib.pyplot as plt

img=mpimg.imread('actest/model.obj')

OSError: cannot identify image file 'actest/model.obj'[/quote][/code]

Mayavi requires VTK (as I understand) which is currently not installed on my server. Meshlab's last release was in Apr2014 but maybe that is an option. Blender is nice but I dont see how to embed it into a notebook, looks like I need to upload image to the site.  Also noticed that Anaconda comes with a yt module that seems to provide visualizations but, again. Im stuck on the load step..

Appreciate any examples you might provide.

Thanks!

reperry

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: photoscan dense cloud viewer in ipython notebook
« Reply #3 on: December 16, 2016, 07:04:15 AM »
I haven't used matplotlib for this, but I listed it as one of the things I would investigate if I were determined to keep the whole work flow within Python. Here are the 3D capabilities: http://matplotlib.org/mpl_toolkits/mplot3d/tutorial.html. I suspect it will be very slow with 100,000 or 1,000,000 points. If you just want a preview of a point cloud, you could plot every 10th or 100th point.

From my experience, exporting a point cloud as .xyz or a mesh as .obj are the most human-readable. I would then write a little thing to read and parse the text files into a Numpy array before attempting to plot.

Good luck!