Example #1
0
  Width: 216
  Height: 114
In form [x, width, y, height]
'''
fieldNum = 3
field_0 = [368, 209, 310, 168]
field_1 = [674, 156, 295, 194]
field_2 = [483, 216, 582, 114]
fieldBottom = [field_0, field_1, field_2]

# threshold definition
qThreshold = 1e-4
heThreshold = 1e-5

# left as target image, right as template image. H transform template to target(right to left)
test = cali.calibrated_image('R.png', 'L.png', folderName, qThreshold, heThreshold, 7)

# build the image Pyramid(pyrNum doesn't include original image)
# 0 layer is the original Image
pyrNum = 2
target_img_pyramid, template_img_pyramid = test.build_image_pyramid(pyrNum, 0)

# initialization of H_inf, e and q_n from the GPS and INS data.
H_inf = np.array([[9.657e-01, -8.368e-03, 1.391e+02],
                  [2.192e-02, 1.015e+00, -1.237e+02],
                  [-5.081e-05, 4.744e-05, 1.006e+00]], dtype=np.float32)
e = np.array([-7.242e+02, -1.645e+01, 3.812e-02], dtype=np.float32).reshape(3, 1)

# build the field to top layer
fieldTop = copy.deepcopy(fieldBottom)
for i in range(fieldNum):
  Y: 15
  Width: 59
  Height: 101
  In form [x, width, y, height]
'''
fieldNum = 3
field_0 = [14, 92, 206, 145]
field_1 = [230, 85, 279, 84]
field_2 = [359, 59, 15, 101]
fieldBottom = [field_0, field_1, field_2]

qThreshold = 1e-3
heThreshold = 0
# first target second template, from template to target from right to left; 6 right to 2 left
test = cali.calibrated_image(
    '/Users/zauber/Desktop/Stereo_matching/Photo/barn1/im2.ppm',
    '/Users/zauber/Desktop/Stereo_matching/Photo/barn1/im6.ppm', folderName,
    qThreshold, heThreshold, 3)

pyrNum = 2
target_img_pyramid, template_img_pyramid = test.build_image_pyramid(pyrNum, 0)
'''
This parameter a, b, c is for the H from template to target img, so it's from template to target image. \
Here from right to left image
'''
H_inf = np.eye(3, dtype=np.float32)
e = np.array([[1], [0], [0]], dtype=np.float32)

fieldTop = copy.deepcopy(fieldBottom)
for i in range(fieldNum):
    for j in range(4):
        fieldTop[i][j] = int(fieldTop[i][j] / 2**pyrNum)