Page 1 of 1

Specific objects in vision sensor

Posted: 16 Sep 2014, 15:43
by dknetz
Hi all,

I would like to get a ground truth image (for evaluating a segmentation algorithm) from a vision sensor in vrep that only contains specified objects. I can create such an image by grouping the objects but that also leads to a situation where all objects will move simultaneously. Is there a method to achieve such an image without grouping the objects?

Cheers,
Daniel

Re: Specific objects in vision sensor

Posted: 16 Sep 2014, 23:33
by coppelia
Hello Daniel,

you have several possibilities, depending on what you want to do exactly:
  • you can create a collection with all the objects that your vision sensor should see. In the vision sensor properties, then specify that collection in the Entity to render item.
  • you can download a beta version of release 3.1.3, and there you can specify several different rendering modes for your vision sensor. You can for instance render a scene and retrieve all the object handles of objects that are beeing seen, or you can render objects with auxiliary colors that you can code for your specific need. The user manual of the beta version can be found here.
Cheers

Re: Specific objects in vision sensor

Posted: 17 Sep 2014, 12:27
by dknetz
Hi,

thanks a lot. I will test it as soon as I can!

Cheers,
Daniel

Re: Specific objects in vision sensor

Posted: 17 Sep 2014, 15:25
by dknetz
Hi,

sorry for the double post.

I took option b and replaced my version with the beta V-REP. Actually, I can set the auxiliary color, but if the object is textured, the auxiliary color is mixed with the texture in the camera image. Is it possible to get a clean red or blue object despite texturing?

Cheers,
Daniel

Re: Specific objects in vision sensor

Posted: 18 Sep 2014, 03:38
by coppelia
Hello Daniel,

this is a bug, and will be corrected in next release (3.1.3), out within 2 weeks.

Thanks for pointing this out.

Cheers

Re: Specific objects in vision sensor

Posted: 15 Jan 2018, 10:14
by schulz
hi,

this is exactly what I was searching for, thanks for that post!
@coppelia: You mentioned the possibility of retrieving all the object handles seen by the vision sensor. Do you have a hint or an example for me how to do that exactly? I'm using V-Rep V3.4.0.

Thanks in advance.

Re: Specific objects in vision sensor

Posted: 15 Jan 2018, 18:42
by coppelia
Hello,

you will have to use a vision sensor with render mode: OpenGL, color coded handles. Then, you can read the image content of that vision sensor with simGetVisionSensorCharImage. Each pixel-triplet (RGB) codes the handle of the object it belongs to. If my memory serves me correctly, something like:

Code: Select all

objectHandle=R+G*256+B*256*256
Cheers

Re: Specific objects in vision sensor

Posted: 03 Jan 2019, 16:57
by maks
Is there a way to make the color codes consistent across multiple runs?
For exactly the same setup the codes generated/used are changing at every simulation run, I use the simulator to generate the segmentation mask, using OpenGL, color-coded handles, I can obtain the masks for each of the objects but the ids for each of the class are not consistent. Are there any other alternatives?

Re: Specific objects in vision sensor

Posted: 04 Jan 2019, 13:49
by coppelia
Hello,

not sure I understand what you mean. The colors are coded by using the object handles. If the object handles are different, then the colors will also be different.

There is no guarantee that from one scene load to another (or for that matter from one model load to another) the handles will be same. For that reason you always should retrieves the handles of objects based on object names.

Cheers

Re: Specific objects in vision sensor

Posted: 04 Jan 2019, 23:27
by maks
Thank you very much for the reply, that answers my question!