Compare commits

...

3 Commits

Author SHA1 Message Date
Thierry Bissem 26e59bdaa7 Merging 2024-05-24 09:23:43 +02:00
Thierry Bissem e68263b990 Intrinsic and distortion parameters in data file 2024-05-24 09:20:06 +02:00
Thierry Bissem d26364c6aa Modify README 2024-05-24 08:49:54 +02:00
7 changed files with 1627 additions and 1 deletions

View File

@ -1,2 +1,2 @@
# SensingLab3 # SensingLab3
What does it do? Image processing

BIN
bin/CameraCalibration Executable file

Binary file not shown.

46
data/default.xml Normal file
View File

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<opencv_storage>
<Settings>
<!-- Number of inner corners per a item row and column. (square, circle) -->
<BoardSize_Width> 9</BoardSize_Width>
<BoardSize_Height>6</BoardSize_Height>
<!-- The size of a square in some user defined metric system (pixel, millimeter)-->
<Square_Size>24</Square_Size>
<!-- The type of input used for camera calibration. One of: CHESSBOARD CIRCLES_GRID ASYMMETRIC_CIRCLES_GRID -->
<Calibrate_Pattern>"CHESSBOARD"</Calibrate_Pattern>
<!-- The input to use for calibration.
To use an input camera -> give the ID of the camera, like "1"
To use an input video -> give the path of the input video, like "/tmp/x.avi"
To use an image list -> give the path to the XML or YAML file containing the list of the images, like "/tmp/circles_list.xml"
-->
<Input>"0"</Input>
<!-- If true (non-zero) we flip the input images around the horizontal axis.-->
<Input_FlipAroundHorizontalAxis>0</Input_FlipAroundHorizontalAxis>
<!-- Time delay between frames in case of camera. -->
<Input_Delay>200</Input_Delay>
<!-- How many frames to use, for calibration. -->
<Calibrate_NrOfFrameToUse>25</Calibrate_NrOfFrameToUse>
<!-- Consider only fy as a free parameter, the ratio fx/fy stays the same as in the input cameraMatrix.
Use or not setting. 0 - False Non-Zero - True-->
<Calibrate_FixAspectRatio> 1 </Calibrate_FixAspectRatio>
<!-- If true (non-zero) tangential distortion coefficients are set to zeros and stay zero.-->
<Calibrate_AssumeZeroTangentialDistortion>1</Calibrate_AssumeZeroTangentialDistortion>
<!-- If true (non-zero) the principal point is not changed during the global optimization.-->
<Calibrate_FixPrincipalPointAtTheCenter> 0 </Calibrate_FixPrincipalPointAtTheCenter>
<!-- The name of the output log file. -->
<Write_outputFileName>"./data/microsoft_livecam_hd3000.xml"</Write_outputFileName>
<!-- If true (non-zero) we write to the output file the feature points.-->
<Write_DetectedFeaturePoints>1</Write_DetectedFeaturePoints>
<!-- If true (non-zero) we write to the output file the extrinsic camera parameters.-->
<Write_extrinsicParameters>1</Write_extrinsicParameters>
<!-- If true (non-zero) we show after calibration the undistorted images.-->
<Show_UndistortedImage>1</Show_UndistortedImage>
</Settings>
</opencv_storage>

View File

