[Bf-python] Bundled scripts that use python extensions?
Jonathan Merritt
j.merritt at pgrad.unimelb.edu.au
Mon Nov 1 02:39:35 CET 2004
Hi Everyone,
I am currently working on a script that might be a good candidate for a
bundled script: camera calibration. This is sometimes called "camera
matching" in a VFX context. The idea is that by matching up points in
an image taken by a real camera to locations of virtual points in 3D
space, the camera position and orientation and its internal parameters
("Lens", in the case of Blender), can be determined. The virtual camera
can be placed at the same relative spot in the virtual scene as the real
camera occupied when the image was taken. This is extremely useful for
accurate Blendering on photos, image-based-modeling, etc.
The particular algorithm I'm using for camera calibration was developed
by a guy called Roger Tsai and is quite complicated. It first involves
using a linear process to approximate the set of camera parameters,
followed by a non-linear optimization by minimizing the sum of squared
errors of the calibration points in image space. Put simply, it would
be *hell* to code in raw Python, and not exactly straightforward even
with the current Python numerical libraries that are available.
Fortunately, a C implementation is already available here:
http://www-2.cs.cmu.edu/afs/cs.cmu.edu/user/rgw/www/TsaiCode.html
I have substantially modified the code from that website to create a
Python extension module (which wasn't so straightforward... try doing a
"grep -R exit *" and feel my pain... :-) I am currently tidying up this
module prior to release, and adding in some decent test functions.
I'm just wondering what the policy will be for bundled scripts that
require Python extension modules? How will this work in a general case?
Thanks,
Jonathan Merritt.
PS - Is there a bundled scripts discussion group yet? I did go looking
(I promise) in the Wiki, but couldn't find one listed there.
More information about the Bf-python
mailing list