def compute_principal_point_shift(camera, relativ_to_largest_extend):
    """Return the shift of the principal point in the 3D view port."""
    # https://blender.stackexchange.com/questions/58235/what-are-the-units-for-camera-shift

    width = camera.width
    height = camera.height
    p_x, p_y = camera.get_principal_point()

    if relativ_to_largest_extend:
        width_denominator = max(width, height)
        height_denominator = max(width, height)
    else:
        width_denominator = width
        height_denominator = height

    # Note, that the direction of the y coordinate is inverted - reflecting the
    # difference between computer vision vs computer graphics coordinate
    # system.
    shift_x = float((width / 2.0 - p_x) / float(width_denominator))
    shift_y = -float((height / 2.0 - p_y) / float(height_denominator))

    # log_report('INFO', 'shift_x: ' + str(shift_x), op)
    # log_report('INFO', 'shift_y: ' + str(shift_y), op)

    return shift_x, shift_y
Return the shift of the principal point in the 3D view port.
photogrammetry_importer/importers/camera_utility.py