@ -0,0 +1,802 @@
<?xml version="1.0"?>
<opencv_storage>
<calibration_time>"ven. 24 mai 2024 09:08:44"</calibration_time>
<nr_of_frames>25</nr_of_frames>
<image_width>640</image_width>
<image_height>480</image_height>
<board_width>9</board_width>
<board_height>6</board_height>
<square_size>24.</square_size>
<fix_aspect_ratio>1.</fix_aspect_ratio>
<!-- flags: +fix_aspectRatio +zero_tangent_dist -->
<flags>10</flags>
<fisheye_model>0</fisheye_model>
<camera_matrix type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
6.7786958849133725e+02 0. 3.2587814395385493e+02 0.
6.7786958849133725e+02 2.1808718461347280e+02 0. 0. 1.</data></camera_matrix>
<distortion_coefficients type_id="opencv-matrix">
<rows>5</rows>
<cols>1</cols>
<dt>d</dt>
<data>
2.4481912459474778e-01 -1.8568768609488913e+00 0. 0.
4.0178158278029121e+00</data></distortion_coefficients>
<avg_reprojection_error>1.3670345500512076e+00</avg_reprojection_error>
<per_view_reprojection_errors type_id="opencv-matrix">
<rows>25</rows>
<cols>1</cols>
<dt>f</dt>
<data>
2.69166470e-01 2.62851059e-01 2.68149227e-01 2.66053796e-01
2.64620304e-01 2.64864117e-01 2.90623188e-01 3.73805642e-01
3.89915615e-01 4.32684749e-01 3.93599838e-01 5.34258604e+00
3.96965432e+00 4.45891380e-01 2.37501740e-01 2.92528391e-01
3.30696523e-01 2.64549375e-01 3.87619972e-01 3.42277646e-01
2.79784381e-01 2.88519859e-01 2.99491376e-01 3.12551498e-01
3.72800857e-01</data></per_view_reprojection_errors>
<!-- a set of 6-tuples (rotation vector + translation vector) for each view -->
<extrinsic_parameters type_id="opencv-matrix">
<rows>25</rows>
<cols>6</cols>
<dt>d</dt>
<data>
-2.5954370118220582e-01 -8.4430411450198445e-02
-7.9879731969250301e-02 -1.3489286088079319e+02
-1.2353117655609276e+01 3.8337267032371903e+02
-2.5964925623797924e-01 -8.4612538978102850e-02
-8.0109352312277213e-02 -1.3495784567611875e+02
-1.2326077398128277e+01 3.8337261052193514e+02
-2.5975041029458568e-01 -8.3979077125822449e-02
-7.9639926423594895e-02 -1.3487401016407551e+02
-1.2371668965402867e+01 3.8341313902848981e+02
-2.5953488434252714e-01 -8.4931438474786389e-02
-8.0180209917026624e-02 -1.3496247552546089e+02
-1.2321623325332396e+01 3.8332806969186652e+02
-2.5968455172163718e-01 -8.4751521891439238e-02
-8.0085579755232464e-02 -1.3494206350130813e+02
-1.2331756809975884e+01 3.8335299903828360e+02
-2.5928411987180561e-01 -8.4597923899634386e-02
-7.9982564877425513e-02 -1.3491528503507536e+02
-1.2342730968942112e+01 3.8333648887593313e+02
-2.5797446333007029e-01 -6.3768550907082791e-02
-1.1701357520350734e-01 -1.3338538136736000e+02
-2.0274897661407770e+01 3.8441332273784383e+02
-2.4243310778441798e-01 1.1595402404627651e-01
-1.1557797123648064e-01 -1.2751120289643355e+02
-1.9462874398736389e+01 3.7685752184900997e+02
-2.4136137192522517e-01 1.7155869986219971e-01
-1.2227373149652573e-01 -1.2503726135972499e+02
-2.0461420818616538e+01 3.7525981438559631e+02
-2.4106661104136842e-01 1.8025681126781831e-01
-1.2840740316356522e-01 -1.2459645647090235e+02
-2.1641880657966919e+01 3.7528105519178229e+02
-1.0192713646772893e-01 4.5138147303811875e-02
-1.3294715565378268e-01 -1.2413736295330301e+02
-2.7300032944137389e+01 3.6013241276783180e+02
8.1427721603680531e-02 -1.2091082906088557e-01
-1.2851137124355141e-01 -1.2248921712572424e+02
-2.8237318939464629e+01 3.3915423654271672e+02
8.0925842439299178e-02 -1.2104876022864709e-01
-1.3530058414705237e-01 -1.2366011983994380e+02
-2.9495486989126935e+01 3.3937175844115166e+02
-1.4826508530450939e-02 -1.2110763589672534e-01
-1.7277745931069288e-01 -1.3117263683396476e+02
-3.1960193229765117e+01 3.5225676633794023e+02
-1.5630104094810532e-01 -4.6029272587977843e-01
-1.4608644023949846e-01 -1.2763179137339615e+02
-5.2152810645456647e+01 2.9730643549346803e+02
-2.4173461914022978e-01 -5.9142972234982616e-01
-1.1784174810236944e-01 -1.1510072511296691e+02
-6.5389429882931807e+01 2.8473016814550579e+02
-2.4413301128847326e-01 -5.9043921566746227e-01
-1.0981954452394654e-01 -1.1471953364326626e+02
-6.7281854578760502e+01 2.8584520862597151e+02
-2.2744306144905360e-01 -5.6511050747701908e-01
-1.1099048936468359e-01 -1.1676825664616675e+02
-6.5879980341632006e+01 2.8824548447868079e+02
-1.6845603705375747e-01 -4.0838023009230667e-01
-1.1256679586719609e-01 -1.2507569244699060e+02
-5.9003334244938983e+01 3.1158829074798496e+02
-1.5189713154118348e-01 -1.9716650017199494e-01
-1.1683041805935633e-01 -1.1852270815245059e+02
-4.7958731831223965e+01 3.5579304651735907e+02
-2.0446032726332142e-01 -9.2718209584354408e-02
-1.2548705868528703e-01 -1.1944086579524615e+02
-4.1076494381331152e+01 3.8419021209337694e+02
-3.0196464578287463e-01 -4.5052040795276346e-02
-1.6824242757270744e-01 -1.1881235382862388e+02
-4.0524231994231691e+01 3.7981287987680412e+02
-4.6617095455928764e-01 -6.6249568162980832e-02
-1.7554699979870936e-01 -1.1632648734387148e+02
-5.2353980197334486e+01 3.5398604866867788e+02
-5.2717950986938100e-01 -5.8978992529928803e-02
-1.6306066448580611e-01 -1.1866655171475327e+02
-5.9157891736513349e+01 3.4598454535060728e+02
-5.5427919853521135e-01 -7.5768505109432116e-02
-1.5685222392039408e-01 -1.1784544519473886e+02
-6.3227045247761822e+01 3.3944990147155829e+02</data></extrinsic_parameters>
<image_points type_id="opencv-matrix">
<rows>25</rows>
<cols>54</cols>
<dt>"2f"</dt>
<data>
8.51331329e+01 1.96296341e+02 1.28387009e+02 1.93393860e+02
1.72015030e+02 1.90575867e+02 2.14825974e+02 1.87787292e+02
2.57185364e+02 1.85379623e+02 2.98796234e+02 1.82694366e+02
3.40094849e+02 1.80279602e+02 3.80392914e+02 1.77734970e+02
4.21151276e+02 1.75331161e+02 8.52632751e+01 2.37606674e+02
1.29313477e+02 2.34582947e+02 1.73381088e+02 2.31490341e+02
2.17318466e+02 2.28480499e+02 2.59828613e+02 2.25488754e+02
3.02035706e+02 2.22617950e+02 3.43812988e+02 2.20172028e+02
3.85282379e+02 2.17337296e+02 4.25823883e+02 2.14496109e+02
8.53186493e+01 2.80569092e+02 1.30296982e+02 2.77342926e+02
1.75078110e+02 2.73817993e+02 2.19175751e+02 2.70285889e+02
2.62613586e+02 2.66839325e+02 3.05334747e+02 2.63622772e+02
3.47672760e+02 2.60511414e+02 3.89522949e+02 2.57506378e+02
4.31175140e+02 2.54521957e+02 8.54443436e+01 3.24958954e+02
1.31055832e+02 3.21334320e+02 1.76326111e+02 3.17492676e+02
2.21390701e+02 3.13953644e+02 2.65640900e+02 3.10443604e+02
3.08799255e+02 3.06610260e+02 3.52452087e+02 3.02986084e+02
3.94776276e+02 2.99605682e+02 4.36837189e+02 2.96551605e+02
8.56309586e+01 3.70544128e+02 1.31753632e+02 3.66708466e+02
1.78123444e+02 3.62542664e+02 2.23661240e+02 3.58725037e+02
2.68530457e+02 3.54794647e+02 3.12736084e+02 3.50723755e+02
3.56474457e+02 3.47009125e+02 4.00083221e+02 3.43546875e+02
4.42846375e+02 3.39862091e+02 8.57883453e+01 4.17491455e+02
1.33053299e+02 4.13290436e+02 1.79454117e+02 4.09484131e+02
2.26162552e+02 4.04830872e+02 2.71614136e+02 4.00749146e+02
3.16573395e+02 3.96406921e+02 3.61375824e+02 3.92306396e+02
4.05158630e+02 3.88401398e+02 4.48736420e+02 3.84248260e+02
8.50225677e+01 1.96341049e+02 1.28358429e+02 1.93415390e+02
1.71840775e+02 1.90590454e+02 2.14750107e+02 1.87829269e+02
2.57128876e+02 1.85375076e+02 2.98706299e+02 1.82670853e+02
3.39862488e+02 1.80283951e+02 3.80325317e+02 1.77716354e+02
4.20948608e+02 1.75304703e+02 8.51393204e+01 2.37684875e+02
1.29157547e+02 2.34607056e+02 1.73279449e+02 2.31561050e+02
2.17258270e+02 2.28508911e+02 2.59817047e+02 2.25488281e+02
3.01908447e+02 2.22596039e+02 3.43781586e+02 2.20124481e+02
3.85156525e+02 2.17352325e+02 4.25653809e+02 2.14488205e+02
8.52700882e+01 2.80577545e+02 1.30254013e+02 2.77375092e+02
1.74869644e+02 2.73867310e+02 2.18928436e+02 2.70344482e+02
2.62540466e+02 2.66830566e+02 3.05258209e+02 2.63636932e+02
3.47592163e+02 2.60493958e+02 3.89428741e+02 2.57515564e+02
4.31062378e+02 2.54477386e+02 8.53723450e+01 3.25084045e+02
1.30917084e+02 3.21351776e+02 1.76241226e+02 3.17506866e+02
2.21338745e+02 3.13997528e+02 2.65581787e+02 3.10434967e+02
3.08707703e+02 3.06645691e+02 3.52341125e+02 3.02921967e+02
3.94732056e+02 2.99603302e+02 4.36745392e+02 2.96505920e+02
8.55587234e+01 3.70567719e+02 1.31682709e+02 3.66772949e+02
1.77960052e+02 3.62590881e+02 2.23595932e+02 3.58712799e+02
2.68508453e+02 3.54785248e+02 3.12635559e+02 3.50712921e+02
3.56423737e+02 3.47025146e+02 3.99922546e+02 3.43539001e+02
4.42731567e+02 3.39793030e+02 8.57095032e+01 4.17535767e+02
1.32966812e+02 4.13318573e+02 1.79390579e+02 4.09494141e+02
2.26057083e+02 4.04843018e+02 2.71556335e+02 4.00730865e+02
3.16524994e+02 3.96411591e+02 3.61287323e+02 3.92257507e+02
4.05023621e+02 3.88406311e+02 4.48675140e+02 3.84184692e+02
8.52551422e+01 1.96290146e+02 1.28453751e+02 1.93391693e+02
1.72140732e+02 1.90551315e+02 2.15073776e+02 1.87755722e+02
2.57282501e+02 1.85370361e+02 2.98833374e+02 1.82669693e+02
3.40232544e+02 1.80304230e+02 3.80511871e+02 1.77768433e+02
4.21308502e+02 1.75352737e+02 8.52923050e+01 2.37568146e+02
1.29416306e+02 2.34532349e+02 1.73417953e+02 2.31484390e+02
2.17338776e+02 2.28483887e+02 2.60028534e+02 2.25464691e+02
3.02139679e+02 2.22584320e+02 3.43885986e+02 2.20150131e+02
3.85356537e+02 2.17375259e+02 4.25912567e+02 2.14498734e+02
8.53400421e+01 2.80564545e+02 1.30304886e+02 2.77327301e+02
1.75067245e+02 2.73803131e+02 2.19197113e+02 2.70281677e+02
2.62628113e+02 2.66876007e+02 3.05329956e+02 2.63640869e+02
3.47705902e+02 2.60537689e+02 3.89557404e+02 2.57520660e+02
4.31190369e+02 2.54531967e+02 8.54355469e+01 3.25014954e+02
1.31053787e+02 3.21296539e+02 1.76317398e+02 3.17479614e+02
2.21390854e+02 3.13948730e+02 2.65616943e+02 3.10440582e+02
3.08810394e+02 3.06610779e+02 3.52446075e+02 3.02964417e+02
3.94773132e+02 2.99608185e+02 4.36818512e+02 2.96528534e+02
8.55734482e+01 3.70545349e+02 1.31695160e+02 3.66779968e+02
1.78052475e+02 3.62549988e+02 2.23609756e+02 3.58716766e+02
2.68530396e+02 3.54783325e+02 3.12703430e+02 3.50708221e+02
3.56482361e+02 3.47048584e+02 4.00017090e+02 3.43547058e+02
4.42774841e+02 3.39816528e+02 8.57139664e+01 4.17506439e+02
1.32976715e+02 4.13309967e+02 1.79405121e+02 4.09502167e+02
2.26107254e+02 4.04853119e+02 2.71578247e+02 4.00738007e+02
3.16557831e+02 3.96432861e+02 3.61320496e+02 3.92258392e+02
4.05071289e+02 3.88426483e+02 4.48700470e+02 3.84229706e+02
8.49821472e+01 1.96331619e+02 1.28316605e+02 1.93409927e+02
1.71797745e+02 1.90599503e+02 2.14718353e+02 1.87839478e+02
2.56975189e+02 1.85375580e+02 2.98714966e+02 1.82659485e+02
3.39808807e+02 1.80296738e+02 3.80299957e+02 1.77703339e+02
4.20875092e+02 1.75309479e+02 8.50999069e+01 2.37697479e+02
1.29141190e+02 2.34595520e+02 1.73283386e+02 2.31568039e+02
2.17244675e+02 2.28519775e+02 2.59798035e+02 2.25482727e+02
3.01884674e+02 2.22620895e+02 3.43783264e+02 2.20126526e+02
3.85110352e+02 2.17346939e+02 4.25640686e+02 2.14497955e+02
8.52456055e+01 2.80583679e+02 1.30250473e+02 2.77391022e+02
1.74861298e+02 2.73876892e+02 2.18874069e+02 2.70368164e+02
2.62526062e+02 2.66827881e+02 3.05253143e+02 2.63634552e+02
3.47579834e+02 2.60499756e+02 3.89425323e+02 2.57505524e+02
4.31078461e+02 2.54495163e+02 8.53829117e+01 3.25053345e+02
1.30889130e+02 3.21386993e+02 1.76266602e+02 3.17490875e+02
2.21349030e+02 3.13989594e+02 2.65569336e+02 3.10448669e+02
3.08691040e+02 3.06623199e+02 3.52333618e+02 3.02954803e+02
3.94712372e+02 2.99602325e+02 4.36744629e+02 2.96516327e+02
8.55645523e+01 3.70568726e+02 1.31673279e+02 3.66786316e+02
1.77932678e+02 3.62571472e+02 2.23609177e+02 3.58724884e+02
2.68511047e+02 3.54803253e+02 3.12615692e+02 3.50708954e+02
3.56423584e+02 3.47078827e+02 3.99953094e+02 3.43536438e+02
4.42747345e+02 3.39783356e+02 8.57281952e+01 4.17554871e+02
1.33000854e+02 4.13320526e+02 1.79400589e+02 4.09527954e+02
2.26118530e+02 4.04850342e+02 2.71573242e+02 4.00742554e+02
3.16560425e+02 3.96429047e+02 3.61310516e+02 3.92293335e+02
4.05061737e+02 3.88399078e+02 4.48672302e+02 3.84189209e+02
8.50032959e+01 1.96331894e+02 1.28337936e+02 1.93412842e+02
1.71857590e+02 1.90589752e+02 2.14760818e+02 1.87812744e+02
2.57076904e+02 1.85384201e+02 2.98762726e+02 1.82672958e+02
3.39859100e+02 1.80279434e+02 3.80314636e+02 1.77711334e+02
4.20972656e+02 1.75308273e+02 8.51659470e+01 2.37680710e+02
1.29175156e+02 2.34585388e+02 1.73292358e+02 2.31563446e+02
2.17287766e+02 2.28521667e+02 2.59797089e+02 2.25509109e+02
3.01944489e+02 2.22606995e+02 3.43800171e+02 2.20142212e+02
3.85163177e+02 2.17343292e+02 4.25701569e+02 2.14475937e+02
8.52807999e+01 2.80581055e+02 1.30268143e+02 2.77348022e+02
1.74900940e+02 2.73842438e+02 2.18989136e+02 2.70324463e+02
2.62568726e+02 2.66821991e+02 3.05269836e+02 2.63631073e+02
3.47613556e+02 2.60504333e+02 3.89459229e+02 2.57505707e+02
4.31106323e+02 2.54513214e+02 8.53913879e+01 3.25046387e+02
1.30985184e+02 3.21363281e+02 1.76282349e+02 3.17497192e+02
2.21377701e+02 3.13986145e+02 2.65597534e+02 3.10458313e+02
3.08742371e+02 3.06637177e+02 3.52364532e+02 3.02971954e+02
3.94730713e+02 2.99601776e+02 4.36758850e+02 2.96526001e+02
8.55657501e+01 3.70568146e+02 1.31696213e+02 3.66754272e+02
1.77981201e+02 3.62563843e+02 2.23612473e+02 3.58718170e+02
2.68523926e+02 3.54780365e+02 3.12671631e+02 3.50684204e+02
3.56437988e+02 3.47035400e+02 3.99938232e+02 3.43543060e+02
4.42757446e+02 3.39795807e+02 8.57323227e+01 4.17507385e+02
1.32986908e+02 4.13300201e+02 1.79407745e+02 4.09491638e+02
2.26111755e+02 4.04820374e+02 2.71583008e+02 4.00732361e+02
3.16559204e+02 3.96417023e+02 3.61334900e+02 3.92277588e+02
4.05105927e+02 3.88402313e+02 4.48719849e+02 3.84233582e+02
8.50711975e+01 1.96322571e+02 1.28389771e+02 1.93403305e+02
1.71911911e+02 1.90564987e+02 2.14778549e+02 1.87812607e+02
2.57150818e+02 1.85371338e+02 2.98732605e+02 1.82662460e+02
3.40001190e+02 1.80247635e+02 3.80347778e+02 1.77710083e+02
4.21070587e+02 1.75325775e+02 8.52203674e+01 2.37641068e+02
1.29246643e+02 2.34565384e+02 1.73334671e+02 2.31536469e+02
2.17307281e+02 2.28508148e+02 2.59787811e+02 2.25502655e+02
3.01988831e+02 2.22591507e+02 3.43789825e+02 2.20162567e+02
3.85205475e+02 2.17347824e+02 4.25738770e+02 2.14476044e+02
8.52985535e+01 2.80566162e+02 1.30272156e+02 2.77350342e+02
1.74958389e+02 2.73832397e+02 2.19100342e+02 2.70322845e+02
2.62582428e+02 2.66844727e+02 3.05331299e+02 2.63636688e+02
3.47633850e+02 2.60501587e+02 3.89497986e+02 2.57523193e+02
4.31156738e+02 2.54506119e+02 8.54018097e+01 3.25038422e+02
1.31033997e+02 3.21339233e+02 1.76296753e+02 3.17489166e+02
2.21365311e+02 3.13967010e+02 2.65627716e+02 3.10434906e+02
3.08776947e+02 3.06626953e+02 3.52401672e+02 3.02976654e+02
3.94773254e+02 2.99612335e+02 4.36805145e+02 2.96532959e+02
8.55875168e+01 3.70542603e+02 1.31718307e+02 3.66747101e+02
1.78029861e+02 3.62568848e+02 2.23653320e+02 3.58721405e+02
2.68531647e+02 3.54782990e+02 3.12682556e+02 3.50721222e+02
3.56471008e+02 3.47092743e+02 4.00047211e+02 3.43549042e+02
4.42776642e+02 3.39844574e+02 8.57735443e+01 4.17514099e+02
1.33102097e+02 4.13297882e+02 1.79432114e+02 4.09513519e+02
2.26158859e+02 4.04864655e+02 2.71600311e+02 4.00759491e+02
3.16576874e+02 3.96466858e+02 3.61376678e+02 3.92287262e+02
4.05152374e+02 3.88432343e+02 4.48702209e+02 3.84253967e+02
8.84261246e+01 1.82114380e+02 1.31339813e+02 1.77647751e+02
1.74389694e+02 1.73245972e+02 2.17480881e+02 1.69217316e+02
2.59482391e+02 1.64904083e+02 3.00777985e+02 1.61052246e+02
3.42040375e+02 1.56896027e+02 3.82887756e+02 1.52468140e+02
4.23555145e+02 1.48571243e+02 8.98341827e+01 2.23435730e+02
1.33826111e+02 2.18369583e+02 1.77517441e+02 2.13999573e+02
2.20992477e+02 2.09332474e+02 2.63379486e+02 2.04893646e+02
3.05407959e+02 2.00336395e+02 3.47369141e+02 1.96303314e+02
3.88748932e+02 1.91584915e+02 4.29875763e+02 1.87599579e+02
9.17144394e+01 2.65642914e+02 1.36401535e+02 2.60367188e+02
1.80566254e+02 2.55603973e+02 2.24503769e+02 2.50703964e+02
2.67996216e+02 2.45714706e+02 3.10700287e+02 2.41272110e+02
3.52984955e+02 2.36373062e+02 3.94948853e+02 2.32137680e+02
4.36631653e+02 2.27293243e+02 9.34735718e+01 3.09376556e+02
1.38753891e+02 3.04407471e+02 1.83729095e+02 2.98969269e+02
2.28482086e+02 2.93540497e+02 2.72264679e+02 2.88487854e+02
3.15747162e+02 2.83554718e+02 3.58820618e+02 2.78315155e+02
4.01364868e+02 2.73640015e+02 4.43609985e+02 2.68985870e+02
9.52727432e+01 3.54335724e+02 1.41305557e+02 3.49235291e+02
1.87104340e+02 3.43617706e+02 2.32545502e+02 3.37782654e+02
2.77080170e+02 3.32267639e+02 3.20961731e+02 3.26842041e+02
3.64922791e+02 3.21692749e+02 4.08300995e+02 3.16684265e+02
4.51259766e+02 3.11386871e+02 9.73858871e+01 4.00910706e+02
1.43591064e+02 3.95150391e+02 1.90419464e+02 3.89329834e+02
2.36290863e+02 3.83530121e+02 2.81548370e+02 3.77649292e+02
3.26329834e+02 3.71915375e+02 3.71172485e+02 3.66443695e+02
4.15356689e+02 3.60992859e+02 4.58776398e+02 3.55652924e+02
9.44771805e+01 1.82983932e+02 1.35960251e+02 1.77081894e+02
1.78269165e+02 1.71228271e+02 2.21212448e+02 1.65217514e+02
2.64643829e+02 1.59453934e+02 3.08244873e+02 1.53480042e+02
3.52998535e+02 1.47240265e+02 3.98067596e+02 1.40593307e+02
4.44090179e+02 1.34175751e+02 9.53012924e+01 2.24800415e+02
1.37437302e+02 2.19338242e+02 1.80570007e+02 2.13565399e+02
2.24277802e+02 2.07781296e+02 2.68434601e+02 2.01975159e+02
3.12768341e+02 1.96126984e+02 3.58323242e+02 1.90187622e+02
4.04069977e+02 1.84163040e+02 4.50750885e+02 1.77759476e+02
9.59996872e+01 2.68402130e+02 1.39293320e+02 2.62796478e+02
1.82539124e+02 2.57202301e+02 2.27276917e+02 2.51329163e+02
2.72048248e+02 2.45653671e+02 3.17205475e+02 2.40042953e+02
3.63417328e+02 2.34345825e+02 4.10118408e+02 2.28591858e+02
4.57782593e+02 2.22593063e+02 9.71529160e+01 3.13272614e+02
1.40502136e+02 3.07972870e+02 1.85076889e+02 3.02421082e+02
2.30370575e+02 2.97163910e+02 2.75708618e+02 2.91668060e+02
3.22232391e+02 2.86169037e+02 3.68952728e+02 2.80688110e+02
4.16517975e+02 2.74977142e+02 4.65171509e+02 2.69325439e+02
9.76948853e+01 3.59110352e+02 1.42427048e+02 3.54378143e+02
1.87583557e+02 3.49527344e+02 2.33449936e+02 3.44130920e+02
2.80108765e+02 3.38720276e+02 3.26663330e+02 3.33657074e+02
3.74686371e+02 3.28471436e+02 4.23467651e+02 3.23011047e+02
4.72844482e+02 3.17476105e+02 9.84105911e+01 4.06881989e+02
1.43483887e+02 4.02301025e+02 1.89767197e+02 3.97765625e+02
2.36434341e+02 3.92721954e+02 2.83893524e+02 3.87913391e+02
3.31825226e+02 3.82871429e+02 3.80665833e+02 3.77761200e+02
4.30548096e+02 3.72790466e+02 4.80768250e+02 3.67763916e+02
9.80586853e+01 1.81364288e+02 1.38546967e+02 1.74499496e+02
1.80185760e+02 1.67660141e+02 2.23361343e+02 1.60776291e+02
2.66476715e+02 1.54250015e+02 3.10812897e+02 1.47041275e+02
3.56189484e+02 1.39703766e+02 4.02527740e+02 1.31852356e+02
4.50153442e+02 1.24261513e+02 9.87012329e+01 2.23491455e+02
1.40265457e+02 2.17087006e+02 1.82586136e+02 2.10564926e+02
2.26429840e+02 2.03906036e+02 2.70308319e+02 1.97287201e+02
3.15165436e+02 1.90674347e+02 3.61609863e+02 1.83671127e+02
4.08565308e+02 1.76448624e+02 4.57147095e+02 1.69382690e+02
9.97042236e+01 2.66521698e+02 1.41973724e+02 2.60522095e+02
1.84985382e+02 2.54524796e+02 2.29457138e+02 2.48222031e+02
2.74408417e+02 2.42066391e+02 3.19863525e+02 2.35783783e+02
3.67044312e+02 2.29242249e+02 4.14915344e+02 2.22487198e+02
4.64215393e+02 2.15475357e+02 1.00515358e+02 3.11478729e+02
1.43362061e+02 3.06283264e+02 1.87404633e+02 3.00500824e+02
2.32551712e+02 2.94631256e+02 2.78086426e+02 2.88625793e+02
3.24727325e+02 2.82570892e+02 3.72616486e+02 2.76476746e+02
4.21714417e+02 2.70294403e+02 4.71880402e+02 2.63918671e+02
1.01171211e+02 3.57931213e+02 1.45235687e+02 3.52979553e+02
1.89800705e+02 3.47612305e+02 2.35688431e+02 3.42254761e+02
2.82068665e+02 3.36803162e+02 3.29521515e+02 3.31408478e+02
3.78657990e+02 3.25588318e+02 4.28477081e+02 3.19807648e+02
4.79714447e+02 3.13921692e+02 1.01602592e+02 4.05757355e+02
1.46301697e+02 4.01262085e+02 1.91700378e+02 3.96682709e+02
2.38741516e+02 3.91762146e+02 2.86452789e+02 3.86469818e+02
3.34799225e+02 3.81477356e+02 3.84839508e+02 3.76476135e+02
4.35777222e+02 3.71001160e+02 4.87891907e+02 3.65497955e+02
9.86715546e+01 1.79191299e+02 1.39303177e+02 1.72102982e+02
1.80776138e+02 1.64915405e+02 2.23570908e+02 1.57626953e+02
2.66621918e+02 1.50543884e+02 3.10990723e+02 1.43155014e+02
3.56427368e+02 1.35298691e+02 4.03192810e+02 1.27155045e+02
4.50827637e+02 1.18751099e+02 1.00131546e+02 2.21050415e+02
1.40975876e+02 2.14557877e+02 1.83418793e+02 2.07694763e+02
2.26750366e+02 2.00683594e+02 2.70891907e+02 1.93752182e+02
3.15795532e+02 1.86593048e+02 3.62082123e+02 1.79297989e+02
4.09562103e+02 1.71702621e+02 4.58002380e+02 1.64077103e+02
1.00939682e+02 2.64404144e+02 1.42878296e+02 2.58146332e+02
1.85648743e+02 2.51628754e+02 2.30153763e+02 2.44955673e+02
2.75017212e+02 2.38584076e+02 3.20403778e+02 2.31766571e+02
3.67739166e+02 2.24616776e+02 4.15909668e+02 2.17799820e+02
4.65528351e+02 2.10474106e+02 1.01802986e+02 3.09347992e+02
1.44911926e+02 3.03536469e+02 1.88385727e+02 2.97564514e+02
2.33433716e+02 2.91432800e+02 2.79061035e+02 2.84921387e+02
3.25756348e+02 2.78480133e+02 3.73802399e+02 2.72098328e+02
4.22762878e+02 2.65720245e+02 4.73440063e+02 2.59161560e+02
1.03163116e+02 3.55542938e+02 1.46542709e+02 3.50231171e+02
1.91249771e+02 3.44585205e+02 2.36738876e+02 3.38793854e+02
2.83567474e+02 3.33063354e+02 3.31151581e+02 3.27055450e+02
3.79936615e+02 3.21223999e+02 4.30285461e+02 3.14931305e+02
4.81734222e+02 3.08747040e+02 1.03819397e+02 4.03318787e+02
1.48303909e+02 3.98281372e+02 1.93701889e+02 3.93474426e+02
2.40345062e+02 3.88448090e+02 2.87634125e+02 3.82952179e+02
3.36430237e+02 3.77350983e+02 3.86401855e+02 3.71927979e+02
4.37545502e+02 3.66449860e+02 4.90334961e+02 3.60655060e+02
9.03285828e+01 1.66718552e+02 1.34427612e+02 1.60465622e+02
1.79335358e+02 1.54179108e+02 2.24617157e+02 1.47664734e+02
2.70086945e+02 1.41503052e+02 3.15584015e+02 1.35135025e+02
3.61656738e+02 1.28503113e+02 4.07623352e+02 1.21990982e+02
4.54573029e+02 1.15373787e+02 9.45922928e+01 2.11498596e+02
1.39466599e+02 2.05188019e+02 1.84715958e+02 1.98860916e+02
2.30179565e+02 1.92674927e+02 2.75694183e+02 1.86418610e+02
3.21520294e+02 1.80080048e+02 3.67741760e+02 1.73530502e+02
4.14150543e+02 1.67176849e+02 4.61124634e+02 1.60822845e+02
9.85068436e+01 2.56700806e+02 1.43839188e+02 2.50624207e+02
1.89615234e+02 2.44458420e+02 2.35732437e+02 2.38117722e+02
2.81391785e+02 2.31804001e+02 3.27477570e+02 2.25602661e+02
3.74001892e+02 2.19378647e+02 4.20794128e+02 2.12996811e+02
4.67930634e+02 2.06596375e+02 1.03185249e+02 3.02600830e+02
1.48710648e+02 2.96604279e+02 1.94525986e+02 2.90531158e+02
2.41344193e+02 2.84303131e+02 2.87270874e+02 2.78196991e+02
3.33635864e+02 2.71995941e+02 3.80451782e+02 2.65981506e+02
4.27771667e+02 2.59833405e+02 4.75332367e+02 2.53712677e+02
1.07329193e+02 3.49624542e+02 1.53573792e+02 3.43692322e+02
1.99900238e+02 3.37561523e+02 2.46642578e+02 3.31368134e+02
2.93214752e+02 3.25257111e+02 3.39925140e+02 3.19159424e+02
3.87175842e+02 3.12928497e+02 4.34566498e+02 3.07007019e+02
4.82394348e+02 3.00897064e+02 1.11931396e+02 3.96959106e+02
1.58184067e+02 3.91150696e+02 2.05194229e+02 3.85083313e+02
2.52151184e+02 3.78941254e+02 2.99105713e+02 3.72793976e+02
3.46485413e+02 3.66602295e+02 3.93929932e+02 3.60633087e+02
4.41695312e+02 3.54685303e+02 4.89730103e+02 3.48662964e+02
7.77018661e+01 1.60461884e+02 1.26766129e+02 1.54295547e+02
1.75550079e+02 1.48431168e+02 2.24106918e+02 1.42316284e+02 279.
164. 3.20523987e+02 1.59835571e+02 3.62600677e+02 1.25508888e+02
4.07870789e+02 1.19786926e+02 4.52516663e+02 1.14422707e+02
8.53194885e+01 2.08311798e+02 1.33942184e+02 2.01714249e+02
1.82308914e+02 1.95508789e+02 2.30174942e+02 1.89478500e+02
2.77117828e+02 1.83281494e+02 3.22855774e+02 1.77442642e+02
3.68233856e+02 1.71476486e+02 4.13026245e+02 1.65572601e+02
4.57464722e+02 1.59752457e+02 9.23865051e+01 2.55503494e+02
1.41047272e+02 2.48530182e+02 1.89104111e+02 2.42080414e+02
2.36553833e+02 2.35622574e+02 2.83321106e+02 2.29309326e+02
3.28734802e+02 2.23092941e+02 3.73776031e+02 2.16745529e+02
4.18284027e+02 2.10620071e+02 4.61985046e+02 2.04630219e+02
9.97528305e+01 3.02429291e+02 1.48272247e+02 2.95623169e+02
1.95794830e+02 2.88567963e+02 2.42857666e+02 2.81560150e+02
2.89248657e+02 2.74804138e+02 3.34473633e+02 2.68336670e+02
3.79362946e+02 2.61748169e+02 4.23362457e+02 2.55487244e+02
4.66955444e+02 2.49212738e+02 1.06926361e+02 3.49168182e+02
1.55033829e+02 3.41421448e+02 2.02431442e+02 3.34291962e+02
2.49226334e+02 3.26718079e+02 2.95054230e+02 3.19836426e+02
3.39933105e+02 3.13040405e+02 3.84589508e+02 3.06220703e+02
4.28383331e+02 2.99516541e+02 4.71900635e+02 2.93168945e+02
1.14088799e+02 3.95266235e+02 1.61553391e+02 3.87483978e+02
2.08767044e+02 3.79692841e+02 2.55226410e+02 3.71985626e+02
3.00768707e+02 3.64717133e+02 3.45511627e+02 3.57280365e+02
3.89771790e+02 3.50226440e+02 4.33682648e+02 3.43399445e+02
4.76485901e+02 3.36631195e+02 7.62223129e+01 1.58181839e+02
1.25044930e+02 1.51898407e+02 1.73558701e+02 1.45761078e+02
2.21976074e+02 1.39544724e+02 2.70438141e+02 1.44191620e+02
3.18818634e+02 1.55421188e+02 3.60569916e+02 1.22059090e+02
4.05696442e+02 1.16239883e+02 4.50082092e+02 1.10524948e+02
8.36087570e+01 2.06037659e+02 1.32583176e+02 1.99447495e+02
1.80820648e+02 1.92844025e+02 2.28655914e+02 1.86529800e+02
2.75236633e+02 1.80160492e+02 3.20829590e+02 1.73990631e+02
3.66273743e+02 1.67691391e+02 4.10621002e+02 1.61681274e+02
4.54839966e+02 1.55602829e+02 9.13534927e+01 2.53336487e+02
1.39927826e+02 2.46050613e+02 1.87812027e+02 2.39284988e+02
2.35334610e+02 2.32513489e+02 2.81373077e+02 2.25885986e+02
3.26760071e+02 2.19442719e+02 3.71665161e+02 2.12841827e+02
4.16121216e+02 2.06452744e+02 4.59935852e+02 2.00313690e+02
9.88027573e+01 3.00234467e+02 1.47055389e+02 2.92834717e+02
1.94609451e+02 2.85638519e+02 2.41874985e+02 2.78353943e+02
2.87625946e+02 2.71493225e+02 3.32599335e+02 2.64532166e+02
3.77380127e+02 2.57619232e+02 4.21620667e+02 2.51163620e+02
4.64760712e+02 2.44753296e+02 1.06462997e+02 3.46553070e+02
1.54355164e+02 3.38575165e+02 2.01494324e+02 3.31179199e+02
2.48182709e+02 3.23423950e+02 2.93661530e+02 3.16251007e+02
3.38535339e+02 3.08907501e+02 3.83224823e+02 3.01976379e+02
4.27125824e+02 2.95261627e+02 4.70135101e+02 2.88432404e+02
1.13697708e+02 3.92510132e+02 1.61169861e+02 3.84514923e+02
2.08307236e+02 3.76504089e+02 2.54423935e+02 3.68453796e+02
2.99860901e+02 3.60829651e+02 3.44429871e+02 3.53187988e+02
3.88845093e+02 3.45747650e+02 4.32285339e+02 3.38589355e+02
4.75456665e+02 3.31668976e+02 7.15427017e+01 1.56711731e+02
1.18524857e+02 1.49100861e+02 1.65150787e+02 1.41820862e+02
2.11343216e+02 1.34475113e+02 2.56468536e+02 1.27942940e+02
3.00591431e+02 1.21201393e+02 3.44160400e+02 1.14324608e+02
3.87057800e+02 1.07465866e+02 4.29424744e+02 1.00808784e+02
7.93596039e+01 2.02454178e+02 1.26334602e+02 1.94450684e+02
1.72889832e+02 1.86841156e+02 2.19082748e+02 1.79385803e+02
2.64008026e+02 1.72040802e+02 3.07966888e+02 1.64628983e+02
3.51549957e+02 1.57631927e+02 3.94411865e+02 1.50522278e+02
4.36538208e+02 1.43446289e+02 8.67570877e+01 2.48116196e+02
1.34088501e+02 2.39665176e+02 1.80668243e+02 2.31715668e+02
2.26734375e+02 2.23653244e+02 2.71593689e+02 2.15973007e+02
3.15571075e+02 2.08584778e+02 3.58937775e+02 2.00786850e+02
4.01639984e+02 1.93592056e+02 4.43782684e+02 1.86297638e+02
9.47305069e+01 2.94121948e+02 1.41832001e+02 2.85510376e+02
1.88409332e+02 2.77056244e+02 2.34450577e+02 2.68591583e+02
2.79229889e+02 2.60305756e+02 3.23089691e+02 2.52329193e+02
3.66586975e+02 2.44481049e+02 4.09350708e+02 2.36653641e+02
4.51418030e+02 2.29213669e+02 1.02544960e+02 3.39875824e+02
1.49595108e+02 3.31068024e+02 1.96238708e+02 3.21922272e+02
2.41973663e+02 3.13067505e+02 2.86703522e+02 3.04550720e+02
3.30626831e+02 2.96188354e+02 3.74219025e+02 2.87830444e+02
4.16890930e+02 2.79865417e+02 4.58996033e+02 2.71931061e+02
1.10508347e+02 3.85987610e+02 1.57403732e+02 3.76566010e+02
2.03702637e+02 3.67335571e+02 2.49616257e+02 3.57971771e+02
2.94414398e+02 3.48961060e+02 3.38282104e+02 3.39992065e+02
3.81744537e+02 3.31451050e+02 4.24565460e+02 3.22969269e+02
4.66679626e+02 3.14858643e+02 3.27092323e+01 9.87246704e+01
8.97468338e+01 9.71260681e+01 1.43232956e+02 9.54085388e+01
1.93791977e+02 9.43822174e+01 2.40593262e+02 9.34236908e+01
2.84504608e+02 9.24695740e+01 3.25974304e+02 9.16651077e+01
3.64976501e+02 9.06741104e+01 4.01611420e+02 8.95961685e+01
3.95298004e+01 1.51748276e+02 9.68877411e+01 1.48320404e+02
1.50648621e+02 1.45252930e+02 2.01498856e+02 1.42471924e+02
2.48575012e+02 1.39798981e+02 2.92562836e+02 1.37351028e+02
3.33732178e+02 1.35184097e+02 3.72616180e+02 1.33329605e+02
4.09308624e+02 1.30945267e+02 4.64361115e+01 2.05733902e+02
1.04090721e+02 2.00319962e+02 1.58262344e+02 1.95555679e+02
2.09303268e+02 1.91017441e+02 2.56576538e+02 1.87027954e+02
3.00553894e+02 1.82806976e+02 3.41748962e+02 1.79248581e+02
3.80524109e+02 1.75838257e+02 4.17327148e+02 1.72665482e+02
5.35060234e+01 2.61156525e+02 1.11606369e+02 2.54005112e+02
1.66342392e+02 2.47307266e+02 2.17449905e+02 2.40862778e+02
2.64591278e+02 2.34926163e+02 3.08483002e+02 2.29538513e+02
3.50083923e+02 2.24204514e+02 3.88818909e+02 2.19398346e+02
4.25354034e+02 2.14886307e+02 6.11975174e+01 3.17436676e+02
1.19336746e+02 3.08335632e+02 1.73905075e+02 2.99467224e+02
2.25275085e+02 2.91143341e+02 2.72534363e+02 2.83588867e+02
3.16733429e+02 2.76338776e+02 3.58433441e+02 2.69527740e+02
3.97411041e+02 2.63357056e+02 4.33938538e+02 2.57561340e+02
6.88724442e+01 3.75317261e+02 1.27568871e+02 3.63682526e+02
1.82278152e+02 3.52949341e+02 2.33521011e+02 3.42642639e+02
2.81093201e+02 3.32960815e+02 3.25341492e+02 3.24159393e+02
3.66771851e+02 3.15872894e+02 4.05882355e+02 3.08256348e+02
4.42782745e+02 3.01081177e+02 5.01351662e+01 6.16011505e+01
1.07583366e+02 6.56689911e+01 1.60601028e+02 7.03041229e+01
2.09185410e+02 7.41998825e+01 2.53626877e+02 7.84690704e+01
2.94666473e+02 8.22765808e+01 3.32644684e+02 8.55296555e+01
3.68143921e+02 8.85487061e+01 4.00989014e+02 9.13928833e+01
5.57136230e+01 1.15377251e+02 1.13558708e+02 1.17295006e+02
1.67150421e+02 1.19505325e+02 2.16589432e+02 1.21846069e+02
2.61534454e+02 1.23867310e+02 3.02561523e+02 1.25553123e+02
3.40743927e+02 1.27613449e+02 3.75992096e+02 1.28906082e+02
4.08823120e+02 1.30527817e+02 6.14391174e+01 1.70602341e+02
1.20281837e+02 1.70474991e+02 1.74539154e+02 1.70452072e+02
2.24252747e+02 1.70440094e+02 2.69298889e+02 1.70495224e+02
3.10861359e+02 1.70421051e+02 3.49243317e+02 1.70409912e+02
3.84489136e+02 1.70445496e+02 4.17480591e+02 1.70397766e+02
6.76602859e+01 2.28697189e+02 1.27420921e+02 2.26015671e+02
1.82149109e+02 2.23306107e+02 2.32379440e+02 2.20749039e+02
2.77642639e+02 2.18393616e+02 3.19307404e+02 2.16535522e+02
3.57767273e+02 2.14613129e+02 3.93341949e+02 2.12709885e+02
4.26339020e+02 2.11531876e+02 7.42105942e+01 2.88106781e+02
1.34492157e+02 2.82466522e+02 1.89650482e+02 2.77377777e+02
2.40220551e+02 2.72198029e+02 2.85934082e+02 2.67720367e+02
3.27726196e+02 2.63449066e+02 3.66653961e+02 2.59860687e+02
4.02537048e+02 2.56541626e+02 4.35672699e+02 2.53504578e+02
8.15050430e+01 3.49898376e+02 1.42441269e+02 3.40948273e+02
1.97783279e+02 3.32666077e+02 2.48624649e+02 3.25302216e+02
2.94631470e+02 3.18247559e+02 3.36688324e+02 3.11977600e+02
3.75643555e+02 3.06305786e+02 4.11757050e+02 3.01190948e+02
4.45344116e+02 2.96253052e+02 5.25307045e+01 5.76210976e+01
1.09716095e+02 6.23750572e+01 1.62087997e+02 6.74343796e+01
2.10487045e+02 7.17949142e+01 2.54657333e+02 7.66467896e+01
2.95676086e+02 8.05022659e+01 3.33680237e+02 8.44631348e+01
3.68987579e+02 8.78513718e+01 4.01760864e+02 9.10149384e+01
5.73347130e+01 1.10811729e+02 1.15194138e+02 1.13644409e+02
1.68282837e+02 1.16432678e+02 2.17576248e+02 1.19280777e+02
2.62407593e+02 1.21779182e+02 3.03500305e+02 1.24301735e+02
3.41474487e+02 1.26298882e+02 3.76688446e+02 1.28279877e+02
4.09509064e+02 1.30244751e+02 6.24365311e+01 1.66430847e+02
1.21315056e+02 1.66722122e+02 1.75370544e+02 1.67300262e+02
2.24654068e+02 1.67623734e+02 2.69634430e+02 1.68263077e+02
3.11371979e+02 1.68894547e+02 3.49624756e+02 1.69305847e+02
3.84897888e+02 1.69529053e+02 4.17928772e+02 1.69729416e+02
6.80737305e+01 2.23978592e+02 1.27568947e+02 2.21657227e+02
1.82245010e+02 2.19892868e+02 2.32467499e+02 2.17958008e+02
2.77746124e+02 2.16001755e+02 3.19363068e+02 2.14665451e+02
3.57910736e+02 2.12995300e+02 3.93513153e+02 2.11877411e+02
4.26483124e+02 2.11092484e+02 7.42097549e+01 2.83525696e+02
1.34265900e+02 2.78303162e+02 1.89334976e+02 2.73676514e+02
2.39720627e+02 2.69286255e+02 2.85630615e+02 2.65518005e+02
3.27553833e+02 2.61720764e+02 3.66485748e+02 2.58365784e+02
4.02443634e+02 2.55184021e+02 4.35651520e+02 2.52578262e+02
8.06469269e+01 3.44792419e+02 1.41565872e+02 3.36721283e+02
1.97127701e+02 3.29168335e+02 2.48047226e+02 3.22263428e+02
2.93959900e+02 3.15793549e+02 3.36174377e+02 3.10148560e+02
3.75297302e+02 3.04853607e+02 4.11416443e+02 2.99867310e+02
4.45182465e+02 2.95665100e+02 4.96459427e+01 6.22876129e+01
1.06999191e+02 6.61681061e+01 1.59667740e+02 7.03029022e+01
2.08589920e+02 7.39289169e+01 2.53437286e+02 7.76086273e+01
2.94836273e+02 8.11587601e+01 3.33511902e+02 8.43860550e+01
3.69519745e+02 8.69586716e+01 4.03102814e+02 8.95384521e+01
5.45789032e+01 1.15708603e+02 1.12429092e+02 1.17503189e+02
1.65772614e+02 1.19395615e+02 2.15324844e+02 1.21542381e+02
2.60541626e+02 1.23091942e+02 3.02333923e+02 1.24919159e+02
3.41097839e+02 1.26633110e+02 3.77021881e+02 1.27975853e+02
4.10585022e+02 1.29155121e+02 5.94712181e+01 1.70567856e+02
1.18413918e+02 1.70384109e+02 1.72543930e+02 1.70194611e+02
2.22405533e+02 1.70010788e+02 2.68013092e+02 1.69960617e+02
3.10067200e+02 1.69742828e+02 3.48982452e+02 1.69641647e+02
3.84888977e+02 1.69559219e+02 4.18646881e+02 1.69468491e+02
6.52054749e+01 2.27727188e+02 1.24547600e+02 2.25064117e+02
1.79305603e+02 2.22497818e+02 2.29746033e+02 2.20358871e+02
2.75447571e+02 2.17874939e+02 3.17467804e+02 2.15643921e+02
3.56896271e+02 2.14229965e+02 3.93265991e+02 2.12256729e+02
4.26914093e+02 2.10943817e+02 7.11576920e+01 2.86813599e+02
1.31103836e+02 2.81279785e+02 1.86143204e+02 2.76154236e+02
2.36837845e+02 2.71504303e+02 2.83240234e+02 2.66764343e+02
3.25618774e+02 2.62881165e+02 3.65217773e+02 2.59434967e+02
4.01718842e+02 2.56055573e+02 4.35747223e+02 2.52727982e+02
7.75331879e+01 3.47489655e+02 1.38061111e+02 3.39110413e+02
1.93728729e+02 3.31410492e+02 2.44729935e+02 3.23806274e+02
2.91173157e+02 3.17188965e+02 3.33801178e+02 3.11202606e+02
3.73459229e+02 3.05509827e+02 4.10424011e+02 3.00548981e+02
4.44786835e+02 2.95883850e+02 5.18795509e+01 8.86540451e+01
1.06170219e+02 8.83121414e+01 1.57620407e+02 8.83252563e+01
2.06421188e+02 8.83901443e+01 2.52429138e+02 8.87737427e+01
2.95926666e+02 8.91047592e+01 3.37427094e+02 8.92489243e+01
3.76598969e+02 8.92696457e+01 4.13717377e+02 8.93141708e+01
5.62779808e+01 1.39507812e+02 1.10738167e+02 1.37537399e+02
1.62955109e+02 1.36437943e+02 2.12199112e+02 1.34910950e+02
2.58659271e+02 1.33937851e+02 3.02282776e+02 1.33070618e+02
3.43703003e+02 1.31852371e+02 3.82850830e+02 1.31107605e+02
4.20310608e+02 1.30263474e+02 6.10467758e+01 1.91203979e+02
1.16051537e+02 1.88093903e+02 1.68559998e+02 1.85202789e+02
2.18251724e+02 1.82407501e+02 2.64751831e+02 1.79864075e+02
3.08600403e+02 1.77711945e+02 3.50329041e+02 1.75515900e+02
3.89533966e+02 1.73292007e+02 4.27256500e+02 1.71056168e+02
6.59022522e+01 2.44541046e+02 1.21500290e+02 2.39551773e+02
1.74398697e+02 2.35431564e+02 2.24291702e+02 2.30813324e+02
2.71315979e+02 2.26949097e+02 3.15077240e+02 2.23459839e+02
3.56946747e+02 2.19819824e+02 3.96656708e+02 2.16421570e+02
4.34268982e+02 2.13261490e+02 7.12556763e+01 2.98518890e+02
1.27192841e+02 2.92194183e+02 1.80115479e+02 2.85999329e+02
2.30320221e+02 2.80207825e+02 2.77507019e+02 2.74700714e+02
3.21686035e+02 2.69351349e+02 3.64033020e+02 2.64620026e+02
4.03898834e+02 2.60166351e+02 4.41784027e+02 2.55947403e+02
7.68783875e+01 3.53347046e+02 1.32909470e+02 3.45327087e+02
1.86128372e+02 3.37626434e+02 2.36549088e+02 3.30084290e+02
2.83968689e+02 3.23014099e+02 3.28620941e+02 3.16605927e+02
3.70896118e+02 3.10528625e+02 4.11230499e+02 3.04729462e+02
4.49485352e+02 2.99255096e+02 9.79588470e+01 1.25613358e+02
1.45345581e+02 1.22204407e+02 1.91267044e+02 1.19064331e+02
2.36367889e+02 1.15997849e+02 2.80280426e+02 1.13339073e+02
3.22667511e+02 1.10438759e+02 3.64267181e+02 1.07511208e+02
4.04482849e+02 1.04527374e+02 4.44201294e+02 1.01697334e+02
1.01889381e+02 1.70516571e+02 1.49550232e+02 1.66684906e+02
1.96392929e+02 1.62884628e+02 2.41727936e+02 1.59188675e+02
2.85509796e+02 1.55408157e+02 3.28445923e+02 1.52111145e+02
3.70140106e+02 1.48783356e+02 4.10591064e+02 1.45577271e+02
4.50523468e+02 1.42279755e+02 1.06219345e+02 2.16354965e+02
1.54406708e+02 2.11709259e+02 2.00965622e+02 2.07182281e+02
2.46946793e+02 2.02870697e+02 2.90781555e+02 1.98708023e+02
3.33996918e+02 1.94428909e+02 3.76275391e+02 1.90616547e+02
4.16986084e+02 1.86632401e+02 4.57249329e+02 1.82608063e+02
1.10269897e+02 2.63098267e+02 1.58577271e+02 2.57622772e+02
2.06048492e+02 2.52591110e+02 2.52113678e+02 2.47614807e+02
2.96439606e+02 2.42500244e+02 3.39875793e+02 2.37985413e+02
3.82421021e+02 2.33205765e+02 4.23645569e+02 2.28820496e+02
4.63861725e+02 2.24360428e+02 1.14624184e+02 3.10597412e+02
1.63540070e+02 3.04590118e+02 2.11076889e+02 2.98682404e+02
2.57294464e+02 2.92776825e+02 3.02039856e+02 2.87207336e+02
3.45757477e+02 2.81615662e+02 3.88728088e+02 2.76560242e+02
4.30553040e+02 2.71645081e+02 4.71097870e+02 2.66532074e+02
1.19021294e+02 3.58818878e+02 1.67877228e+02 3.52184082e+02
2.15712677e+02 3.45468201e+02 2.62753265e+02 3.38767883e+02
3.07963196e+02 3.32545624e+02 3.52012817e+02 3.26471924e+02
3.95131653e+02 3.20693848e+02 4.37253418e+02 3.15155823e+02
4.78510895e+02 3.09730194e+02 1.13375885e+02 1.45173264e+02
1.56683014e+02 1.40316269e+02 1.99673294e+02 1.36420593e+02
2.41981613e+02 1.31881836e+02 2.83654602e+02 1.28097275e+02
3.24494934e+02 1.24189674e+02 3.65083771e+02 1.19787041e+02
4.05197388e+02 1.15778297e+02 4.44941925e+02 1.11718040e+02
1.16352310e+02 1.86039322e+02 1.60514908e+02 1.81500443e+02
2.03527191e+02 1.76567398e+02 2.46665695e+02 1.72377792e+02
2.88560394e+02 1.67454666e+02 3.29743652e+02 1.63534409e+02
3.70837555e+02 1.58738861e+02 4.11408691e+02 1.54767792e+02
4.51480133e+02 1.50293930e+02 1.19399208e+02 2.28132721e+02
1.64059357e+02 2.23272858e+02 2.08121262e+02 2.18063309e+02
2.51250320e+02 2.13068222e+02 2.93491669e+02 2.08487671e+02
3.35322083e+02 2.03376282e+02 3.76992340e+02 1.98836288e+02
4.17727753e+02 1.94177750e+02 4.58310364e+02 1.89572235e+02
1.22618759e+02 2.71750336e+02 1.67592712e+02 2.66138336e+02
2.12185715e+02 2.60511139e+02 2.56349854e+02 2.55306107e+02
2.99038269e+02 2.50270874e+02 3.41188965e+02 2.44969330e+02
3.83204254e+02 2.39653412e+02 4.24624725e+02 2.34950119e+02
4.65444946e+02 2.30127380e+02 1.25753075e+02 3.16059113e+02
1.71680511e+02 3.10268494e+02 2.16610382e+02 3.04443054e+02
2.60996521e+02 2.98547089e+02 3.04623016e+02 2.92786072e+02
3.47105255e+02 2.87188324e+02 3.89482269e+02 2.81653351e+02
4.31523773e+02 2.76545898e+02 4.73009705e+02 2.71491974e+02
1.29384216e+02 3.61731842e+02 1.75604736e+02 3.55434509e+02
2.21017502e+02 3.49086792e+02 2.66129883e+02 3.42698975e+02
3.10204132e+02 3.36587677e+02 3.53256226e+02 3.30672943e+02
3.96387909e+02 3.24888580e+02 4.38815125e+02 3.19379669e+02
4.80671387e+02 3.13731415e+02 1.11752029e+02 1.45367035e+02
1.55029724e+02 1.38557770e+02 1.98153488e+02 1.32129745e+02
2.41243469e+02 1.25622116e+02 2.83368988e+02 1.19706642e+02
3.24987579e+02 1.13577148e+02 3.66532440e+02 1.07348679e+02
4.07681519e+02 1.01074814e+02 4.48544983e+02 9.48030090e+01
1.15353447e+02 1.85363251e+02 1.59583084e+02 1.78622131e+02
2.03364243e+02 1.71878174e+02 2.47265717e+02 1.65319962e+02
2.89934357e+02 1.58588333e+02 3.32259766e+02 1.52165436e+02
3.74435638e+02 1.45679962e+02 4.16271820e+02 1.39393311e+02
4.57555298e+02 1.32847122e+02 1.18849091e+02 2.26975708e+02
1.64062683e+02 2.19775528e+02 2.08730576e+02 2.12596252e+02
2.53271637e+02 2.05637711e+02 2.96622284e+02 1.98843552e+02
3.39650513e+02 1.91928818e+02 3.82574249e+02 1.85212631e+02
4.25024689e+02 1.78566605e+02 4.67309509e+02 1.71779633e+02
1.22501907e+02 2.70346832e+02 1.68786072e+02 2.62793457e+02
2.14435867e+02 2.55324097e+02 2.59597107e+02 2.47946121e+02
3.03836151e+02 2.40653519e+02 3.47493317e+02 2.33456039e+02
3.91277466e+02 2.26410400e+02 4.34543701e+02 2.19359665e+02
4.77407104e+02 2.12470627e+02 1.26401367e+02 3.14915131e+02
1.73407715e+02 3.07345215e+02 2.20029465e+02 2.99367767e+02
2.66071838e+02 2.91547577e+02 3.11125610e+02 2.83831085e+02
3.55688660e+02 2.76358459e+02 4.00364868e+02 2.68885895e+02
4.44427979e+02 2.61515320e+02 4.88057465e+02 2.54296600e+02
1.30605194e+02 3.61685760e+02 1.78406631e+02 3.53379089e+02
2.25735504e+02 3.45164825e+02 2.72612183e+02 3.36915894e+02
3.18832397e+02 3.28871857e+02 3.64387115e+02 3.20827393e+02
4.09710175e+02 3.13330780e+02 4.54569977e+02 3.05410675e+02
4.99111481e+02 2.97808624e+02 1.01000893e+02 1.17106102e+02
1.47753143e+02 1.10500809e+02 1.93941406e+02 1.04240860e+02
2.39643005e+02 9.79867859e+01 2.84530212e+02 9.22509079e+01
3.28705475e+02 8.62585907e+01 3.72582611e+02 8.02731247e+01
4.15742798e+02 7.40765991e+01 4.58454163e+02 6.80813599e+01
1.03172127e+02 1.56205307e+02 1.51268143e+02 1.49197540e+02
1.98801453e+02 1.42533981e+02 2.45828400e+02 1.36073975e+02
2.91881226e+02 1.29353668e+02 3.37190643e+02 1.22669540e+02
3.82187347e+02 1.16499992e+02 4.26541046e+02 1.10165886e+02
4.70338898e+02 1.04043823e+02 1.04648582e+02 1.97229141e+02
1.54728516e+02 1.89940430e+02 2.03550491e+02 1.82560959e+02
2.52382568e+02 1.75618835e+02 2.99596222e+02 1.68722809e+02
3.46233032e+02 1.61569992e+02 3.92612488e+02 1.54805069e+02
4.38180847e+02 1.48179230e+02 4.83147827e+02 1.41331146e+02
1.06960777e+02 2.41413132e+02 1.58306778e+02 2.33464813e+02
2.09159637e+02 2.25705139e+02 2.59411133e+02 2.18095703e+02
3.07985260e+02 2.10493210e+02 3.55797821e+02 2.03208237e+02
4.03499176e+02 1.95638092e+02 4.50493683e+02 1.88353516e+02
4.96718018e+02 1.81583847e+02 1.09019302e+02 2.87863434e+02
1.62290482e+02 2.79722595e+02 2.14831131e+02 2.71555573e+02
2.66380249e+02 2.62997772e+02 3.16620728e+02 2.54764069e+02
3.66313782e+02 2.46767822e+02 4.15361084e+02 2.38941666e+02
4.63722076e+02 2.31145950e+02 5.11525909e+02 2.23621643e+02
1.11006981e+02 3.37965912e+02 1.66330414e+02 3.28876831e+02
2.20663269e+02 3.19779755e+02 2.74175903e+02 3.10805359e+02
3.26053680e+02 3.01996399e+02 3.77238403e+02 2.93422089e+02
4.27929291e+02 2.85118561e+02 4.77864899e+02 2.76669708e+02
5.27158630e+02 2.68480774e+02 9.15009537e+01 1.01198700e+02
1.39253433e+02 9.51180649e+01 1.86405823e+02 8.92772903e+01
2.33314255e+02 8.35257416e+01 2.79471375e+02 7.85940170e+01
3.24730103e+02 7.33290176e+01 3.69891357e+02 6.77756805e+01
4.14363342e+02 6.20392075e+01 4.58186096e+02 5.64895973e+01
9.15697479e+01 1.39202164e+02 1.40681778e+02 1.32599396e+02
1.90066559e+02 1.26483177e+02 2.38643326e+02 1.20428383e+02
2.86077728e+02 1.14357590e+02 3.32849884e+02 1.08459358e+02
3.79346832e+02 1.02751701e+02 4.25323273e+02 9.71122665e+01
4.70477692e+02 9.14272766e+01 9.14643631e+01 1.79283737e+02
1.42756012e+02 1.72676666e+02 1.93755081e+02 1.65963440e+02
2.43916946e+02 1.59299728e+02 2.92938782e+02 1.52841599e+02
3.41455231e+02 1.46307434e+02 3.89539337e+02 1.40072784e+02
4.36767914e+02 1.33886017e+02 4.83644104e+02 1.27716362e+02
9.14230804e+01 2.23074951e+02 1.44783951e+02 2.15586945e+02
1.97416138e+02 2.08599731e+02 2.49769852e+02 2.01350571e+02
3.00561127e+02 1.94242615e+02 3.50717224e+02 1.87595352e+02
4.00408081e+02 1.80451691e+02 4.49464203e+02 1.73444550e+02
4.97710785e+02 1.67178391e+02 9.12802963e+01 2.69423462e+02
1.46768326e+02 2.62175323e+02 2.01837311e+02 2.54141373e+02
2.56130951e+02 2.46247818e+02 3.08626099e+02 2.38670105e+02
3.60554840e+02 2.30968750e+02 4.12299103e+02 2.23647003e+02
4.63170593e+02 2.16147446e+02 5.13355652e+02 2.09064774e+02
9.12515259e+01 3.20336670e+02 1.48912231e+02 3.11439880e+02
2.06145599e+02 3.03140350e+02 2.62644531e+02 2.94496613e+02
3.17474182e+02 2.86354980e+02 3.71468353e+02 2.78110565e+02
4.24983704e+02 2.70160522e+02 4.78011993e+02 2.62203156e+02
5.29929138e+02 2.54281631e+02 8.88959045e+01 9.13380737e+01
1.37444489e+02 8.56858978e+01 1.85508377e+02 8.03150787e+01
2.33413696e+02 7.53735275e+01 2.80290070e+02 7.09578934e+01
3.26235046e+02 6.59828873e+01 3.71931305e+02 6.15562706e+01
4.16612671e+02 5.63262138e+01 4.60891602e+02 5.16395950e+01
8.84546204e+01 1.28202011e+02 1.39047958e+02 1.22317757e+02
1.88628815e+02 1.16803062e+02 2.38612610e+02 1.11451820e+02
2.86844757e+02 1.06170311e+02 3.34394592e+02 1.00794624e+02
3.81534729e+02 9.55665970e+01 4.27843018e+02 9.05992584e+01
4.73479187e+02 8.56685791e+01 8.75827332e+01 1.68019089e+02
1.40261810e+02 1.61839371e+02 1.92296021e+02 1.55592377e+02
2.43775238e+02 1.49752838e+02 2.93710846e+02 1.44180054e+02
3.43074554e+02 1.38215607e+02 3.92016266e+02 1.32533005e+02
4.39938751e+02 1.27212250e+02 4.87443939e+02 1.21574013e+02
8.65856323e+01 2.11732086e+02 1.42099792e+02 2.05184738e+02
1.96291901e+02 1.98268295e+02 2.49617584e+02 1.91624420e+02
3.01594971e+02 1.85244400e+02 3.52673859e+02 1.79120819e+02
4.03353424e+02 1.72713379e+02 4.53339539e+02 1.66594101e+02
5.02193909e+02 1.60710251e+02 8.58644409e+01 2.58492584e+02
1.43410263e+02 2.51305878e+02 2.00122498e+02 2.44395706e+02
2.55717911e+02 2.36624680e+02 3.09888000e+02 2.29723083e+02
3.62912811e+02 2.22598663e+02 4.15524078e+02 2.15560852e+02
4.67456085e+02 2.08916016e+02 5.18456299e+02 2.02520279e+02
8.52341919e+01 3.09692627e+02 1.45117798e+02 3.01677826e+02
2.04081284e+02 2.93487885e+02 2.62480865e+02 2.85465790e+02
3.18700989e+02 2.77728638e+02 3.73876404e+02 2.69847198e+02
4.29016937e+02 2.62674438e+02 4.82707794e+02 2.54879745e+02
5.35729797e+02 2.47725281e+02</data></image_points>
</opencv_storage>

BIN
lib/CameraCalibration.o Normal file

Binary file not shown.

9
makefile Normal file
View File

@ -0,0 +1,9 @@
all: CameraCalibration
g++ lib/CameraCalibration.o -o bin/CameraCalibration -L/usr/lib/x86_64-linux-gnu `pkg-config --libs opencv4`
CameraCalibration: src/CameraCalibration.cpp
g++ -c src/CameraCalibration.cpp -o lib/CameraCalibration.o -I./include -I/usr/include/opencv4
clean:
rm lib/*.o
rm bin/*

769
src/CameraCalibration.cpp Normal file
View File

@ -0,0 +1,769 @@
#include <iostream>
#include <sstream>
#include <string>
#include <ctime>
#include <cstdio>
#include <opencv2/core.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
using namespace cv;
using namespace std;
class Settings
{
public:
Settings() : goodInput(false) {}
enum Pattern { NOT_EXISTING, CHESSBOARD, CIRCLES_GRID, ASYMMETRIC_CIRCLES_GRID };
enum InputType { INVALID, CAMERA, VIDEO_FILE, IMAGE_LIST };
void write(FileStorage& fs) const //Write serialization for this class
{
fs << "{"
<< "BoardSize_Width" << boardSize.width
<< "BoardSize_Height" << boardSize.height
<< "Square_Size" << squareSize
<< "Calibrate_Pattern" << patternToUse
<< "Calibrate_NrOfFrameToUse" << nrFrames
<< "Calibrate_FixAspectRatio" << aspectRatio
<< "Calibrate_AssumeZeroTangentialDistortion" << calibZeroTangentDist
<< "Calibrate_FixPrincipalPointAtTheCenter" << calibFixPrincipalPoint
<< "Write_DetectedFeaturePoints" << writePoints
<< "Write_extrinsicParameters" << writeExtrinsics
<< "Write_gridPoints" << writeGrid
<< "Write_outputFileName" << outputFileName
<< "Show_UndistortedImage" << showUndistorted
<< "Input_FlipAroundHorizontalAxis" << flipVertical
<< "Input_Delay" << delay
<< "Input" << input
<< "}";
}
void read(const FileNode& node) //Read serialization for this class
{
node["BoardSize_Width" ] >> boardSize.width;
node["BoardSize_Height"] >> boardSize.height;
node["Calibrate_Pattern"] >> patternToUse;
node["Square_Size"] >> squareSize;
node["Calibrate_NrOfFrameToUse"] >> nrFrames;
node["Calibrate_FixAspectRatio"] >> aspectRatio;
node["Write_DetectedFeaturePoints"] >> writePoints;
node["Write_extrinsicParameters"] >> writeExtrinsics;
node["Write_gridPoints"] >> writeGrid;
node["Write_outputFileName"] >> outputFileName;
node["Calibrate_AssumeZeroTangentialDistortion"] >> calibZeroTangentDist;
node["Calibrate_FixPrincipalPointAtTheCenter"] >> calibFixPrincipalPoint;
node["Calibrate_UseFisheyeModel"] >> useFisheye;
node["Input_FlipAroundHorizontalAxis"] >> flipVertical;
node["Show_UndistortedImage"] >> showUndistorted;
node["Input"] >> input;
node["Input_Delay"] >> delay;
node["Fix_K1"] >> fixK1;
node["Fix_K2"] >> fixK2;
node["Fix_K3"] >> fixK3;
node["Fix_K4"] >> fixK4;
node["Fix_K5"] >> fixK5;
validate();
}
void validate()
{
goodInput = true;
if (boardSize.width <= 0 || boardSize.height <= 0)
{
cerr << "Invalid Board size: " << boardSize.width << " " << boardSize.height << endl;
goodInput = false;
}
if (squareSize <= 10e-6)
{
cerr << "Invalid square size " << squareSize << endl;
goodInput = false;
}
if (nrFrames <= 0)
{
cerr << "Invalid number of frames " << nrFrames << endl;
goodInput = false;
}
if (input.empty()) // Check for valid input
inputType = INVALID;
else
{
if (input[0] >= '0' && input[0] <= '9')
{
stringstream ss(input);
ss >> cameraID;
inputType = CAMERA;
}
else
{
if (isListOfImages(input) && readStringList(input, imageList))
{
inputType = IMAGE_LIST;
nrFrames = (nrFrames < (int)imageList.size()) ? nrFrames : (int)imageList.size();
}
else
inputType = VIDEO_FILE;
}
if (inputType == CAMERA)
inputCapture.open(cameraID, cv::CAP_V4L2);
if (inputType == VIDEO_FILE)
inputCapture.open(input);
if (inputType != IMAGE_LIST && !inputCapture.isOpened())
inputType = INVALID;
}
if (inputType == INVALID)
{
cerr << " Input does not exist: " << input;
goodInput = false;
}
flag = 0;
if(calibFixPrincipalPoint) flag |= CALIB_FIX_PRINCIPAL_POINT;
if(calibZeroTangentDist) flag |= CALIB_ZERO_TANGENT_DIST;
if(aspectRatio) flag |= CALIB_FIX_ASPECT_RATIO;
if(fixK1) flag |= CALIB_FIX_K1;
if(fixK2) flag |= CALIB_FIX_K2;
if(fixK3) flag |= CALIB_FIX_K3;
if(fixK4) flag |= CALIB_FIX_K4;
if(fixK5) flag |= CALIB_FIX_K5;
if (useFisheye)
{
// the fisheye model has its own enum, so overwrite the flags
flag = fisheye::CALIB_FIX_SKEW | fisheye::CALIB_RECOMPUTE_EXTRINSIC;
if(fixK1) flag |= fisheye::CALIB_FIX_K1;
if(fixK2) flag |= fisheye::CALIB_FIX_K2;
if(fixK3) flag |= fisheye::CALIB_FIX_K3;
if(fixK4) flag |= fisheye::CALIB_FIX_K4;
if (calibFixPrincipalPoint) flag |= fisheye::CALIB_FIX_PRINCIPAL_POINT;
}
calibrationPattern = NOT_EXISTING;
if (!patternToUse.compare("CHESSBOARD")) calibrationPattern = CHESSBOARD;
if (!patternToUse.compare("CIRCLES_GRID")) calibrationPattern = CIRCLES_GRID;
if (!patternToUse.compare("ASYMMETRIC_CIRCLES_GRID")) calibrationPattern = ASYMMETRIC_CIRCLES_GRID;
if (calibrationPattern == NOT_EXISTING)
{
cerr << " Camera calibration mode does not exist: " << patternToUse << endl;
goodInput = false;
}
atImageList = 0;
}
Mat nextImage()
{
Mat result;
if( inputCapture.isOpened() )
{
Mat view0;
inputCapture >> view0;
view0.copyTo(result);
}
else if( atImageList < imageList.size() )
result = imread(imageList[atImageList++], IMREAD_COLOR);
return result;
}
static bool readStringList( const string& filename, vector<string>& l )
{
l.clear();
FileStorage fs(filename, FileStorage::READ);
if( !fs.isOpened() )
return false;
FileNode n = fs.getFirstTopLevelNode();
if( n.type() != FileNode::SEQ )
return false;
FileNodeIterator it = n.begin(), it_end = n.end();
for( ; it != it_end; ++it )
l.push_back((string)*it);
return true;
}
static bool isListOfImages( const string& filename)
{
string s(filename);
// Look for file extension
if( s.find(".xml") == string::npos && s.find(".yaml") == string::npos && s.find(".yml") == string::npos )
return false;
else
return true;
}
public:
Size boardSize; // The size of the board -> Number of items by width and height
Pattern calibrationPattern; // One of the Chessboard, circles, or asymmetric circle pattern
float squareSize; // The size of a square in your defined unit (point, millimeter,etc).
int nrFrames; // The number of frames to use from the input for calibration
float aspectRatio; // The aspect ratio
int delay; // In case of a video input
bool writePoints; // Write detected feature points
bool writeExtrinsics; // Write extrinsic parameters
bool writeGrid; // Write refined 3D target grid points
bool calibZeroTangentDist; // Assume zero tangential distortion
bool calibFixPrincipalPoint; // Fix the principal point at the center
bool flipVertical; // Flip the captured images around the horizontal axis
string outputFileName; // The name of the file where to write
bool showUndistorted; // Show undistorted images after calibration
string input; // The input ->
bool useFisheye; // use fisheye camera model for calibration
bool fixK1; // fix K1 distortion coefficient
bool fixK2; // fix K2 distortion coefficient
bool fixK3; // fix K3 distortion coefficient
bool fixK4; // fix K4 distortion coefficient
bool fixK5; // fix K5 distortion coefficient
int cameraID;
vector<string> imageList;
size_t atImageList;
VideoCapture inputCapture;
InputType inputType;
bool goodInput;
int flag;
private:
string patternToUse;
};
static inline void read(const FileNode& node, Settings& x, const Settings& default_value = Settings())
{
if(node.empty())
x = default_value;
else
x.read(node);
}
enum { DETECTION = 0, CAPTURING = 1, CALIBRATED = 2 };
bool runCalibrationAndSave(Settings& s, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs,
vector<vector<Point2f> > imagePoints, float grid_width, bool release_object);
int main(int argc, char* argv[])
{
const String keys
= "{help h usage ? | | print this message }"
"{@settings |default.xml| input setting file }"
"{d | | actual distance between top-left and top-right corners of "
"the calibration grid }"
"{winSize | 11 | Half of search window for cornerSubPix }";
CommandLineParser parser(argc, argv, keys);
parser.about("This is a camera calibration sample.\n"
"Usage: camera_calibration [configuration_file -- default ./default.xml]\n"
"Near the sample file you'll find the configuration file, which has detailed help of "
"how to edit it. It may be any OpenCV supported file format XML/YAML.");
if (!parser.check())
{
parser.printErrors();
return 0;
}
if (parser.has("help"))
{
parser.printMessage();
return 0;
}
//! [file_read]
Settings s;
const string inputSettingsFile = parser.get<string>(0);
FileStorage fs(inputSettingsFile, FileStorage::READ); // Read the settings
if (!fs.isOpened())
{
cout << "Could not open the configuration file: \"" << inputSettingsFile << "\"" << endl;
parser.printMessage();
return -1;
}
fs["Settings"] >> s;
fs.release(); // close Settings file
//! [file_read]
//FileStorage fout("settings.yml", FileStorage::WRITE); // write config as YAML
//fout << "Settings" << s;
if (!s.goodInput)
{
cout << "Invalid input detected. Application stopping. " << endl;
return -1;
}
int winSize = parser.get<int>("winSize");
float grid_width = s.squareSize * (s.boardSize.width - 1);
bool release_object = false;
if (parser.has("d"))
{
grid_width = parser.get<float>("d");
release_object = true;
}
vector<vector<Point2f> > imagePoints;
Mat cameraMatrix, distCoeffs;
Size imageSize;
int mode = s.inputType == Settings::IMAGE_LIST ? CAPTURING : DETECTION;
clock_t prevTimestamp = 0;
const Scalar RED(0,0,255), GREEN(0,255,0);
const char ESC_KEY = 27;
//! [get_input]
for(;;)
{
Mat view;
bool blinkOutput = false;
view = s.nextImage();
//----- If no more image, or got enough, then stop calibration and show result -------------
if( mode == CAPTURING && imagePoints.size() >= (size_t)s.nrFrames )
{
if(runCalibrationAndSave(s, imageSize, cameraMatrix, distCoeffs, imagePoints, grid_width,
release_object))
mode = CALIBRATED;
else
mode = DETECTION;
}
if(view.empty()) // If there are no more images stop the loop
{
// if calibration threshold was not reached yet, calibrate now
if( mode != CALIBRATED && !imagePoints.empty() )
runCalibrationAndSave(s, imageSize, cameraMatrix, distCoeffs, imagePoints, grid_width,
release_object);
break;
}
//! [get_input]
imageSize = view.size(); // Format input image.
if( s.flipVertical )
flip( view, view, 0 );
//! [find_pattern]
vector<Point2f> pointBuf;
bool found;
int chessBoardFlags = CALIB_CB_ADAPTIVE_THRESH | CALIB_CB_NORMALIZE_IMAGE;
if(!s.useFisheye)
{
// fast check erroneously fails with high distortions like fisheye
chessBoardFlags |= CALIB_CB_FAST_CHECK;
}
switch( s.calibrationPattern ) // Find feature points on the input format
{
case Settings::CHESSBOARD:
found = findChessboardCorners( view, s.boardSize, pointBuf, chessBoardFlags);
break;
case Settings::CIRCLES_GRID:
found = findCirclesGrid( view, s.boardSize, pointBuf );
break;
case Settings::ASYMMETRIC_CIRCLES_GRID:
found = findCirclesGrid( view, s.boardSize, pointBuf, CALIB_CB_ASYMMETRIC_GRID );
break;
default:
found = false;
break;
}
//! [find_pattern]
//! [pattern_found]
if ( found) // If done with success,
{
// improve the found corners' coordinate accuracy for chessboard
if( s.calibrationPattern == Settings::CHESSBOARD)
{
Mat viewGray;
cvtColor(view, viewGray, COLOR_BGR2GRAY);
cornerSubPix( viewGray, pointBuf, Size(winSize,winSize),
Size(-1,-1), TermCriteria( TermCriteria::EPS+TermCriteria::COUNT, 30, 0.0001 ));
}
if( mode == CAPTURING && // For camera only take new samples after delay time
(!s.inputCapture.isOpened() || clock() - prevTimestamp > s.delay*1e-3*CLOCKS_PER_SEC) )
{
imagePoints.push_back(pointBuf);
prevTimestamp = clock();
blinkOutput = s.inputCapture.isOpened();
}
// Draw the corners.
drawChessboardCorners( view, s.boardSize, Mat(pointBuf), found );
}
//! [pattern_found]
//----------------------------- Output Text ------------------------------------------------
//! [output_text]
string msg = (mode == CAPTURING) ? "100/100" :
mode == CALIBRATED ? "Calibrated" : "Press 'g' to start";
int baseLine = 0;
Size textSize = getTextSize(msg, 1, 1, 1, &baseLine);
Point textOrigin(view.cols - 2*textSize.width - 10, view.rows - 2*baseLine - 10);
if( mode == CAPTURING )
{
if(s.showUndistorted)
msg = cv::format( "%d/%d Undist", (int)imagePoints.size(), s.nrFrames );
else
msg = cv::format( "%d/%d", (int)imagePoints.size(), s.nrFrames );
}
putText( view, msg, textOrigin, 1, 1, mode == CALIBRATED ? GREEN : RED);
if( blinkOutput )
bitwise_not(view, view);
//! [output_text]
//------------------------- Video capture output undistorted ------------------------------
//! [output_undistorted]
if( mode == CALIBRATED && s.showUndistorted )
{
Mat temp = view.clone();
if (s.useFisheye)
{
Mat newCamMat;
fisheye::estimateNewCameraMatrixForUndistortRectify(cameraMatrix, distCoeffs, imageSize,
Matx33d::eye(), newCamMat, 1);
cv::fisheye::undistortImage(temp, view, cameraMatrix, distCoeffs, newCamMat);
}
else
undistort(temp, view, cameraMatrix, distCoeffs);
}
//! [output_undistorted]
//------------------------------ Show image and check for input commands -------------------
//! [await_input]
imshow("Image View", view);
char key = (char)waitKey(s.inputCapture.isOpened() ? 50 : s.delay);
if( key == ESC_KEY )
break;
if( key == 'u' && mode == CALIBRATED )
s.showUndistorted = !s.showUndistorted;
if( s.inputCapture.isOpened() && key == 'g' )
{
mode = CAPTURING;
imagePoints.clear();
}
//! [await_input]
}
// -----------------------Show the undistorted image for the image list ------------------------
//! [show_results]
if( s.inputType == Settings::IMAGE_LIST && s.showUndistorted && !cameraMatrix.empty())
{
Mat view, rview, map1, map2;
if (s.useFisheye)
{
Mat newCamMat;
fisheye::estimateNewCameraMatrixForUndistortRectify(cameraMatrix, distCoeffs, imageSize,
Matx33d::eye(), newCamMat, 1);
fisheye::initUndistortRectifyMap(cameraMatrix, distCoeffs, Matx33d::eye(), newCamMat, imageSize,
CV_16SC2, map1, map2);
}
else
{
initUndistortRectifyMap(
cameraMatrix, distCoeffs, Mat(),
getOptimalNewCameraMatrix(cameraMatrix, distCoeffs, imageSize, 1, imageSize, 0), imageSize,
CV_16SC2, map1, map2);
}
for(size_t i = 0; i < s.imageList.size(); i++ )
{
view = imread(s.imageList[i], IMREAD_COLOR);
if(view.empty())
continue;
remap(view, rview, map1, map2, INTER_LINEAR);
imshow("Image View", rview);
char c = (char)waitKey();
if( c == ESC_KEY || c == 'q' || c == 'Q' )
break;
}
}
//! [show_results]
return 0;
}
//! [compute_errors]
static double computeReprojectionErrors( const vector<vector<Point3f> >& objectPoints,
const vector<vector<Point2f> >& imagePoints,
const vector<Mat>& rvecs, const vector<Mat>& tvecs,
const Mat& cameraMatrix , const Mat& distCoeffs,
vector<float>& perViewErrors, bool fisheye)
{
vector<Point2f> imagePoints2;
size_t totalPoints = 0;
double totalErr = 0, err;
perViewErrors.resize(objectPoints.size());
for(size_t i = 0; i < objectPoints.size(); ++i )
{
if (fisheye)
{
fisheye::projectPoints(objectPoints[i], imagePoints2, rvecs[i], tvecs[i], cameraMatrix,
distCoeffs);
}
else
{
projectPoints(objectPoints[i], rvecs[i], tvecs[i], cameraMatrix, distCoeffs, imagePoints2);
}
err = norm(imagePoints[i], imagePoints2, NORM_L2);
size_t n = objectPoints[i].size();
perViewErrors[i] = (float) std::sqrt(err*err/n);
totalErr += err*err;
totalPoints += n;
}
return std::sqrt(totalErr/totalPoints);
}
//! [compute_errors]
//! [board_corners]
static void calcBoardCornerPositions(Size boardSize, float squareSize, vector<Point3f>& corners,
Settings::Pattern patternType /*= Settings::CHESSBOARD*/)
{
corners.clear();
switch(patternType)
{
case Settings::CHESSBOARD:
case Settings::CIRCLES_GRID:
for( int i = 0; i < boardSize.height; ++i )
for( int j = 0; j < boardSize.width; ++j )
corners.push_back(Point3f(j*squareSize, i*squareSize, 0));
break;
case Settings::ASYMMETRIC_CIRCLES_GRID:
for( int i = 0; i < boardSize.height; i++ )
for( int j = 0; j < boardSize.width; j++ )
corners.push_back(Point3f((2*j + i % 2)*squareSize, i*squareSize, 0));
break;
default:
break;
}
}
//! [board_corners]
static bool runCalibration( Settings& s, Size& imageSize, Mat& cameraMatrix, Mat& distCoeffs,
vector<vector<Point2f> > imagePoints, vector<Mat>& rvecs, vector<Mat>& tvecs,
vector<float>& reprojErrs, double& totalAvgErr, vector<Point3f>& newObjPoints,
float grid_width, bool release_object)
{
//! [fixed_aspect]
cameraMatrix = Mat::eye(3, 3, CV_64F);
if( !s.useFisheye && s.flag & CALIB_FIX_ASPECT_RATIO )
cameraMatrix.at<double>(0,0) = s.aspectRatio;
//! [fixed_aspect]
if (s.useFisheye)
{
distCoeffs = Mat::zeros(4, 1, CV_64F);
} else
{
distCoeffs = Mat::zeros(8, 1, CV_64F);
}
vector<vector<Point3f> > objectPoints(1);
calcBoardCornerPositions(s.boardSize, s.squareSize, objectPoints[0], s.calibrationPattern);
objectPoints[0][s.boardSize.width - 1].x = objectPoints[0][0].x + grid_width;
newObjPoints = objectPoints[0];
objectPoints.resize(imagePoints.size(),objectPoints[0]);
//Find intrinsic and extrinsic camera parameters
double rms;
if (s.useFisheye)
{
Mat _rvecs, _tvecs;
rms = fisheye::calibrate(objectPoints, imagePoints, imageSize, cameraMatrix, distCoeffs, _rvecs,
_tvecs, s.flag);
rvecs.reserve(_rvecs.rows);
tvecs.reserve(_tvecs.rows);
for(int i = 0; i < int(objectPoints.size()); i++)
{
rvecs.push_back(_rvecs.row(i));
tvecs.push_back(_tvecs.row(i));
}
} else
{
int iFixedPoint = -1;
if (release_object)
iFixedPoint = s.boardSize.width - 1;
rms = calibrateCameraRO(objectPoints, imagePoints, imageSize, iFixedPoint,
cameraMatrix, distCoeffs, rvecs, tvecs, newObjPoints,
s.flag | CALIB_USE_LU);
}
if (release_object)
{
cout << "New board corners: " << endl;
cout << newObjPoints[0] << endl;
cout << newObjPoints[s.boardSize.width - 1] << endl;
cout << newObjPoints[s.boardSize.width * (s.boardSize.height - 1)] << endl;
cout << newObjPoints.back() << endl;
}
cout << "Re-projection error reported by calibrateCamera: "<< rms << endl;
bool ok = checkRange(cameraMatrix) && checkRange(distCoeffs);
objectPoints.clear();
objectPoints.resize(imagePoints.size(), newObjPoints);
totalAvgErr = computeReprojectionErrors(objectPoints, imagePoints, rvecs, tvecs, cameraMatrix,
distCoeffs, reprojErrs, s.useFisheye);
return ok;
}
// Print camera parameters to the output file
static void saveCameraParams( Settings& s, Size& imageSize, Mat& cameraMatrix, Mat& distCoeffs,
const vector<Mat>& rvecs, const vector<Mat>& tvecs,
const vector<float>& reprojErrs, const vector<vector<Point2f> >& imagePoints,
double totalAvgErr, const vector<Point3f>& newObjPoints )
{
FileStorage fs( s.outputFileName, FileStorage::WRITE );
time_t tm;
time( &tm );
struct tm *t2 = localtime( &tm );
char buf[1024];
strftime( buf, sizeof(buf), "%c", t2 );
fs << "calibration_time" << buf;
if( !rvecs.empty() || !reprojErrs.empty() )
fs << "nr_of_frames" << (int)std::max(rvecs.size(), reprojErrs.size());
fs << "image_width" << imageSize.width;
fs << "image_height" << imageSize.height;
fs << "board_width" << s.boardSize.width;
fs << "board_height" << s.boardSize.height;
fs << "square_size" << s.squareSize;
if( !s.useFisheye && s.flag & CALIB_FIX_ASPECT_RATIO )
fs << "fix_aspect_ratio" << s.aspectRatio;
if (s.flag)
{
std::stringstream flagsStringStream;
if (s.useFisheye)
{
flagsStringStream << "flags:"
<< (s.flag & fisheye::CALIB_FIX_SKEW ? " +fix_skew" : "")
<< (s.flag & fisheye::CALIB_FIX_K1 ? " +fix_k1" : "")
<< (s.flag & fisheye::CALIB_FIX_K2 ? " +fix_k2" : "")
<< (s.flag & fisheye::CALIB_FIX_K3 ? " +fix_k3" : "")
<< (s.flag & fisheye::CALIB_FIX_K4 ? " +fix_k4" : "")
<< (s.flag & fisheye::CALIB_RECOMPUTE_EXTRINSIC ? " +recompute_extrinsic" : "");
}
else
{
flagsStringStream << "flags:"
<< (s.flag & CALIB_USE_INTRINSIC_GUESS ? " +use_intrinsic_guess" : "")
<< (s.flag & CALIB_FIX_ASPECT_RATIO ? " +fix_aspectRatio" : "")
<< (s.flag & CALIB_FIX_PRINCIPAL_POINT ? " +fix_principal_point" : "")
<< (s.flag & CALIB_ZERO_TANGENT_DIST ? " +zero_tangent_dist" : "")
<< (s.flag & CALIB_FIX_K1 ? " +fix_k1" : "")
<< (s.flag & CALIB_FIX_K2 ? " +fix_k2" : "")
<< (s.flag & CALIB_FIX_K3 ? " +fix_k3" : "")
<< (s.flag & CALIB_FIX_K4 ? " +fix_k4" : "")
<< (s.flag & CALIB_FIX_K5 ? " +fix_k5" : "");
}
fs.writeComment(flagsStringStream.str());
}
fs << "flags" << s.flag;
fs << "fisheye_model" << s.useFisheye;
fs << "camera_matrix" << cameraMatrix;
fs << "distortion_coefficients" << distCoeffs;
fs << "avg_reprojection_error" << totalAvgErr;
if (s.writeExtrinsics && !reprojErrs.empty())
fs << "per_view_reprojection_errors" << Mat(reprojErrs);
if(s.writeExtrinsics && !rvecs.empty() && !tvecs.empty() )
{
CV_Assert(rvecs[0].type() == tvecs[0].type());
Mat bigmat((int)rvecs.size(), 6, CV_MAKETYPE(rvecs[0].type(), 1));
bool needReshapeR = rvecs[0].depth() != 1 ? true : false;
bool needReshapeT = tvecs[0].depth() != 1 ? true : false;
for( size_t i = 0; i < rvecs.size(); i++ )
{
Mat r = bigmat(Range(int(i), int(i+1)), Range(0,3));
Mat t = bigmat(Range(int(i), int(i+1)), Range(3,6));
if(needReshapeR)
rvecs[i].reshape(1, 1).copyTo(r);
else
{
//*.t() is MatExpr (not Mat) so we can use assignment operator
CV_Assert(rvecs[i].rows == 3 && rvecs[i].cols == 1);
r = rvecs[i].t();
}
if(needReshapeT)
tvecs[i].reshape(1, 1).copyTo(t);
else
{
CV_Assert(tvecs[i].rows == 3 && tvecs[i].cols == 1);
t = tvecs[i].t();
}
}
fs.writeComment("a set of 6-tuples (rotation vector + translation vector) for each view");
fs << "extrinsic_parameters" << bigmat;
}
if(s.writePoints && !imagePoints.empty() )
{
Mat imagePtMat((int)imagePoints.size(), (int)imagePoints[0].size(), CV_32FC2);
for( size_t i = 0; i < imagePoints.size(); i++ )
{
Mat r = imagePtMat.row(int(i)).reshape(2, imagePtMat.cols);
Mat imgpti(imagePoints[i]);
imgpti.copyTo(r);
}
fs << "image_points" << imagePtMat;
}
if( s.writeGrid && !newObjPoints.empty() )
{
fs << "grid_points" << newObjPoints;
}
}
//! [run_and_save]
bool runCalibrationAndSave(Settings& s, Size imageSize, Mat& cameraMatrix, Mat& distCoeffs,
vector<vector<Point2f> > imagePoints, float grid_width, bool release_object)
{
vector<Mat> rvecs, tvecs;
vector<float> reprojErrs;
double totalAvgErr = 0;
vector<Point3f> newObjPoints;
bool ok = runCalibration(s, imageSize, cameraMatrix, distCoeffs, imagePoints, rvecs, tvecs, reprojErrs,
totalAvgErr, newObjPoints, grid_width, release_object);
cout << (ok ? "Calibration succeeded" : "Calibration failed")
<< ". avg re projection error = " << totalAvgErr << endl;
if (ok)
saveCameraParams(s, imageSize, cameraMatrix, distCoeffs, rvecs, tvecs, reprojErrs, imagePoints,
totalAvgErr, newObjPoints);
return ok;
}
//! [run_and_save]