Forum

Author Topic: alignCameras not working with film camera w/fiducials  (Read 2060 times)

sydneyg

  • Newbie
  • *
  • Posts: 9
    • View Profile
alignCameras not working with film camera w/fiducials
« on: July 04, 2022, 05:40:19 PM »
Hi all,

I am trying to work with some historical aerial imagery (from a film camera with fiducials).  I cannot seem to get the images to align with the script I have.

My script detects the fiducials automatically, calibrates them, and masks out the background, and matches the photos. All of that seems to work fine, but the final alignment produces 0 tie points. When I run this script without the flag "film camera with fiducials", the images align and a sparse cloud is made. However, when the film camera comes into the question it seems to find 0 tie points. 

PS: I also slammed the same images into the GUI and processed with the same setup as I have here in this script (film camera w/ fiducials auto detected and auto calibrated) and the images aligned just fine. 

PPS: I also tested it with a different set of historical aerial film images, same issue again. So I don't think the images are the issue.

Does anyone have any insights on this? Maybe I'm overlooking something in this script. Script attached as is the console output. Thx for the help.

Sydney

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: alignCameras not working with film camera w/fiducials
« Reply #1 on: July 04, 2022, 06:29:07 PM »
Hello Sydney,

Can you send the project saved after the script run to support@agisoft.com?
Best regards,
Alexey Pasumansky,
Agisoft LLC

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: alignCameras not working with film camera w/fiducials
« Reply #2 on: July 08, 2022, 07:53:06 PM »
Hello Sydney,

Thank you for sharing the project data.

It seems that calibrateFiducials command via Python results in inverted Y coordinate for fiducials (the behavior of Calibrate Fiducials command from GUI has been changed around 1.7.3 version). We will try to fix it in the next update, but meanwhile you can invert the sign in your script, see the code example for that:
[code[sensor = Metashape.app.document.chunk.sensors[0]
for f in sensor.fiducials:
    coord = f.reference.location
    f.reference.location = Metashape.Vector([coord.x, -coord.y, coord.z])[/code]

Also you need to implement additional modification, prior to alignCameras command, but after the sensor type has been defined:
Code: [Select]
sensor.width = 0
sensor.height = 0

These two modifications should make your script working. Please let me know, if it works on your side.
Best regards,
Alexey Pasumansky,
Agisoft LLC

sydneyg

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: alignCameras not working with film camera w/fiducials
« Reply #3 on: July 13, 2022, 06:12:32 PM »
Hello Alexey,

Thank you for the help, it worked perfectly.

Just to know this is how it looked in the code in the end:

Code: [Select]
for camera in chunk.cameras:
   sensor = camera.sensor
   sensor.fixed_calibration=True
   sensor.film_camera=True
   sensor.focal_length=<focal len>
   sensor.height = 0
   sensor.width = 0

for f in sensor.fiducials:
   coord = f.reference.location
   print(coord)
   f.reference.location = Metashape.Vector([coord.x, -coord.y, coord.z])
   print(f.reference.location)


Sydney

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 14813
    • View Profile
Re: alignCameras not working with film camera w/fiducials
« Reply #4 on: July 14, 2022, 06:13:02 PM »
Hello Sydney,

Good to hear, that the approach worked.

Fixed calibrateFiducials method will be included in the next 1.8.4 pre-release update, so you wouldn't need to invert Y coordinates for fiducial marks manually.
Best regards,
Alexey Pasumansky,
Agisoft LLC