Author Topic: export undistorted photos in python  (Read 1641 times)


  • Jr. Member
  • **
  • Posts: 51
    • View Profile
export undistorted photos in python
« on: April 02, 2018, 08:41:33 PM »
I've been trying to recreate the GUI functionality export -> undistort photos using the Python API.

This is what I came up with, for a multiplane (MicaSense RedEdge) camera:

Code: [Select]
    for camera in chunk.cameras:
        for plane in camera.planes:
            img = plane.image()
            calib = plane.sensor.calibration
            # This is the key line for colour correction. Here, I opted not to square pixels or center principal point.
            imgu = img.undistort(calib, False, False)
            name = os.path.basename(
  'undistorted/', name))

It seems to work. Unfortunately, it seems that the exif information, such as 'XMP:CaptureId' is not saved. (This is crucial for me.) Does anyone know if this can be accomplished?

EDIT: I noticed that photo.imageMeta() exists, and I also know how to extract metadata from the original photo using e.g. exiftool. But I'm not sure how to save the metadata properly to a new image.

EDIT 2: I am managing with a workaround--just using the metadata from the original images, and matching that to the undistorted images.
« Last Edit: April 02, 2018, 11:33:50 PM by william »