import pickle


def obtainCalibrationPointsFromFile(fname="all_writeup/camera_calibrations_pickle1.p"):
    """
    Uses pickle to open/unpack camera calibration values from file.
    Expects pickle with the two following keys:
    'cMatrix'   ==  camera matrix
    'dCoeff'    ==  distortion coefficients

    Assumes fname is a pickled file with no error checking.

    Input: fname - file name of pickle --> default is project file
    return: cMatrix, dCoeff

    """
    with open(fname, "rb") as f:
        dist_pickle = pickle.load(f)

    cMatrix = dist_pickle["cMatrix"]
    dCoeff = dist_pickle["dCoeff"]
    return cMatrix, dCoeff