easyidp.pix4d.read_pmat#

easyidp.pix4d.read_pmat(pmat_path)#

read pix4d file *_pmatrix.txt

Parameters:

pmat_path (str) – the path of pmatrix file.type

Returns:

pmat_dict = {
    "DJI_0000.JPG": nparray(3x4),
    ... ,
    "DJI_9999.JPG": nparray(3x4)
}

Return type:

dict

Note

The pmatrix.txt file looks like:

DJI_0954.JPG 3111.599161 -2366.736021 -2308.589802 -65840.192261 -2444.444098 -3031.331712 -1800.672677 18549.006987 0.005818 0.038647 -0.999236 31.851547
DJI_0955.JPG 2962.002548 -2547.748788 -2312.702452 -69244.748198 -2620.207260 -2895.573136 -1776.758596 27157.887214 0.003220 0.034307 -0.999406 31.293337
DJI_0956.JPG 3756.991075 -1038.548434 -2327.984283 -49670.339047 -1138.894683 -3738.320518 -1770.474397 -22001.847467 -0.015923 0.031981 -0.999362 31.327806
DJI_0957.JPG 3923.542113 562.037059 -2214.273525 -8825.859811 514.572422 -3880.691126 -1755.606046 -68101.592371 0.001783 0.022713 -0.999740 30.301800
...

Example

Data prepare

>>> import easyidp as idp
>>> test_data = idp.data.TestData()

>>> param_folder = str(test_data.pix4d.maize_folder / "1_initial" / "params")
>>> param = idp.pix4d.parse_p4d_param_folder(param_folder)

Then use this function:

>>> idp.pix4d.read_pmat(param['pmat'])
{
    'DJI_0954.JPG':
        array([[  3111.599161,  -2366.736021,  -2308.589802, -65840.192261],
            [ -2444.444098,  -3031.331712,  -1800.672677,  18549.006987],
            [     0.005818,      0.038647,     -0.999236,     31.851547]]),
    'DJI_0955.JPG':
        array([...])
    ...
}