Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Writing camera matrix to xml/yaml file

I have calibrated my camera having the following parameters:

camera_matrix=[[ 532.80990646 ,0.0,342.49522219],[0.0,532.93344713,233.88792491],[0.0,0.0,1.0]] dist_coeff = [-2.81325798e-01,2.91150014e-02,1.21234399e-03,-1.40823665e-04,1.54861424e-01]

I am working in python.I wrote the following code to save the above into a file but the file was like a normal text file.

f = open("C:\Users\Administrator\Desktop\calibration_camera.xml","w")

f.write('Camera Matrix:\n'+str(camera_matrix))

f.write('\n')

f.write('Distortion Coefficients:\n'+str(dist_coefs))

f.write('\n')

f.close()

How can i save this data into an xml/yaml file using python commands.Please help. Thanks in advance

click to hide/show revision 2
retagged

updated 2014-05-02 04:32:30 -0600

berak gravatar image

Writing camera matrix to xml/yaml file

I have calibrated my camera having the following parameters:

camera_matrix=[[ 532.80990646 ,0.0,342.49522219],[0.0,532.93344713,233.88792491],[0.0,0.0,1.0]] dist_coeff = [-2.81325798e-01,2.91150014e-02,1.21234399e-03,-1.40823665e-04,1.54861424e-01]

I am working in python.I wrote the following code to save the above into a file but the file was like a normal text file.

f = open("C:\Users\Administrator\Desktop\calibration_camera.xml","w")

f.write('Camera Matrix:\n'+str(camera_matrix))

f.write('\n')

f.write('Distortion Coefficients:\n'+str(dist_coefs))

f.write('\n')

f.close()

How can i save this data into an xml/yaml file using python commands.Please help. Thanks in advance