CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Sensor
InstanceSegmentationCamera_WideAngleLens.cpp
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#include "
Carla/Sensor/InstanceSegmentationCamera_WideAngleLens.h
"
8
#include "
Carla.h
"
9
#include "
Carla/Util/CameraModelUtil.h
"
10
#include "
Carla/Actor/ActorBlueprintFunctionLibrary.h
"
11
12
#include "
Carla/Sensor/PixelReader.h
"
13
14
FActorDefinition
AInstanceSegmentationCamera_WideAngleLens::GetSensorDefinition
()
15
{
16
return
UActorBlueprintFunctionLibrary::MakeWideAngleLensCameraDefinition
(
17
TEXT(
"instance_segmentation"
));
18
}
19
20
AInstanceSegmentationCamera_WideAngleLens::AInstanceSegmentationCamera_WideAngleLens
(
21
const
FObjectInitializer &ObjectInitializer)
22
: Super(ObjectInitializer)
23
{
24
Super::SetCubemapSampler(
CameraModelUtil::GetSampler
(ESamplerFilter::SF_Point));
25
26
AddPostProcessingMaterial
(
27
TEXT(
"Material'/Game/Carla/PostProcessMaterials/M_InstanceSegmentationSensorMaterial'"
));
28
}
29
30
void
AInstanceSegmentationCamera_WideAngleLens::SetUpSceneCaptureComponents
(
31
TArrayView<USceneCaptureComponent2D_CARLA*> SceneCaptures)
32
{
33
Super::SetUpSceneCaptureComponents(SceneCaptures);
34
// The post-process material samples the segmentation ID buffer; the
35
// renderer only produces it for captures that opt in (same as the pinhole
36
// AInstanceSegmentationCamera). Without this the six faces read an
37
// unwritten buffer and the projected image is noise.
38
for
(
auto
SceneCapture : SceneCaptures)
39
if
(SceneCapture !=
nullptr
)
40
SceneCapture->bRequiresSegmentationPass =
true
;
41
}
42
43
void
AInstanceSegmentationCamera_WideAngleLens::PostPhysTick
(
44
UWorld *World, ELevelTick TickType,
float
DeltaSeconds)
45
{
46
TRACE_CPUPROFILER_EVENT_SCOPE(
AInstanceSegmentationCamera_WideAngleLens::PostPhysTick
);
47
// Skip the whole 6-face capture + compute + readback pipeline when no
48
// client is subscribed.
49
if
(!
AreClientsListening
())
50
return
;
51
CaptureAndSendToClient
(*
this
);
52
}
ActorBlueprintFunctionLibrary.h
CameraModelUtil.h
Carla.h
InstanceSegmentationCamera_WideAngleLens.h
PixelReader.h
AInstanceSegmentationCamera_WideAngleLens::SetUpSceneCaptureComponents
void SetUpSceneCaptureComponents(TArrayView< USceneCaptureComponent2D_CARLA * > SceneCaptures) override
Definition
InstanceSegmentationCamera_WideAngleLens.cpp:30
AInstanceSegmentationCamera_WideAngleLens::GetSensorDefinition
static FActorDefinition GetSensorDefinition()
Definition
InstanceSegmentationCamera_WideAngleLens.cpp:14
AInstanceSegmentationCamera_WideAngleLens::AInstanceSegmentationCamera_WideAngleLens
AInstanceSegmentationCamera_WideAngleLens(const FObjectInitializer &ObjectInitializer)
Definition
InstanceSegmentationCamera_WideAngleLens.cpp:20
AInstanceSegmentationCamera_WideAngleLens::PostPhysTick
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds) override
Definition
InstanceSegmentationCamera_WideAngleLens.cpp:43
ASceneCaptureSensor_WideAngleLens::CaptureAndSendToClient
static void CaptureAndSendToClient(TSensor &Sensor)
Capture the six faces, project them into the lens, and deliver the image through ImageUtil's per-tick...
Definition
SceneCaptureSensor_WideAngleLens.h:254
ASensor::AreClientsListening
bool AreClientsListening()
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h:124
AShaderBasedSensor_WideAngleLens::AddPostProcessingMaterial
bool AddPostProcessingMaterial(const FString &Path)
Definition
ShaderBasedSensor_WideAngleLens.cpp:22
UActorBlueprintFunctionLibrary::MakeWideAngleLensCameraDefinition
static FActorDefinition MakeWideAngleLensCameraDefinition(const FString &Id, bool bEnableModifyingPostProcessEffects=false)
Definition
ActorBlueprintFunctionLibrary.cpp:519
CameraModelUtil::GetSampler
FRHISamplerState * GetSampler(ESamplerFilter Filter)
Definition
CameraModelUtil.cpp:780
FActorDefinition
A definition of a Carla Actor with all the variation and attributes.
Definition
Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Actor/ActorDefinition.h:20
Generated by
1.18.0