View RSS Feed

Redrobes blog about playing with the technical side of graphics.

More Insight3D and point extraction.

Rate this Entry
by , 12-06-2010 at 04:12 PM (5364 Views)
So you have run the app and got the model out and extracted the text file of points which should look like this...





and this...


Code:
11.533901 6.104121 9.604865 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
0.953364 -2.537618 10.625220 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
11.532170 6.103600 9.600652 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
-3.325837 5.171457 10.234938 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
3.639049 -1.379828 12.350372 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
4.710207 2.041938 12.053959 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
... etc

But we would like to convert that into an OBJ format to load into other apps. Well I dont know of an easy way to do this but I have here a little perl script to convert it. Basically an OBJ file can be expressed with a 'g' for group, then list all the vertices with a 'v' followed by the X,Y and Z coords and then finally finishing off with another 'g' to end the group.

So save or rename the points file as "points.txt" then run this perl script in the same directory and it ought to generate an "Object.obj" file out of them.


Code:
open( PTS, ";
close PTS;

open( OBJ, ">Object.obj" ) or die "Cant open Object.obj file";

print OBJ "g\n";

foreach $line (@lines)
{
	if( $line =~ /([-\d\.]+) ([-\d\.]+) ([-\d\.]+) .*/ )
	{
		print OBJ "v $1 $2 $3\n";
	}
}

print OBJ "g\n";

close OBJ;

With that you can load it into MeshLab and it will look like this.




I'll show how to connect this point set up next time. Its not going to look fabulous since it does not have a back to the building but if you have enough photos all around the model then it should be better. Still, this is where its heading.

I guess I should add that Insight3D does have the ability to self stitch up all the points but its not very good. It also has the ability to set your own points up and get it to find them in 3D space and then you manually create polygons for them and its great at doing this. It can even generate nice accurate textures for them. So this is what its supposed to be for but I want terrain so I want to stitch all the points up. Tho its not very intuitive to use Insight3D is good at what its supposed to do I would heartily recommend checking it out.

Updated 12-06-2010 at 04:40 PM by Redrobes

Tags: None Add / Edit Tags
Categories
Technical

Comments

  1. Jaxilon's Avatar
    • |
    • permalink
    This is crazy business but I'm rather intrigued by it. Half of me is saying, "what the heck?" and the other half is wondering if this thing really does what I think it does. I shall await your next update.