I figured out how to get Instance Segmenation color of vehicles #5047
Replies: 4 comments 13 replies
-
Great find! We don't know yet if there is any way to get the Unreal-Engine ID for a Carla Actor with a specific Carla ID or is there? The latter would be especially useful for anyone who can't / doesn't want to build Carla from source |
Beta Was this translation helpful? Give feedback.
-
Hi, a quick question. Did you reverse-engineer or something like that to find the ID when using OpenCV to get the RGB values? |
Beta Was this translation helpful? Give feedback.
-
many thanks for your information. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
in carla/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Game/Tagger.cpp
there is newly added code at line 70
I thought this code determines color of instance segmantaion
but Actor.GetUniqueID() is not Actor Id in carla simulator
this function is in Unreal Engine which returns Unique ID in Unreal Engine(I guess), not Id in carla
but I could't replace this code to use carla Actor Id
Instead, I changed carla Actor Id to Unique ID
in carla/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Actor/ActorRegistry.cpp at line 80
there is code that determines Id of actor.
IdType Id = ++FActorRegistry::ID_COUNTER;
I removed it and replace with
IdType Id = Actor.GetUniqueID();
then make PythonAPI and I test it to see whether it really works
I run manual_control.py with
print(world.player.id)
print((world.player.id & 0x00ff) >> 0)
print((world.player.id & 0xff00) >> 8)
then I captured screen, checked the RGB value with OpenCV and it was correct!!
ID is 116793, G is 57, B is 200
I hope this can help other guys :)
Beta Was this translation helpful? Give feedback.
All reactions