Save Greyscale Image from Vision Sensor

Typically: "How do I... ", "How can I... " questions
Post Reply
mirovoellmy
Posts: 1
Joined: 25 Jan 2019, 13:06

Save Greyscale Image from Vision Sensor

Post by mirovoellmy » 18 Feb 2019, 13:20

Hi,
I'm trying to record a greyscale vision sensor and save some images to drive using sim.saveImage().
The documentation describes that the the function can only handle rgb and rgbd images. Did I miss something or do I have to manually convert my greyscale [res_x * res_y] image to a rgb [res_x * res_y * 3] image everytime I want to save an image?

If yes, it would be nice to have an option in the saveImage() function so it can also save grayscale images. :)

Thanks

Miro

coppelia
Site Admin
Posts: 7190
Joined: 14 Dec 2012, 00:25

Re: Save Greyscale Image from Vision Sensor

Post by coppelia » 20 Feb 2019, 13:43

Hello,

you can use sim.transformBuffer for that:

Code: Select all

rgbImage=sim.transformBuffer(greyImage,sim.buffer_uint8,1,0,sim.buffer_uint8rgb)
Cheers

Post Reply