Created
November 27, 2017 03:12
-
-
Save iory/116f04731be45344a5ac3a638815283e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib # NOQA | |
import matplotlib.pyplot as plt | |
import pybullet as p | |
from pybullet_envs.bullet.kukaCamGymEnv import KukaCamGymEnv | |
env = KukaCamGymEnv(renders=True) | |
ob = env.reset() | |
for i in range(0, 180, 5): | |
camEyePos = [0.03, 0.236, 0.54] | |
distance = 1.06 | |
pitch = -56 | |
yaw = i | |
roll = 0 | |
upAxisIndex = 2 | |
camInfo = p.getDebugVisualizerCamera() | |
viewMat = camInfo[2] | |
viewMat = p.computeViewMatrixFromYawPitchRoll( | |
camEyePos, distance, yaw, pitch, roll, upAxisIndex) | |
projMatrix = camInfo[3] | |
img_arr = p.getCameraImage(width=env._width, | |
height=env._height, | |
viewMatrix=viewMat, | |
projectionMatrix=projMatrix) | |
rgb = img_arr[2] | |
np_img_arr = np.reshape(rgb, | |
(env._height, env._width, 4)) | |
plt.imshow(np_img_arr) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment