Esempio n. 1
0
#%% configure the different views

cam_positions = []
cam_orientations = []

cam_positions.append(-array([0., 0., 0.4, 1]).T)
cam_positions.append(-array([0., -0.1, 0.7, 1]).T)
cam_positions.append(-array([0., 0.1, 0.7, 1]).T)

#%% Project screen points in image

cam.set_world_position(-0.05, -0.05, -0.45)
cam.rotate_x(deg2rad(+10.))
cam.rotate_y(deg2rad(-5.))
cam.rotate_z(deg2rad(-5.))
cam.set_P()
cam_points1 = array(cam.project(s1.get_points()))

#%%
cam.set_world_position(-0.2, -0.05, -0.4)
cam.rotate_y(deg2rad(-20.))
cam.set_P()
cam_points2 = array(cam.project(s1.get_points()))

#%%
cam.set_world_position(0.2, -0.05, -0.5)
cam.rotate_y(deg2rad(+40.))
cam.set_P()
cam_points3 = array(cam.project(s1.get_points()))
Esempio n. 2
0
s1.set_pixel_pitch(0.02)
red = (1, 0, 0)
s1.set_color(red)
s1.curvature_radius = 1.800
s1.update()
s1.rotate_x(np.deg2rad(-190.))

#s1.rotate_y(deg2rad(-15.))

#%% Project screen points in image

# cam.set_world_position(-0.05, -0.05, -0.45)
cam.set_t(-0.05, -0.05, -0.45, 'world')
cam.rotate_x(np.deg2rad(+10.))
cam.rotate_y(np.deg2rad(-5.))
cam.rotate_z(np.deg2rad(-5.))
cam.set_P()
cam_points1 = np.array(cam.project(s1.get_points()))

#%% plot

# plot projection
plt.figure()
plt.plot(cam_points1[0], cam_points1[1], '.', color='r')
plt.xlim(0, 1280)
plt.ylim(0, 960)
plt.gca().invert_yaxis()
plt.show()

#%% Opencv camera calibration