Skip to content

Setting  #1064

Open
Open
@AlonSpinner

Description

@AlonSpinner

Hi again,

I'm trying to calibrate the offline renderer's camera with my own intrinsic parameters (focal length and others)
Noticing that the projection matrix is in OpenGL format, I found a way to do it with this:
https://strawlab.org/2011/11/05/augmented-reality-with-OpenGL/

Unfortunately, I found no set method for the camera's projection matrix.
Any idea how I can go about it?

Thanks,
Alon

Code to extract projection matrix from a camera object:

from OCC.Display.OCCViewer import Viewer3d
from ctypes import c_double
import numpy as np
offscreen_renderer = Viewer3d()
offscreen_renderer.Create()
offscreen_renderer.SetModeShaded()

cam = offscreen_renderer.View.Camera()
data = cam.ProjectionMatrix().GetData()
v = list((c_double * 16).from_address(int(data)))
M = np.array(v).reshape((4,4)).T
print(M)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions