In [6]:
import stereo_calibration_orig

In [67]:
reload(stereo_calibration_orig)


Out[67]:
<module 'stereo_calibration_orig' from 'stereo_calibration_orig.pyc'>

In [8]:
stereo_calibration_orig.stereo_calibration('/Users/emily/Documents/ProjectsCurrent/BORIS/session_data/raw/stereocalibration/kre/kre_cafe/',100)


 Usable stereo pairs: 33
Calibrating camera 1...

Estimated intrinsic parameters for camera 1:
[600.38379310822199, 0.0, 317.6402382218468]
[0.0, 602.19362158583385, 240.09003517485345]
[0.0, 0.0, 1.0]

Estimated distortion parameters for camera 1:
[[-0.17440844]
 [ 0.09702135]
 [-0.00449313]
 [-0.00058551]
 [-0.29232799]
 [ 0.20220003]
 [-0.08253744]
 [-0.39291792]]
Calibrating camera 2...

Estimated intrinsic parameters for camera 2:
[601.8487215301966, 0.0, 309.2880232557763]
[0.0, 603.58812476792582, 238.75002468669999]
[0.0, 0.0, 1.0]

Estimated distortion parameters for camera 2:
[[ -1.76774480e-01]
 [  1.45240161e-02]
 [ -3.80819573e-03]
 [  4.34410838e-04]
 [ -5.38980799e-01]
 [  1.94946932e-01]
 [ -8.98039646e-02]
 [ -9.00603533e-01]]

 rms pixel error:
cam1 orig: 0.256446534588
cam2 orig: 0.221234315099

 Stereo estimating...

Estimated extrinsic parameters between cameras 1 and 2:
Rotation:
[0.99997771827926252, -0.0015853544058396251, -0.0064845660153762391]
[0.0015833594911192641, 0.99999869757528292, -0.00031276262510084566]
[0.0064850534093228666, 0.00030248825706515617, 0.999978926069511]

Translation:
[-6.5160318317474832, -0.003704893132471077, -0.045249775978923809]

 rms pixel error:
stereo: 0.180333994059

Saving all parameters to the folder with checkerboard images...

In [1]:
import stereocalibration

In [4]:
reload(stereocalibration)


Out[4]:
<module 'stereocalibration' from 'stereocalibration.py'>

In [5]:
stereocalibration.stereocalibration('/Users/emily/Documents/ProjectsCurrent/BORIS/session_data/raw/stereocalibration/kre/kre_cafe/',100)


Detecting Circle Grid points...

 Usable stereo pairs: 41
Calibrating camera 1...

Estimated intrinsic parameters:
[[ 607.29972689    0.          314.9165524 ]
 [   0.          607.59090526  234.01812157]
 [   0.            0.            1.        ]]

Estimated distortion parameters:
[[ -6.03778537e-01]
 [  1.66638662e-01]
 [ -4.27559129e-04]
 [  4.90153899e-04]
 [ -4.29651970e-02]
 [ -2.27693364e-01]
 [ -1.48497534e-01]
 [  7.54299406e-02]]
Calibrating camera 2...

Estimated intrinsic parameters:
[[ 610.32065612    0.          313.31879481]
 [   0.          610.61910271  232.08596885]
 [   0.            0.            1.        ]]

Estimated distortion parameters:
[[  4.46582585e-01]
 [  4.73370219e-01]
 [ -3.95399000e-04]
 [ -2.98700605e-04]
 [ -1.07151423e+00]
 [  8.24326880e-01]
 [  5.89308086e-01]
 [ -1.16077784e+00]]

 rms pixel error:
cam1 orig: 0.184450774292 
cam2 orig: 0.161237553067

 Stereo estimating...

Estimated extrinsic parameters between cameras 1 and 2:
Rotation: [[  9.99976669e-01  -1.60465565e-03  -6.63973573e-03]
 [  1.59988670e-03   9.99998458e-01  -7.23492961e-04]
 [  6.64088645e-03   7.12853256e-04   9.99977695e-01]]

Translation: [-6.5201357583832307, -0.0017241845238051673, -0.010078736947782356]

 rms pixel error:
stereo: 0.173969714072

Saving all parameters to the folder with checkerboard images...

In [50]:
[img1,found1,points1] = stereocalibration.getcirclepoints('/Users/emily/Documents/ProjectsCurrent/BORIS/session_data/raw/stereocalibration/kre/kre_cafe/calibration_frames_2012-08-01/cam1_frame_3.bmp',(4,11))

In [58]:
points1


Out[58]:
array([[[ 219.7628479 ,   18.36930275]],

       [[ 267.71664429,   16.5026226 ]],

       [[ 315.67910767,   15.63172913]],

       [[ 363.37298584,   16.02654839]],

       [[ 243.35032654,   33.36188507]],

       [[ 292.6272583 ,   32.24374771]],

       [[ 341.8352356 ,   31.70520973]],

       [[ 390.35336304,   32.34250259]],

       [[ 217.29748535,   51.06294632]],

       [[ 268.30944824,   49.61459351]],

       [[ 318.97573853,   48.78683853]],

       [[ 369.20889282,   48.73703003]],

       [[ 242.25450134,   67.93720245]],

       [[ 294.72644043,   67.19091797]],

       [[ 346.59976196,   66.63425446]],

       [[ 397.45690918,   66.52258301]],

       [[ 215.66239929,   88.96458435]],

       [[ 268.79644775,   86.31221008]],

       [[ 322.51553345,   85.67716217]],

       [[ 375.49597168,   85.50339508]],

       [[ 241.95217896,  108.1072998 ]],

       [[ 296.88250732,  106.02561951]],

       [[ 351.79541016,  105.64916992]],

       [[ 405.18197632,  105.34880829]],

       [[ 213.38812256,  130.8684845 ]],

       [[ 269.95883179,  128.73753357]],

       [[ 326.39813232,  126.79515839]],

       [[ 382.26687622,  126.7082901 ]],

       [[ 241.50813293,  152.76509094]],

       [[ 299.65142822,  150.85557556]],

       [[ 357.33459473,  149.16403198]],

       [[ 413.54315186,  148.98297119]],

       [[ 211.80941772,  178.01174927]],

       [[ 271.31796265,  176.04148865]],

       [[ 331.02947998,  174.15356445]],

       [[ 389.54516602,  172.65551758]],

       [[ 241.26144409,  202.3886261 ]],

       [[ 302.612854  ,  200.70613098]],

       [[ 363.33374023,  198.58706665]],

       [[ 422.38677979,  197.71969604]],

       [[ 210.29508972,  230.6212616 ]],

       [[ 272.84384155,  228.29325867]],

       [[ 335.60922241,  226.56550598]],

       [[ 396.95007324,  224.26667786]]], dtype=float32)

In [54]:
import numpy as np
num_pts = 11 * 4
temp1 = np.zeros( (num_pts,2) )
for i in range(num_pts):
	temp1[i,0]	=	points1[i,0,0]
	temp1[i,1]	=	points1[i,0,1]

In [55]:
temp1


Out[55]:
array([[ 219.7628479 ,   18.36930275],
       [ 267.71664429,   16.5026226 ],
       [ 315.67910767,   15.63172913],
       [ 363.37298584,   16.02654839],
       [ 243.35032654,   33.36188507],
       [ 292.6272583 ,   32.24374771],
       [ 341.8352356 ,   31.70520973],
       [ 390.35336304,   32.34250259],
       [ 217.29748535,   51.06294632],
       [ 268.30944824,   49.61459351],
       [ 318.97573853,   48.78683853],
       [ 369.20889282,   48.73703003],
       [ 242.25450134,   67.93720245],
       [ 294.72644043,   67.19091797],
       [ 346.59976196,   66.63425446],
       [ 397.45690918,   66.52258301],
       [ 215.66239929,   88.96458435],
       [ 268.79644775,   86.31221008],
       [ 322.51553345,   85.67716217],
       [ 375.49597168,   85.50339508],
       [ 241.95217896,  108.1072998 ],
       [ 296.88250732,  106.02561951],
       [ 351.79541016,  105.64916992],
       [ 405.18197632,  105.34880829],
       [ 213.38812256,  130.8684845 ],
       [ 269.95883179,  128.73753357],
       [ 326.39813232,  126.79515839],
       [ 382.26687622,  126.7082901 ],
       [ 241.50813293,  152.76509094],
       [ 299.65142822,  150.85557556],
       [ 357.33459473,  149.16403198],
       [ 413.54315186,  148.98297119],
       [ 211.80941772,  178.01174927],
       [ 271.31796265,  176.04148865],
       [ 331.02947998,  174.15356445],
       [ 389.54516602,  172.65551758],
       [ 241.26144409,  202.3886261 ],
       [ 302.612854  ,  200.70613098],
       [ 363.33374023,  198.58706665],
       [ 422.38677979,  197.71969604],
       [ 210.29508972,  230.6212616 ],
       [ 272.84384155,  228.29325867],
       [ 335.60922241,  226.56550598],
       [ 396.95007324,  224.26667786]])

In [56]:
temp1.shape


Out[56]:
(44, 2)

In [57]:
points1.shape


Out[57]:
(44, 1, 2)

In [60]:
np.reshape(points1,(num_pts,2)).shape


Out[60]:
(44, 2)

In [65]:
iptsF1 	= []
iptsF1.append(np.reshape(points1,(num_pts,2)))

In [5]:
import cv2

In [45]:
cv2.FileStorage


Out[45]:
<function cv2.FileStorage>

In [77]:
range(1,500,5) + range(2,500,5) + range(3,500,5) + range(4,500,5) + range(5,500,5)


