Here is a Blog post to outline how to correctly deliver RAW scans from Agisoft. How you can align, scale and orient properly in 3D space.
So it might seem like a quick fix to scale and orient scans after the fact. Dirty and cheap I say. You must fix the scans at the source of the process. In Agisoft Photoscan (if that’s what you use) Agisoft Photoscan processing scans arbitrarily in world space and to a random scale and position. Not noticeable at first but a pain in the arse during production. There are no built in tools (yet) to solve this problem but you can solve it using the Region Box and Python Scripts. I have the scripts for this, email me if you want them.
You will need Agisoft Photoscan Pro and I urge any serious developers who make a living from Agisoft Photoscan to purchase a Pro license. It helps Agisoft LLC and it helps the community.
Here is what we see after a 109x DSLR single shot scan that has been processed (on High) and exported to 3DSMax
Poor scanned girl is the size of a thimble and laying on her side! “not good!” says Client X
As we can see in Agisoft Photoscan, it tells us the orientation is wildly off in some random direction compared to x,y,z and it’s position could be anything to 0,0,0 center of world co-ordinates.
See the culprit! bottom right, it tells us its drunken state!
So let’s fix that.
You go into each photograph that has your scale calibration visible and place two markers, one at 0 cm and the other at 1 cm. You could use pencil or pen marks of two dots that have been measured. Whatever. Just some reference points we know are the correct scale in the scene, that are visible from more than 3 x camera positions. So we can refine marker position.
Next up, lets measure the varmints.
Drag from 0 to 1 markers to define the red line scale.
Next up hard set the scale to 1.0 = 1cm!
Now lets update that MOTHER!
Correct scale accomplished!
Still with me? good.
The other alternative, or as I like to call it “chicken before the egg : |” you could append in an already scaled and aligned file. But do you have one? this is why it is VERY important to make sure you ALWAYS use the same naming convention for your single shot camera array. But that’s for another post “How to correctly use XX control Software for Remote Multi-thethering” I will post later.
Appending the egg!.. or.. the chicken?
Another girl scan! (yeah, it’s a hard life)
So we can use this appended chunk to align all cameras by camera. Align by camera is a very cool feature (that IR got introduced into Agisoft Photoscan, one of many, shared Beta testing! no NDA b&^^%^&s) As I mentioned it will only work if your cameras are always named the same. Organization is key. Naming conventions like IMG0007.jpg are no good.
So we can append align, if we already have a correctly scaled and oriented previous file. Or for every session or client we can make damn sure each master scan for the whole set, is correctly aligned, scaled, oriented and positioned correctly in world space.
Ready for export.
You only ever have to do this once per scan session because you can align the others by that chunk using align by camera (if you take 100’s of scans) and as long as you don’t drastically move cameras or rename mid session (are you CRAZY!) this is also where a tethered camera system is very important, none of the wireless nonsense. As going wireless looks all pretty, flowery and pink but it’s not practical in a reality. As you must not touch cameras during a session!! let alone all the dropouts and issues associated with wireless. Oh and changing batteries every 5 minutes!!
SO.. after we have scaled the scene, if we can’t append the egg/chicken we can use the Region bounding box and a python script to do the hard work (props to Alexey and Dmitry for this method)
It helps to alter to View: Perspective/Orthographic and turn on/off cameras whilst adjusting your region box correctly. The goal is get it the right way around. Red panel on the top, dash along the +x axis. This will give us the correct x,y,z orientation. The region box center is where the world center 0,0,0 will be.
I also find it’s wise to duplicate your chunk, decimate it and then you can use your script to orient and position that first, and keep the HIGH scans as backup.
Decimate down (we don’t need textures for this purpose)
Happy with the region box position? we then run the “magic script”
BOOM! BOOM! double BOOM! all done.
Well you could tweak some more. Lets test the scale, orientation and position in a 3rd party application again.
Not bad but her center point is off slightly. Let’s correct that. Back to Agisoft Photoscan once more..
Run the script again. That should do it!
Now if you wanted you could use this chunk to align all other chunks by camera positions! 🙂
Now lets check the final results in 3DSMax (or whatever your 3d artistry desires)
1.695m of pure 3D athletic goodness..
That’s all you need to know for now. This is the hard code fix.
Hopefully in the future this will be an obsolete post and Agisoft will have a fix or natural flow for how to correctly scale a scene. I did post in their forums about this http://www.agisoft.ru/forum/index.php?topic=592.0 but because of the lack of developer beta testing support it can be hard to get new features integrated without backup by user numbers.
If you use Agisoft Photoscan, please contribute in the forums. You know who you are, especially the larger studios.
There are amazing benefits to properly beta testing the software and also helping to fund the developers by buying the PRO license version. Support them.. support us all..
For example IR was able to use the brand new Mosaic Texture algorithm back in June-July 2012 for some very high profile projects, while other companies were still stuck on the Average (god awful blurry!) texture method, until the fix was released in February 2013.
The more you contribute, the more early access you can get.
IR has helped Agisoft Photoscan improve, helping to beta test and suggest features such as:
4D Support on timeline
Mosaic Texture Method. Super sharp highly detailed, blur free, seam free, textures (this took months of testing, uploading GB’s of data)
Strip Depth Maps, Strip Textures, Strip Models, Strip Masks command
New Spherical Texture Mapping Method for 360 faces, distortion free.
.FBX and .DAE exporter refinement for use in applications like Mudbox
A lot of Batch commands that never existed.
Alignment by marker and Camera
a multitude of Python Scripts
But to do this, to make this software grow and evolve you have to put in the time and effort, write out detailed ideas, posts, emails, blog posts, share images and share data freely with the developers.
If any of these features have helped you. If they help your business, please come over to the Agisoft Forums and contribute. Help the community, help others who make a living from scanning, to improve the software. We are contributing to the same cause. Better, more lifelike digital humans.
I hope this Blog post might be of some use (duck and dive around the grammatical errors!).