CARLA
 
载入中...
搜索中...
未找到
Tagger.h
浏览该文件的文档.
1// Copyright (c) 2017 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#pragma once
8
9#include "GameFramework/Actor.h"
10#include "Components/PrimitiveComponent.h"
11
15
16#include "Tagger.generated.h"
17
18namespace crp = carla::rpc;
19
20/// 根据语义分割设置 actor 的自定义深度模板值
21///到他们的网格中。
22///
23/// 存在非静态函数,因此可以将其放入场景中进行测试
24///目的。
25UCLASS()
26class CARLA_API ATagger : public AActor
27{
28 GENERATED_BODY()
29
30public:
31
32 /// 设置角色的标签。
33 ///
34 /// 如果 bTagForSemanticSegmentation 为 true,则激活自定义深度通道。这
35 ///pass 是渲染语义分割所必需的。但是,它可能会
36 ///添加性能损失,因为遮挡似乎未应用于
37 ///具有 active 此值的对象。
38 static void TagActor(const AActor &Actor, bool bTagForSemanticSegmentation);
39
40
41 ///设置 level 中每个 actor 的标签。
42 ///
43 /// 如果 bTagForSemanticSegmentation 为 true,则激活自定义深度通道。这
44 ///pass 是渲染语义分割所必需的。但是,它可能会
45 ///添加性能损失,因为遮挡似乎未应用于
46 ///具有 active 此值的对象。
47 static void TagActorsInLevel(UWorld &World, bool bTagForSemanticSegmentation);
48
49 static void TagActorsInLevel(ULevel &Level, bool bTagForSemanticSegmentation);
50
51 /// 检索已标记组件的标记。
53 {
54 return static_cast<crp::CityObjectLabel>(Component.CustomDepthStencilValue);
55 }
56
57 ///检索已标记的角色的标记。CityObjectLabel::None 为
58 ///未添加到数组中。
59 static void GetTagsOfTaggedActor(const AActor &Actor, TSet<crp::CityObjectLabel> &Tags);
60
61 /// 如果 @a Component 已使用给定的 @a 标记进行标记,则返回 true。
62 static bool MatchComponent(const UPrimitiveComponent &Component, crp::CityObjectLabel Tag)
63 {
64 return (Tag == GetTagOfTaggedComponent(Component));
65 }
66
67 ///检索已标记的角色的标记。CityObjectLabel::None 为
68 ///未添加到数组中。
69 static FString GetTagAsString(crp::CityObjectLabel Tag);
70
71 /// 计算文件夹路径对应的标签的方法
72 static crp::CityObjectLabel GetLabelByFolderName(const FString &String);
73
74 /// 计算特定对象对应的 label 的方法
75 ///使用存储它的文件夹路径
76 template <typename T>
77 static crp::CityObjectLabel GetLabelByPath(const T *Object) {
78 const FString Path = Object->GetPathName();
79 TArray<FString> StringArray;
80 Path.ParseIntoArray(StringArray, TEXT("/"), false);
81 return (StringArray.Num() > 4 ? GetLabelByFolderName(StringArray[4]) : crp::CityObjectLabel::None);
82 }
83
84 static void SetStencilValue(UPrimitiveComponent &Component,
85 const crp::CityObjectLabel &Label, const bool bSetRenderCustomDepth);
86
87 static FLinearColor GetActorLabelColor(const AActor &Actor, const crp::CityObjectLabel &Label);
88
89 static bool IsThing(const crp::CityObjectLabel &Label);
90
91 ATagger();
92
93protected:
94
95#if WITH_EDITOR
96 virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
97#endif // WITH_EDITOR
98
99private:
100
101 UPROPERTY(Category = "Tagger", EditAnywhere)
102 bool bTriggerTagObjects = false;
103
104 UPROPERTY(Category = "Tagger", EditAnywhere)
105 bool bTagForSemanticSegmentation = false;
106};
TSharedPtr< const FActorInfo > carla::rpc::ActorState UWorld * World
TSharedPtr< const FActorInfo > carla::rpc::ActorState UWorld Actor
根据语义分割设置 actor 的自定义深度模板值 到他们的网格中。
Definition Tagger.h:27
static crp::CityObjectLabel GetTagOfTaggedComponent(const UPrimitiveComponent &Component)
检索已标记组件的标记。
Definition Tagger.h:52
static bool MatchComponent(const UPrimitiveComponent &Component, crp::CityObjectLabel Tag)
如果 Component 已使用给定的 标记进行标记,则返回 true。
Definition Tagger.h:62
static crp::CityObjectLabel GetLabelByPath(const T *Object)
计算特定对象对应的 label 的方法 使用存储它的文件夹路径
Definition Tagger.h:77