Cameras and sensors
Cameras and sensors can be added to the player vehicle by defining them in the settings file sent by the client on every new episode. Check out the examples at CARLA Settings example.
This document describes the details of the different cameras/sensors currently available as well as the resulting images produced by them.
Although we plan to extend the sensor suite of CARLA in the near future, at the moment there are only three different sensors available. These three sensors are implemented as different post-processing effects applied to scene capture cameras.
The images are sent by the server as a BGRA array of bytes. The provided Python client retrieves the images in this format, it's up to the users to parse the images and convert them to the desired format. There are some examples in the PythonClient folder showing how to parse the images.
There is a fourth post-processing effect available, None, which provides a view with of the scene with no effect, not even lens effects like flares or depth of field; we will skip this one in the following descriptions.
We provide a tool to convert raw depth and semantic segmentation images to a more human readable palette of colors. It can be found at "Util/ImageConverter".
The "scene final" camera provides a view of the scene after applying some post-processing effects to create a more realistic feel. These are actually stored on the Level, in an actor called PostProcessVolume and not in the Camera. We use the following post process effects:
- Vignette Darkens the border of the screen.
- Grain jitter Adds a bit of noise to the render.
- Bloom Intense lights burn the area around them.
- Auto exposure Modifies the image gamma to simulate the eye adaptation to darker or brighter areas.
- Lens flares Simulates the reflection of bright objects on the lens.
- Depth of field Blurs objects near or very far away of the camera.
The "depth map" camera provides an image with 24 bit floating precision point codified in the 3 channels of the RGB color space. The order from less to more significant bytes is R -> G -> B.
Our max render distance (far) is 1km.
To decodify our depth first we get the int24.
R + G*256 + B*256*256
Then normalize it in the range [0, 1].
Ans / ( 256*256*256 - 1 )
And finally multiply for the units that we want to get. We have set the far plane at 1000 metres.
Ans * far
The "semantic segmentation" camera classifies every object in the view by displaying it in a different color according to the object class. E.g., pedestrians appear in a different color than vehicles.
The server provides an image with the tag information encoded in the red channel. A pixel with a red value of x displays an object with tag x. The following tags are currently available
This is implemented by tagging every object in the scene before hand (either at begin play or on spawn). The objects are classified by their relative file path in the project. E.g., every mesh stored in the "Unreal/CarlaUE4/Content/Static/Pedestrians" folder it's tagged as pedestrian.
Adding new tags:
At the moment adding new tags is not very flexible and requires to modify
the C++ code. Add a new label to the
ECityObjectLabel enum in "Tagger.h",
and its corresponding filepath check inside
function in "Tagger.cpp".