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
Save Greyscale Image from Vision Sensor
Re: Save Greyscale Image from Vision Sensor
Hello,
you can use sim.transformBuffer for that:
Cheers
you can use sim.transformBuffer for that:
Code: Select all
rgbImage=sim.transformBuffer(greyImage,sim.buffer_uint8,1,0,sim.buffer_uint8rgb)
Re: Save Greyscale Image from Vision Sensor
Hello,
I would like to ask if there is an oportunity to save grayscale image (monocolor or 8bit depth).
My goal is to have a small file but in good quality.
Thank you
I would like to ask if there is an oportunity to save grayscale image (monocolor or 8bit depth).
My goal is to have a small file but in good quality.
Thank you
Re: Save Greyscale Image from Vision Sensor
Hello,
as of CoppeliaSim 4.0.0, this is unfortunately not possible. But in next release you'll be able to do that with, e.g.:
Cheers
as of CoppeliaSim 4.0.0, this is unfortunately not possible. But in next release you'll be able to do that with, e.g.:
Code: Select all
local img,resX,resY=sim.getVisionSensorCharImage(visionSensorHandle)
img=sim.transformBuffer(img,sim.buffer_uint8rgb,1,0,sim.buffer_uint8)
sim.saveImage(img,{resX,resY},2,"testImg.png",100)
Re: Save Greyscale Image from Vision Sensor
hi there,
I am currently using b0 remote API with C++ on visual studio, do you know how to save an image from the vision sensor?
I have been checking examples but with any clue how to use functions to save it as an image. could you please provide some examples for that?
thanks.
I am currently using b0 remote API with C++ on visual studio, do you know how to save an image from the vision sensor?
Code: Select all
int visionsensor = b0RemoteApi::readInt(client.simxGetObjectHandle("Vision_sensor", client.simxServiceCall()), 1);
std::vector<msgpack::object>* imginfo = client.simxGetVisionSensorImage(visionsensor, 0, client.simxServiceCall());
b0RemoteApi::print(imginfo);
thanks.
Re: Save Greyscale Image from Vision Sensor
Hello,
to save an image from CoppeliaSim is quite immediate with the
Cheers
to save an image from CoppeliaSim is quite immediate with the
sim.saveImage
function. From an external application, you'll have to use your own or a third-library routines to handle that. Here if you use Qt.Cheers
Re: Save Greyscale Image from Vision Sensor
Hello Coppelia,
When one uses sim.saveImage where does the image reside?
I can seem to find it - perhaps it's not working for me. I don't get any error, so I am not sure if the saveImage works or not.
From either the external script or within an actuation function in my simulator, I run this:
When one uses sim.saveImage where does the image reside?
I can seem to find it - perhaps it's not working for me. I don't get any error, so I am not sure if the saveImage works or not.
From either the external script or within an actuation function in my simulator, I run this:
Code: Select all
local img, resX, resY, sim.getVisionSensorCharImage(visionSensorHandle) -- in external python script, there is no keyword local though
sim.saveImage(img, {resX, resY}, 0, "test.png", 100) -- i've also tried [resX, resY] and I can't remember which combination returns an error.
Re: Save Greyscale Image from Vision Sensor
Hello,
as far as I know, this will place the file in the CoppeliaSim folder. Best is to specify an absolute path.
Cheers
as far as I know, this will place the file in the CoppeliaSim folder. Best is to specify an absolute path.
Cheers