Save image from Vision Sensor into .png or .npy

Typically: "How do I... ", "How can I... " questions
Post Reply
zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Save image from Vision Sensor into .png or .npy

Post by zhy149 »

Hello Coppelia,

I'd like to retrieve the image from a vision sensor in the scene and save it into some formats (I may need to look at it later, but these images are for training purposes use mostly). So, I'd like to know how to achieve this both using Python Remote API and in Lua Scripts (using getVisionSensorImage gives me a 1d array(table), so I don't know how to deal with this in Lua and save it into what format is proper).
Thanks a lot!

zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Re: Save image from Vision Sensor into .png or .npy

Post by zhy149 »

Also, what should I do if I want the image to be saved as a gray scale value?
Thank you!

fferri
Posts: 1193
Joined: 09 Sep 2013, 19:28

Re: Save image from Vision Sensor into .png or .npy

Post by fferri »

sim.getVisionSensorImage gives you the binary image data.

Use sim.saveImage to save the image data to various formats.

Post Reply