easyidp.pix4d.read_ccp#
- easyidp.pix4d.read_ccp(ccp_path)#
Read
*_calibrated_camera_parameters.txt
foreasyidp.reconstruct.Photo
object- パラメータ:
ccp_path (str) -- file path
- 戻り値:
img_configs = { 'w': 4608, 'h': 3456, 'Image1.JPG': { 'cam_matrix': array([[...]]), 'rad_distort': array([ 0.03833474, ...]), 'tan_distort': array([0.00240852, ...]), 'cam_pos': array([ 21.54872207, ...]), 'cam_rot': array([[ 0.78389904, ...]])}, 'Image2.JPG': {...} }
- 戻り値の型:
dict
メモ
It is the camera position info in local coordinate, the file looks like:
fileName imageWidth imageHeight camera matrix K [3x3] radial distortion [3x1] tangential distortion [2x1] camera position t [3x1] camera rotation R [3x3] camera model m = K [R|-Rt] X DJI_0954.JPG 4608 3456 3952.81247514184087776812 0 2233.46124792750424603582 0 3952.81247514184087776812 1667.92521335858214115433 0 0 1 0.03833474118270804865 -0.01750917966495743258 0.02049798716391852335 0.00240851666319534747 0.00292562392135245920 21.54872206687879199194 -29.58734160676452162875 30. 85702810138878149360 0.78389904231994589345 -0.62058396220897726892 -0. 01943803742353054573 -0.62086105345046738169 -0.78318706257080084043 -0. 03390541741516269608 0.00581753884797473961 0.03864674463298682638 -0.99923600083815289352 DJI_0955.JPG ...
サンプル
Data prepare
>>> import numpy as np >>> np.set_printoptions(suppress=True) >>> 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:
>>> ccp = idp.pix4d.read_ccp(param['ccp']) >>> ccp.keys() dict_keys(['DJI_0954.JPG', 'w', 'h', 'DJI_0955.JPG', ... , 'DJI_0091.JPG', 'DJI_0092.JPG']) >>> ccp['w'] 4608 >>> ccp['DJI_0954.JPG'] { 'cam_matrix': array([[3952.81247514, 0. , 2233.46124793], [ 0. , 3952.81247514, 1667.92521336], [ 0. , 0. , 1. ]]), 'rad_distort': array([ 0.03833474, -0.01750918, 0.02049799]), 'tan_distort': array([0.00240852, 0.00292562]), 'cam_pos': array([ 21.54872207, -29.58734161, 30.8570281 ]), 'cam_rot': array([[ 0.78389904, -0.62058396, -0.01943804], [-0.62086105, -0.78318706, -0.03390542], [ 0.00581754, 0.03864674, -0.999236 ]]) }