Out[77]:
[1,
 6,
 11,
 16,
 21,
 26,
 31,
 36,
 41,
 46,
 51,
 56,
 61,
 66,
 71,
 76,
 81,
 86,
 91,
 96,
 101,
 106,
 111,
 116,
 121,
 126,
 131,
 136,
 141,
 146,
 151,
 156,
 161,
 166,
 171,
 176,
 181,
 186,
 191,
 196,
 201,
 206,
 211,
 216,
 221,
 226,
 231,
 236,
 241,
 246,
 251,
 256,
 261,
 266,
 271,
 276,
 281,
 286,
 291,
 296,
 301,
 306,
 311,
 316,
 321,
 326,
 331,
 336,
 341,
 346,
 351,
 356,
 361,
 366,
 371,
 376,
 381,
 386,
 391,
 396,
 401,
 406,
 411,
 416,
 421,
 426,
 431,
 436,
 441,
 446,
 451,
 456,
 461,
 466,
 471,
 476,
 481,
 486,
 491,
 496,
 2,
 7,
 12,
 17,
 22,
 27,
 32,
 37,
 42,
 47,
 52,
 57,
 62,
 67,
 72,
 77,
 82,
 87,
 92,
 97,
 102,
 107,
 112,
 117,
 122,
 127,
 132,
 137,
 142,
 147,
 152,
 157,
 162,
 167,
 172,
 177,
 182,
 187,
 192,
 197,
 202,
 207,
 212,
 217,
 222,
 227,
 232,
 237,
 242,
 247,
 252,
 257,
 262,
 267,
 272,
 277,
 282,
 287,
 292,
 297,
 302,
 307,
 312,
 317,
 322,
 327,
 332,
 337,
 342,
 347,
 352,
 357,
 362,
 367,
 372,
 377,
 382,
 387,
 392,
 397,
 402,
 407,
 412,
 417,
 422,
 427,
 432,
 437,
 442,
 447,
 452,
 457,
 462,
 467,
 472,
 477,
 482,
 487,
 492,
 497,
 3,
 8,
 13,
 18,
 23,
 28,
 33,
 38,
 43,
 48,
 53,
 58,
 63,
 68,
 73,
 78,
 83,
 88,
 93,
 98,
 103,
 108,
 113,
 118,
 123,
 128,
 133,
 138,
 143,
 148,
 153,
 158,
 163,
 168,
 173,
 178,
 183,
 188,
 193,
 198,
 203,
 208,
 213,
 218,
 223,
 228,
 233,
 238,
 243,
 248,
 253,
 258,
 263,
 268,
 273,
 278,
 283,
 288,
 293,
 298,
 303,
 308,
 313,
 318,
 323,
 328,
 333,
 338,
 343,
 348,
 353,
 358,
 363,
 368,
 373,
 378,
 383,
 388,
 393,
 398,
 403,
 408,
 413,
 418,
 423,
 428,
 433,
 438,
 443,
 448,
 453,
 458,
 463,
 468,
 473,
 478,
 483,
 488,
 493,
 498,
 4,
 9,
 14,
 19,
 24,
 29,
 34,
 39,
 44,
 49,
 54,
 59,
 64,
 69,
 74,
 79,
 84,
 89,
 94,
 99,
 104,
 109,
 114,
 119,
 124,
 129,
 134,
 139,
 144,
 149,
 154,
 159,
 164,
 169,
 174,
 179,
 184,
 189,
 194,
 199,
 204,
 209,
 214,
 219,
 224,
 229,
 234,
 239,
 244,
 249,
 254,
 259,
 264,
 269,
 274,
 279,
 284,
 289,
 294,
 299,
 304,
 309,
 314,
 319,
 324,
 329,
 334,
 339,
 344,
 349,
 354,
 359,
 364,
 369,
 374,
 379,
 384,
 389,
 394,
 399,
 404,
 409,
 414,
 419,
 424,
 429,
 434,
 439,
 444,
 449,
 454,
 459,
 464,
 469,
 474,
 479,
 484,
 489,
 494,
 499,
 5,
 10,
 15,
 20,
 25,
 30,
 35,
 40,
 45,
 50,
 55,
 60,
 65,
 70,
 75,
 80,
 85,
 90,
 95,
 100,
 105,
 110,
 115,
 120,
 125,
 130,
 135,
 140,
 145,
 150,
 155,
 160,
 165,
 170,
 175,
 180,
 185,
 190,
 195,
 200,
 205,
 210,
 215,
 220,
 225,
 230,
 235,
 240,
 245,
 250,
 255,
 260,
 265,
 270,
 275,
 280,
 285,
 290,
 295,
 300,
 305,
 310,
 315,
 320,
 325,
 330,
 335,
 340,
 345,
 350,
 355,
 360,
 365,
 370,
 375,
 380,
 385,
 390,
 395,
 400,
 405,
 410,
 415,
 420,
 425,
 430,
 435,
 440,
 445,
 450,
 455,
 460,
 465,
 470,
 475,
 480,
 485,
 490,
 495]

In [ ]: