|
CARLA
|
Sensor that produce Dynamic Vision Events. More...
#include <DVSCamera.h>
Inheritance diagram for ADVSCamera:Public Member Functions | |
| ADVSCamera (const FObjectInitializer &ObjectInitializer) | |
| void | Set (const FActorDescription &ActorDescription) override |
Public Member Functions inherited from AShaderBasedSensor | |
| bool | AddPostProcessingMaterial (const FString &Path) |
| Load the UMaterialInstanceDynamic at the given Path and append it to the list of shaders with Weight. | |
| void | AddShader (const FSensorShader &Shader) |
| Add a post-processing shader. | |
| AShaderBasedSensor (const FObjectInitializer &ObjectInitializer) | |
| void | Set (const FActorDescription &ActorDescription) override |
| void | SetFloatShaderParameter (uint8_t ShaderIndex, const FName &ParameterName, float Value) |
Public Member Functions inherited from ASceneCaptureSensor | |
| bool | ArePostProcessingEffectsEnabled () const |
| ASceneCaptureSensor (const FObjectInitializer &ObjectInitializer) | |
| void | Enable16BitFormat (bool Enable=false) |
| void | EnablePostProcessingEffects (bool Enable=true) |
| void | EnqueueRenderSceneImmediate () |
| Immediate enqueues render commands of the scene at the current time. | |
| float | GetAOIntensity () const |
| float | GetAORadius () const |
| float | GetAperture () const |
| int | GetBladeCount () const |
| float | GetBloomIntensity () const |
| UTexture2D * | GetBloomKernelTexture () const |
| EBloomMethod | GetBloomMethod () const |
| float | GetBlueCorrection () const |
| USceneCaptureComponent2D_CARLA * | GetCaptureComponent () const |
| USceneCaptureComponent2D * | GetCaptureComponent2D () |
| UTextureRenderTarget2D * | GetCaptureRenderTarget () |
| float | GetChromAberrIntensity () const |
| float | GetChromAberrOffset () const |
| FVector4 | GetColorContrast () const |
| FVector4 | GetColorContrastHighlights () const |
| FVector4 | GetColorContrastMidtones () const |
| FVector4 | GetColorGamma () const |
| FVector4 | GetColorSaturation () const |
| FVector4 | GetColorSaturationHighlights () const |
| FVector4 | GetColorSaturationMidtones () const |
| float | GetDepthBlurAmount () const |
| float | GetDepthBlurRadius () const |
| float | GetDepthOfFieldMinFstop () const |
| float | GetDetailStrength () const |
| float | GetDirtMaskIntensity () const |
| float | GetExposureCalibrationConstant () const |
| float | GetExposureCompensation () const |
| float | GetExposureMaxBrightness () const |
| EAutoExposureMethod | GetExposureMethod () const |
| float | GetExposureMinBrightness () const |
| float | GetExposureSpeedDown () const |
| float | GetExposureSpeedUp () const |
| float | GetFilmBlackClip () const |
| float | GetFilmGrainIntensity () const |
| float | GetFilmShoulder () const |
| float | GetFilmSlope () const |
| float | GetFilmToe () const |
| float | GetFilmWhiteClip () const |
| float | GetFocalDistance () const |
| float | GetFOVAngle () const |
| FVector4 | GetGlobalGain () const |
| float | GetHighlightContrastScale () const |
| FVector4 | GetHighlightsGamma () const |
| uint32 | GetImageHeight () const |
| uint32 | GetImageWidth () const |
| float | GetISO () const |
| float | GetLensFlareIntensity () const |
| ELocalExposureMethod | GetLocalExposureMethod () const |
| float | GetMotionBlurIntensity () const |
| float | GetMotionBlurMaxDistortion () const |
| float | GetMotionBlurMinObjectScreenSize () const |
| FRHIGPUReadbackPoolPtr | GetReadbackPool () const |
| Per-sensor pool of recyclable RHI readback objects. | |
| FLinearColor | GetSceneColorTint () const |
| float | GetSensorWidth () const |
| float | GetShadowContrastScale () const |
| const FCarlaShowOnlyFilter & | GetShowOnlyFilter () const |
| float | GetShutterSpeed () const |
| float | GetTargetGamma () const |
| float | GetToneCurveAmount () const |
| bool | GetUseRayTracing () const |
| float | GetVignetteIntensity () const |
| float | GetWhiteTemp () const |
| float | GetWhiteTint () const |
| bool | Is16BitFormatEnabled () const |
| bool | IsDLSSUpscaleEnabled () const |
| bool | IsShowOnlyEnabled () const |
| bool | ReadPixels (TArray< FColor > &BitMap) const |
| Use for debugging purposes only. | |
| void | SaveCaptureToDisk (const FString &FilePath) const |
| Use for debugging purposes only. | |
| void | SetAOIntensity (float Intensity) |
| void | SetAORadius (float Radius) |
| void | SetAperture (float Aperture) |
| void | SetBladeCount (int Count) |
| void | SetBloomConvolutionTexture (UTexture2D *Texture) |
| void | SetBloomIntensity (float Intensity) |
| void | SetBloomMethod (EBloomMethod Method) |
| void | SetBlueCorrection (float Val) |
| void | SetChromAberrIntensity (float Intensity) |
| void | SetChromAberrOffset (float ChromAberrOffset) |
| void | SetColorContrast (FVector4 ColorContrast) |
| void | SetColorContrastHighlights (FVector4 ColorContrast) |
| void | SetColorContrastMidtones (FVector4 ColorContrast) |
| void | SetColorGamma (FVector4 ColorGamma) |
| void | SetColorSaturation (FVector4 ColorSaturation) |
| void | SetColorSaturationHighlights (FVector4 ColorSaturation) |
| void | SetColorSaturationMidtones (FVector4 ColorSaturation) |
| void | SetDepthBlurAmount (float Amount) |
| void | SetDepthBlurRadius (float Radius) |
| void | SetDepthOfFieldMinFstop (float MinFstop) |
| void | SetDetailStrength (float Val) |
| void | SetDirtMaskIntensity (float Intensity) |
| void | SetDLSSUpscale (bool Enable, float ScreenPercentage) |
| Render the capture at ScreenPercentage (25-100) of the target resolution and upscale it back with DLSS Super Resolution when available (bilinear otherwise). | |
| void | SetExposureCalibrationConstant (float Constant) |
| void | SetExposureCompensation (float Compensation) |
| void | SetExposureMaxBrightness (float Brightness) |
| void | SetExposureMethod (EAutoExposureMethod Method) |
| void | SetExposureMinBrightness (float Brightness) |
| void | SetExposureSpeedDown (float Speed) |
| void | SetExposureSpeedUp (float Speed) |
| void | SetFilmBlackClip (float BlackClip) |
| void | SetFilmGrainIntensity (float Val) |
| void | SetFilmShoulder (float Shoulder) |
| void | SetFilmSlope (float Slope) |
| void | SetFilmToe (float Toe) |
| void | SetFilmWhiteClip (float WhiteClip) |
| void | SetFocalDistance (float Distance) |
| void | SetFOVAngle (float FOVAngle) |
| void | SetGlobalGain (FVector4 Gain) |
| void | SetHighlightContrastScale (float HighlightContrastScale) |
| void | SetHighlightsGamma (FVector4 HighlightsGamma) |
| void | SetImageSize (uint32 Width, uint32 Height) |
| void | SetISO (float ISO) |
| void | SetLensFlareIntensity (float Intensity) |
| void | SetLocalExposureMethod (ELocalExposureMethod Method) |
| void | SetMotionBlurIntensity (float Intensity) |
| void | SetMotionBlurMaxDistortion (float MaxDistortion) |
| void | SetMotionBlurMinObjectScreenSize (float ScreenSize) |
| void | SetSceneColorTint (FLinearColor SceneColorTint) |
| void | SetSensorWidth (float Width) |
| void | SetShadowCatcherTags (const FString &CommaSeparatedLabels) |
| Labels whose actors are rendered alongside the show-only set so they receive its cast shadows ("Roads,Sidewalks"). | |
| void | SetShadowContrastScale (float ShadowContrastScale) |
| void | SetShowOnlyActorIds (const FString &CommaSeparatedIds) |
| CARLA actor ids always included in the show-only set. | |
| void | SetShowOnlyTags (const FString &CommaSeparatedLabels) |
| Show-only render mode (see FCarlaShowOnlyFilter): comma separated semantic label names. | |
| void | SetShutterSpeed (float Speed) |
| void | SetTargetGamma (float InTargetGamma) |
| void | SetToneCurveAmount (float ToneCurveAmount) |
| void | SetUseRayTracing (bool Enable) |
| void | SetVignetteIntensity (float VignetteIntensity) |
| void | SetWhiteTemp (float Temp) |
| void | SetWhiteTint (float Tint) |
| virtual void | UpdatePostProcessConfig (FPostProcessConfig &InOutPostProcessConfig) |
| void | WaitForRenderThreadToFinish () |
| Blocks until the render thread has finished all it's tasks. | |
Public Member Functions inherited from ASensor | |
| bool | AreClientsListening () |
| ASensor (const FObjectInitializer &ObjectInitializer) | |
| void | ClearReadyToTick () |
| std::optional< FActorAttribute > | GetAttribute (const FString Name) |
| const UCarlaEpisode & | GetEpisode () const |
| virtual void | GetMirrorState (carla::multigpu::SensorState &State) const |
| Multi-GPU: the runtime state this sensor starts its next tick from (noise generator, sweep angle, history). | |
| URandomEngine * | GetRandomEngine () |
| float | GetReadyToTickDeltaSeconds () const |
| int32 | GetSeed () const |
| auto | GetToken () const |
| Return the token that allows subscribing to this sensor's stream. | |
| bool | IsReadyToTick () const |
| bool | IsStreamReady () |
| FDataStream | MoveDataStream () |
| virtual void | OnFirstClientConnected () |
| virtual void | OnLastClientDisconnected () |
| void | PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds) |
| void | SetDataStream (FDataStream InStream) |
| Replace the FDataStream associated with this sensor. | |
| void | SetEpisode (const UCarlaEpisode &InEpisode) |
| virtual void | SetMirrorState (const carla::multigpu::SensorState &State) |
| void | SetPrimaryTick (float DeltaSeconds) |
| Multi-GPU secondary: tick in this engine frame, with the primary's delta. | |
| void | SetSavingDataToDisk (bool bSavingData) |
| void | SetSeed (int32 InSeed) |
| void | Tick (const float DeltaTime) final |
Static Public Member Functions | |
| static FActorDefinition | GetSensorDefinition () |
Static Public Member Functions inherited from ASceneCaptureSensor | |
| static bool | ApplyPostProcessVolumeToSensor (APostProcessVolume *Origin, ASceneCaptureSensor *Dest, bool bOverrideCurrentCamera=false) |
| static bool | ResolveCameraRayTracing (bool bSensorEnabled, bool bRequired) |
Applies the carla.Camera.UseRayTracing tier policy to a camera's own ray-tracing preference. | |
Static Public Member Functions inherited from ASensor | |
| static FSensorCaptureContext | MakeCaptureContext (const ASensor &Sensor) |
| Call on the game thread right after CaptureScene(). | |
Protected Member Functions | |
| void | ImageToGray (const TArray< FColor > &image) |
| void | ImageToLogGray (const TArray< FColor > &image) |
| virtual void | PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaTime) override |
| ADVSCamera::DVSEventArray | Simulation (float DeltaTime) |
Protected Member Functions inherited from AShaderBasedSensor | |
| void | SetUpSceneCaptureComponent (USceneCaptureComponent2D &SceneCapture) override |
Protected Member Functions inherited from ASceneCaptureSensor | |
| virtual void | BeginPlay () override |
| void | CaptureSceneExtended () |
| virtual void | EndPlay (const EEndPlayReason::Type EndPlayReason) override |
| bool | IsAnyGBufferClientListening () const |
| Returns true if any GBuffer stream has an active listener. | |
| virtual void | PrePhysTick (float DeltaSeconds) override |
| virtual bool | RequiresRayTracing () const |
| True for sensors that cannot render without hardware ray tracing (path-traced lens cameras); the tier policy never switches them off. | |
| bool | ShouldCaptureThisFrame () |
| Aggregate gate: main stream or any GBuffer stream has listeners, or CVarCarlaCameraForceAllGBuffers forces every frame. | |
| void | UpdateExposureMotionBlur (UWorld *World, float DeltaTime) |
| Motion blur from the auto exposure time (carla.Camera.ExposureMotionBlur). | |
Protected Member Functions inherited from ASensor | |
| void | EndPlay (EEndPlayReason::Type EndPlayReason) override |
| template<typename SensorType > | |
| FAsyncDataStream | GetDataStream (SensorType &&Self) |
| Return the FDataStream associated with this sensor. | |
| void | PostActorCreated () override |
Private Types | |
| using | DVSEventArray = std::vector<::carla::sensor::data::DVSEvent > |
Private Attributes | |
| dvs::Config | config |
| DVS simulation configuration. | |
| std::int64_t | current_time |
| Current time in nanoseconds. | |
| TArray< double > | last_event_timestamp |
| Image containing time of last event in seconds. | |
| TArray< float > | last_image |
| Images containing last (current) and previous image. | |
| TArray< float > | prev_image |
| TArray< float > | ref_values |
| Image containing the last reference value to trigger event. | |
Additional Inherited Members | ||
Public Attributes inherited from ASceneCaptureSensor | ||
| struct { | ||
| FCameraGBufferUint8 CustomDepth | ||
| FCameraGBufferUint8 CustomStencil | ||
| FCameraGBufferUint8 GBufferA | ||
| FCameraGBufferUint8 GBufferB | ||
| FCameraGBufferUint8 GBufferC | ||
| FCameraGBufferUint8 GBufferD | ||
| FCameraGBufferUint8 GBufferE | ||
| FCameraGBufferUint8 GBufferF | ||
| FCameraGBufferUint8 SceneColor | ||
| FCameraGBufferUint8 SceneDepth | ||
| FCameraGBufferUint8 SceneStencil | ||
| FCameraGBufferUint8 SSAO | ||
| FCameraGBufferUint8 Velocity | ||
| } | CameraGBuffers | |
Static Protected Member Functions inherited from ASensor | ||
| template<typename SensorType , typename ElementType > | ||
| static void | SendDataToClient (SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext) | |
Protected Attributes inherited from ASceneCaptureSensor | ||
| bool | bEnable16BitFormat = false | |
| Whether to change render target format to PF_A16B16G16R16, offering 16bit / channel. | ||
| bool | bEnableDLSSUpscale = false | |
| Render the capture at DLSSScreenPercentage of the target resolution and upscale back with DLSS Super Resolution (engine scene-capture temporal upscaler; bilinear fallback without NVIDIA hardware). | ||
| bool | bEnablePostProcessingEffects = true | |
| Whether to render the post-processing effects present in the scene. | ||
| bool | bUseRayTracing = true | |
| Whether this sensor uses hardware ray tracing for its scene capture. | ||
| TObjectPtr< USceneCaptureComponent2D_CARLA > | CaptureComponent2D = nullptr | |
| Scene capture component. | ||
| TObjectPtr< UTextureRenderTarget2D > | CaptureRenderTarget = nullptr | |
| Render target necessary for scene capture. | ||
| float | DLSSScreenPercentage = 50.0f | |
| Internal render resolution as a percentage of the target resolution when bEnableDLSSUpscale is set. | ||
| float | ExposureSeconds = 0.0f | |
| Exposure time of the last capture in seconds (exposure-linked motion blur). | ||
| uint32 | ImageHeight = 600u | |
| Image height in pixels. | ||
| uint32 | ImageWidth = 800u | |
| Image width in pixels. | ||
| double | LastCaptureTime = -1.0 | |
| Simulation time of this sensor's previous capture (-1 before the first). | ||
| FRHIGPUReadbackPoolPtr | ReadbackPool | |
| Per-sensor pool of recyclable RHI readback objects. | ||
| FCarlaShowOnlyFilter | ShowOnlyFilter | |
| Show-only actor filter, applied to the capture component right before every capture (see FCarlaShowOnlyFilter). | ||
| float | TargetGamma = 2.2f | |
Protected Attributes inherited from ASensor | ||
| bool | bIsActive = false | |
| bool | bSavingDataToDisk = false | |
| URandomEngine * | RandomEngine = nullptr | |
| Random Engine used to provide noise for sensor output. | ||
| int32 | Seed = 123456789 | |
| Seed of the pseudo-random engine. | ||
Sensor that produce Dynamic Vision Events.
Definition at line 46 of file DVSCamera.h.
|
private |
Definition at line 49 of file DVSCamera.h.
| ADVSCamera::ADVSCamera | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 33 of file DVSCamera.cpp.
References AShaderBasedSensor::AddPostProcessingMaterial(), ASceneCaptureSensor::EnablePostProcessingEffects(), and ASensor::RandomEngine.
|
static |
Definition at line 43 of file DVSCamera.cpp.
References Bool, FActorVariation::bRestrictToRecommended, Float, FActorVariation::Id, Int, UActorBlueprintFunctionLibrary::MakeCameraDefinition(), FActorVariation::RecommendedValues, and FActorVariation::Type.
|
protected |
Sanity check
Reserve HxW elements
Convert image to gray raw image values, one row per task
Definition at line 218 of file DVSCamera.cpp.
References FColorToGrayScaleFloat(), ASceneCaptureSensor::GetImageHeight(), ASceneCaptureSensor::GetImageWidth(), and last_image.
Referenced by PostPhysTick().
|
protected |
Sanity check
Reserve HxW elements
Convert image to log gray values, one row per task
Definition at line 240 of file DVSCamera.cpp.
References config, FColorToGrayScaleFloat(), ASceneCaptureSensor::GetImageHeight(), ASceneCaptureSensor::GetImageWidth(), last_image, and dvs::Config::log_eps.
Referenced by PostPhysTick().
|
overrideprotectedvirtual |
Immediate enqueues render commands of the scene at the current time.
Read the image
Convert image to gray scale
DVS Simulator
Send the events
Reimplemented from ASceneCaptureSensor.
Definition at line 135 of file DVSCamera.cpp.
References ASensor::AreClientsListening(), ASceneCaptureSensor::CaptureRenderTarget, config, carla::BufferView::CreateFrom(), carla::streaming::detail::token_type::get_stream_id(), ASensor::GetAttribute(), ASensor::GetDataStream(), FCarlaEngine::GetFrameCounter(), carla::ros2::ROS2::GetInstance(), ASensor::GetToken(), ImageToGray(), ImageToLogGray(), IsValid(), PostPhysTick(), ASceneCaptureSensor::ReadPixels(), carla::sensor::CompositeSerializer< Items >::Serialize(), Simulation(), dvs::Config::use_log, and ASceneCaptureSensor::WaitForRenderThreadToFinish().
Referenced by PostPhysTick().
|
overridevirtual |
Reimplemented from ASensor.
Definition at line 95 of file DVSCamera.cpp.
References dvs::Config::Cm, config, dvs::Config::Cp, dvs::Config::log_eps, dvs::Config::refractory_period_ns, UActorBlueprintFunctionLibrary::RetrieveActorAttributeToBool(), UActorBlueprintFunctionLibrary::RetrieveActorAttributeToFloat(), UActorBlueprintFunctionLibrary::RetrieveActorAttributeToInt(), dvs::Config::sigma_Cm, dvs::Config::sigma_Cp, dvs::Config::use_log, and FActorDescription::Variations.
|
protected |
Array of events
Sanity check
Check initialization
Set the first rendered image
Resizes array to given number of elements. New elements will be zeroed.
Reset current time
delta time in nanoseconds
Loop along the image size
Dropping event because time since last event < refractory_period_ns
Update current time
Definition at line 263 of file DVSCamera.cpp.
References dvs::Config::Cm, config, dvs::Config::Cp, current_time, ASensor::GetEpisode(), ASceneCaptureSensor::GetImageHeight(), ASceneCaptureSensor::GetImageWidth(), URandomEngine::GetNormalDistribution(), last_event_timestamp, last_image, dvs::nanosecToSecTrunc(), prev_image, ASensor::RandomEngine, ref_values, dvs::Config::refractory_period_ns, dvs::secToNanosec(), dvs::Config::sigma_Cm, dvs::Config::sigma_Cp, x, and y.
Referenced by PostPhysTick().
|
private |
DVS simulation configuration.
Definition at line 76 of file DVSCamera.h.
Referenced by ImageToLogGray(), PostPhysTick(), Set(), and Simulation().
|
private |
|
private |
Image containing time of last event in seconds.
Definition at line 70 of file DVSCamera.h.
Referenced by Simulation().
|
private |
Images containing last (current) and previous image.
Definition at line 64 of file DVSCamera.h.
Referenced by ImageToGray(), ImageToLogGray(), and Simulation().
|
private |
Definition at line 64 of file DVSCamera.h.
Referenced by Simulation().
|
private |
Image containing the last reference value to trigger event.
Definition at line 67 of file DVSCamera.h.
Referenced by Simulation().