Hi all
I use omni.syntheticdata.sensors get rgb data from viewport, and then save to file.
The problem is render speed, my scene has a moving object, if in low fps, the image saved has a little bit different with high
code snippet as below:
import omni.syntheticdata as syn
vp_iface = omni.kit.viewport.get_viewport_interface()
async def _wait_for_data(self, vp):
if vp.is_visible():
data = np.empty(0)
start = time()
while data.size == 0 and time() < start + 200:
await omni.kit.app.get_app_interface().next_update_async()
data = syn.sensors.get_rgb(vp)
async def _write_rgb(self, file):
vp = vp_iface.get_viewport_window()
await self._wait_for_data(vp)
data = syn.sensors.get_rgb(vp)
cv2.imwrite(file , cv2.cvtColor(data, cv2.COLOR_RGB2BGR))
Thanks in advance