Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying Lens Distortion to Panoramic Camera Model #675

Open
botanyldrm opened this issue Aug 29, 2022 · 2 comments
Open

Applying Lens Distortion to Panoramic Camera Model #675

botanyldrm opened this issue Aug 29, 2022 · 2 comments
Assignees
Labels
question Question, not yet a bug ;)

Comments

@botanyldrm
Copy link

I am able to change camera model to Panoramic model using bpy package directly such as:
bpy.data.objects["Camera"].data.type = "PANO" bpy.data.objects["Camera"].data.cycles.panorama_type = "FISHEYE_EQUISOLID"

Now, I want to be sure whether camera distortion is applied correctly in blenderproc for this case. I mean, will following code result with correct distortion:

mapping_coords = bproc.camera.set_lens_distortion(k1, k2, k3, p1, p2)

@themasterlink
Copy link
Contributor

@5trobl Could you help out here?

As far as I know, this only works for "Perspective" and not for "PANO".

But, @5trobl is the expert here.

Best,
Max

@themasterlink themasterlink added the question Question, not yet a bug ;) label Aug 29, 2022
@5trobl
Copy link
Member

5trobl commented Sep 5, 2022

I don't know how Cycle's 'PANO' type relates to 'PERSP', perhaps @cornerfarmer does. There might be some relation (shared/converted parameters) but 'PANO' applies some nonlinear distortion on top (e.g., it's impossible to perspectively project an AOV>=180° on a planar sensor). That distortion does not correspond to the Brown-Conrady model. Even in the case of smaller fish-eye lenses with ~150° AOV where the Brown-Conrady could still hold, that distortion model is inadequate because it physically does not match actual lenses and because mathematically it very easily blends back to the front direction such that distortion is not even defined for the surrounding regions. For that lenses the Kannala-Brandt model on angular distances instead of projected distances works much better with even fewer parameters but we have not implemented that one yet.

Since bproc.camera.set_lens_distortion() relies on both the intrinsics of the 'PERSP' camera type and the Brown-Conrady radial distortion model, it should not be used for 'PANO' cameras anyway. If you obtain some results, these will certainly not be geometrically accurate to any realistic camera. Perhaps we should add an assert statement not to allow this. Nice try though!

PS: I'm an expert in geom. calibration not in bpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question, not yet a bug ;)
3 participants