WIP, buncha stuff that I didn't commit when I wrote it and now I'm afraid of losing something

This commit is contained in:
2022-01-31 18:12:35 +01:00
parent a673f807c5
commit 3f947c9dd2
9 changed files with 543 additions and 49 deletions
+17 -17
View File
@@ -6,51 +6,51 @@
<dt>d</dt>
<data>
488. 648.</data></img_shape>
<rms>6.3901938604977060e-01</rms>
<rms>7.3876627268710637e-01</rms>
<cam_int type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
1.6399564573473415e+03 0. -6.5062953701584874e+01 0.
1.5741778806528637e+03 2.3634226604202689e+02 0. 0. 1.</data></cam_int>
1.5726417056187443e+03 0. 1.4574187727420562e+02 0.
1.5816754032205320e+03 2.4066087342652420e+02 0. 0. 1.</data></cam_int>
<cam_dist type_id="opencv-matrix">
<rows>1</rows>
<cols>5</cols>
<dt>d</dt>
<data>
4.0533496459876667e-01 -7.9789330239048994e-01
-3.4496681677903256e-02 -1.1244970513014216e-01
7.0913484303897389e-01</data></cam_dist>
9.4803929000342360e-02 -7.4931503928649663e+00
2.7510446825876069e-03 -1.5574797970388680e-02
5.9686429523557969e+01</data></cam_dist>
<proj_int type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
1.6483495467542737e+03 0. 3.8306162278275889e+02 0.
1.6326239866472497e+03 7.3044314024967093e+02 0. 0. 1.</data></proj_int>
1.8196441201415089e+03 0. 3.1215139179762173e+02 0.
1.7710473039077285e+03 6.4652482452978484e+02 0. 0. 1.</data></proj_int>
<proj_dist type_id="opencv-matrix">
<rows>1</rows>
<cols>5</cols>
<dt>d</dt>
<data>
-4.7323012136273940e-01 6.1654050808332572e+00
-2.6533525558408575e-02 -4.8302040441684145e-02
-2.1030103617531569e+01</data></proj_dist>
4.6501355527112370e-01 -5.2653146171000911e+00
-3.1399879320030987e-03 -7.4973212336674019e-02
2.5370499794178890e+01</data></proj_dist>
<rotation type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
9.9544319031800177e-01 2.2550253921095241e-02
-9.2651718265839858e-02 -3.7412411799396868e-02
9.8608873522691420e-01 -1.6195467792545257e-01
8.7710696570434246e-02 1.6468300551872025e-01 9.8243897591679974e-01</data></rotation>
9.9751030556985942e-01 7.9013584755337138e-03 7.0076806549434587e-02
-7.0415421716406692e-04 9.9476980417395522e-01
-1.0213981040979671e-01 -7.0517334384988042e-02
1.0183616861386664e-01 9.9229869510812307e-01</data></rotation>
<translation type_id="opencv-matrix">
<rows>3</rows>
<cols>1</cols>
<dt>d</dt>
<data>
-5.4987956675391622e+01 3.6267509838011689e+00
-1.5791458092388201e+01</data></translation>
-3.6051053224527990e+01 -1.1530953901520501e+01
1.0668513452875833e+02</data></translation>
</opencv_storage>
+1 -1
View File
@@ -138,7 +138,6 @@ def create_data(out_root, idx, n_samples, imsize, patterns, K, baseline, blend_i
# render the scene at multiple scales
scales = [1, 0.5, 0.25, 0.125]
for scale in scales:
fx = K[0, 0] * scale
fy = K[1, 1] * scale
@@ -254,6 +253,7 @@ if __name__ == '__main__':
track_length = 4
# load pattern image
# FIXME which one????
pattern_path = './kinect_pattern.png'
pattern_crop = True
patterns = get_patterns(pattern_path, imsizes, pattern_crop)
+21 -13
View File
@@ -85,34 +85,42 @@ def euler_angles_from_rotation_matrix(R):
return psi, theta, phi
####################################################
print('R1:\n', R1)
print(euler_angles_from_rotation_matrix(R1))
print('R2:\n', R2)
print(euler_angles_from_rotation_matrix(R2))
print('P1:\n', P1)
print('P2:\n', P2)
print('Q :\n', Q)
# print('R1:\n', R1)
# print(euler_angles_from_rotation_matrix(R1))
# print('R2:\n', R2)
# print(euler_angles_from_rotation_matrix(R2))
# print('P1:\n', P1)
# print('P2:\n', P2)
# print('Q :\n', Q)
#
#
# print(P1.shape)
pattern = cv2.imread('kinect_pattern.png')
sampled_pattern = cv2.imread('sampled_kinect_pattern.png')
proj_rect_map1, proj_rect_map2 = cv2.initInverseRectificationMap(
# proj_rect_map1, proj_rect_map2=cv2.initUndistortRectifyMap(
params['proj']['K'],
params['proj']['dist'],
R1,
# None,
P1,
# (688, 488),
(1280, 1024),
(688, 488),
# (1280, 800),
cv2.CV_16SC2,
)
# print(proj_rect_map1.shape, proj_rect_map2.shape)
rect_pat = cv2.remap(pattern, proj_rect_map1, proj_rect_map2, cv2.INTER_LINEAR)
samp_rect_pat = cv2.remap(sampled_pattern, proj_rect_map1, proj_rect_map2, cv2.INTER_CUBIC)
rect_pat = cv2.remap(pattern, proj_rect_map1, proj_rect_map2, cv2.INTER_CUBIC)
# FIXME rect_pat is always zero
# print(rect_pat.shape)
cv2.imshow('get rect', samp_rect_pat)
cv2.waitKey()
cv2.imshow('get rect', rect_pat)
cv2.waitKey()
# cv2.imshow(rect_pat2)
cv2.waitKey()
cv2.imwrite('rectified_sampled_pattern_new.png', samp_rect_pat)
cv2.imwrite('rectified_pattern_new.png', rect_pat)