Forum

Author Topic: Trying to fix sensor after importCameras call always resets every parameter to 0  (Read 5964 times)

avolodin

  • Newbie
  • *
  • Posts: 9
    • View Profile
Basically the title.

I'm trying to re-align only several cameras that were moved between shots.

What I'm doing is importing cameras via .xml file and then I'm calling:

```
for cam in chunk.cameras:
    if cam not in cams_to_realign:
        f = cam.sensor.calibration.f
        cx = cam.sensor.calibration.cx
        cy = cam.sensor.calibration.cy
        k1 = cam.sensor.calibration.k1
        k2 = cam.sensor.calibration.k2
        k3 = cam.sensor.calibration.k3

        p1 = cam.sensor.calibration.p1
        p2 = cam.sensor.calibration.p2
        #cam.sensor.fixed = True
        #cam.sensor.fixed_calibration = True
        #cam.sensor.fixed_location = True
        #cam.sensor.fixed_rotation = True
        cam.sensor.fixed_params=["F","Cx","Cy","K1","K2","K3","P1","P2"]

        cam.sensor.calibration.f = f
        cam.sensor.calibration.cx = cx
        cam.sensor.calibration.cy = cy
        cam.sensor.calibration.k1 = k1
        cam.sensor.calibration.k2 = k2
        cam.sensor.calibration.k3 = k3

        cam.sensor.calibration.p1 = p1
        cam.sensor.calibration.p2 = p2
```

as you can see I've tried everything even storing every parameter before assigning, but I still keep getting zeros. This is important for me because I want to optimize cameras after aligning and I want some cameras to be untouched.

vineg

  • Newbie
  • *
  • Posts: 43
    • View Profile
Hi, Andrey!

Fixing parameter results in using this parameter from initial calibration (user_calib). By default all initial values except focal length are zero.
To set initial calibration you may call cam.sensor.user_calib = cam.sensor.calibration befor making parameters fixed.

Regards, Egor

avolodin

  • Newbie
  • *
  • Posts: 9
    • View Profile
hey! looks like it worked, but now some cameras get None transform after I call optimizeCameras, is it possible to fix it as well?