Extracting PhotoSynth Point Cloud in C#
The following content is from these alpha and
The original idea came from the getsatisfaction.com feeback site
where the Labs guys (not only Photosynth, but also related products like SeaDragon and iSynth) have 'support forums' set-up.
If you just want the code, all you need is Program.cs to create a ConsoleApplication that outputs
a MeshLab PLY file.
Further to this post, I've done a bit more work on the C# version of this Python script to process multiple bin files,
format the result for MeshLab and save it as a file with
.ply extension (thanks to comments on this post).
Here's how the example Sydney Harbour synth looks on Photosynth.net
And this is the Meshlab
Obviously I still haven't got the color parsing quite right (and I'm not 100% sure the point-count is correct...) but it's clearly the same set of points, so the C# code must be doing something right :)
Recent posts concerned with Photosynth and its availability on Silverlight 2.0 (and Moonlight) lead me to thinking about how to utilize the data generated by Photosynth (in Deep Zoom Viewer for example).
The first post - Exporting point clouds from Photosynth - was linked directly from Blaise Aguera y Arcas himself; it linked to another with some more detailed instructions - Photosynth Export Tutorial. Unfortunately all the code is in Python.
It seemed obvious to try and convert the Python script
bin_to_csv.py to C#. At the risk of embarrassing myself with a poor translation, I'm posting the "work in progress" here in case it's of interest.
You can view the code for the .NET Console application (excerpt below) or download the Visual Studio project and test data ZIPped (238Kb)
NOTE: that I couldn't get the offset calculation to work - I ended up manually cycling through even numbers to get decent output for each
.bin file - obviously this suggests perhaps I've screwed something up; but until I get time to test/work on it further, I'm not sure what...
I was testing data from this synth of Sydney
which seems to be just two files: points_0_0.bin and points_0_1.bin.
The output from the C# is points_0_0.txt (216Kb) and points_0_1.txt (109Kb).
Here's the first few lines
-6.723576, -1.410307 ,0.5756224, 4, 60, 8
-4.927393, -0.02451534 ,0.8836676, 21, 41, 21
-1.982108, 3.687859 ,0.03735788, 22, 45, 22
-1.845265, 3.327285 ,0.2232598, 6, 13, 6
-1.977082, 3.292458 ,0.3644025, 2, 8, 6
-1.478826, 3.45144 ,0.3358887, 9, 17, 9
I'm pretty sure at least some of the data is good - I could plot the first 56 points on Vladimir Bodurov's Silverlight 3D project, but I haven't had a chance to validate them any further.