[Bf-python] Bundled scripts that use python extensions?
joeeagar at prodigy.net
Mon Nov 1 02:48:35 CET 2004
Jonathan Merritt wrote:
> 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:
> 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?
In this case, due to the coolness of what you are doing I suspect that
within a month of you posting your script you may find it hardcoded into
Blender, :). Hm. Ooh! An idea! Since bundled scripts are "bundled"
their associated C modules could be built at blender-compile-time! So,
Willian, what do you think?
> 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.
Getting to the general list list requires url editing, it's at
More information about the Bf-python