NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
NVSceneFeatureExtractor_ImageExport.h
1 /*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * NVIDIA CORPORATION and its licensors retain all intellectual property
5 * and proprietary rights in and to this software, related documentation
6 * and any modifications thereto. Any use, reproduction, disclosure or
7 * distribution of this software and related documentation without an express
8 * license agreement from NVIDIA CORPORATION is strictly prohibited.
9 */
10 
11 #pragma once
12 
13 #include "Components/SceneComponent.h"
14 #include "Components/SceneCaptureComponent.h"
15 #include "Engine/TextureRenderTarget2D.h"
16 #include "NVSceneCapturerUtils.h"
17 #include "NVTextureReader.h"
18 #include "NVSceneFeatureExtractor.h"
19 #include "NVSceneFeatureExtractor_ImageExport.generated.h"
20 
25 
26 /// Base class for all the feature extractors that capture the scene view in pixel data format
27 UCLASS(Abstract)
29 {
30  GENERATED_BODY()
31 
32 public:
33  UNVSceneFeatureExtractor_PixelData(const FObjectInitializer& ObjectInitializer);
34 
35  /// Callback function get called after the scene capture component finished capturing scene and read back its pixels data
36  /// FNVTexturePixelData - The struct contain the captured scene's pixels data
37  /// UNVSceneFeatureExtractor_PixelData* - Reference to the feature extractor that captured the scene pixels data
38  typedef TFunction<void(const FNVTexturePixelData&, UNVSceneFeatureExtractor_PixelData*)> OnFinishedCaptureScenePixelsDataCallback;
39 
40  virtual bool CaptureSceneToPixelsData(UNVSceneFeatureExtractor_PixelData::OnFinishedCaptureScenePixelsDataCallback Callback);
41 
42  virtual void StartCapturing() override;
43  virtual void StopCapturing() override;
44  virtual void UpdateCapturerSettings() override;
45 
46  UNVSceneCaptureComponent2D* CreateSceneCaptureComponent2d(UMaterialInstance* PostProcessingMaterial = nullptr, const FString& ComponentName = TEXT(""));
47 
48  virtual class UTextureRenderTarget2D* GetRenderTarget() const;
49 
50 protected:
51  virtual void UpdateSettings() override;
52  virtual void UpdateMaterial();
53 
54 protected: // Editor properties
55  /// If true, only show the training actors in the exported images
56  UPROPERTY(EditDefaultsOnly, Category = Config)
57  bool bOnlyShowTrainingActors;
58 
59  /// List of actors to ignore when capturing image
60  UPROPERTY(EditInstanceOnly, Category = Config)
61  TArray<AActor*> IgnoreActors;
62 
63  UPROPERTY(EditDefaultsOnly, Category = Config, meta = (PinHiddenByDefault, InlineEditConditionToggle))
64  bool bOverrideShowFlagSettings;
65 
66  /// ShowFlags for the SceneCapture's ViewFamily, to control rendering settings for this view. Hidden but accessible through details customization
67  UPROPERTY(EditDefaultsOnly, interp, Category = Config, meta = (editcondition = bOverrideShowFlagSettings))
68  TArray<struct FEngineShowFlagsSetting> OverrideShowFlagSettings;
69 
70  UPROPERTY(EditDefaultsOnly, AdvancedDisplay)
71  float PostProcessBlendWeight;
72 
73  UPROPERTY(EditDefaultsOnly, SimpleDisplay, Category = Config)
74  class UMaterialInterface* PostProcessMaterial;
75 
76  /// If true, this feature extractors have its own exported image type and doesn't use the owner capturer's image type
77  UPROPERTY(EditDefaultsOnly, Category = Config, meta = (PinHiddenByDefault, InlineEditConditionToggle))
78  bool bOverrideExportImageType;
79 
80  UPROPERTY(EditDefaultsOnly, Category = Config, meta = (editcondition = "bOverrideExportImageType"))
81  ENVImageFormat ExportImageFormat;
82 
83  UPROPERTY(EditDefaultsOnly, Category = Config)
84  TEnumAsByte<ENVCapturedPixelFormat> CapturedPixelFormat;
85 
86  UPROPERTY(EditDefaultsOnly, AdvancedDisplay)
87  TEnumAsByte<EPixelFormat> OverrideTexturePixelFormat;
88 
89  UPROPERTY(EditDefaultsOnly, AdvancedDisplay)
90  TEnumAsByte<enum ESceneCaptureSource> CaptureSource;
91 
92  UPROPERTY(EditDefaultsOnly, AdvancedDisplay)
93  bool bUpdateContinuously;
94 
95 protected: // Transient properties
96  UPROPERTY(Transient)
97  TArray<FNVSceneCaptureComponentData> SceneCaptureComp2DDataList;
98 
99  UPROPERTY(Transient)
100  class UMaterialInstanceDynamic* PostProcessMaterialInstance;
101 
102  UPROPERTY(Transient)
103  UNVSceneCaptureComponent2D* SceneCaptureComponent;
104 };
105 
106 /// Base class for all the feature extractors that export the scene's depth buffer
107 UCLASS(Abstract)
109 {
110  GENERATED_BODY()
111 
112 public:
113  UNVSceneFeatureExtractor_SceneDepth(const FObjectInitializer& ObjectInitializer);
114 
115 protected:
116  virtual void UpdateMaterial() override;
117 
118 public: // Editor properties
119  /// The furthest distance to quantize when capturing the scene's depth
120  UPROPERTY(EditAnywhere, SimpleDisplay, Category=Config)
121  float MaxDepthDistance;
122 };
123 
124 UCLASS(Abstract)
125 class NVSCENECAPTURER_API UNVSceneFeatureExtractor_ScenePixelVelocity : public UNVSceneFeatureExtractor_PixelData
126 {
127  GENERATED_BODY()
128 
129 public:
130  UNVSceneFeatureExtractor_ScenePixelVelocity(const FObjectInitializer& ObjectInitializer);
131 
132 protected:
133  virtual void UpdateSettings() override;
134 };
135 
136 /// Base class for all the feature extractors that export the scene's stencil mask buffer
137 UCLASS(Abstract)
139 {
140  GENERATED_BODY()
141 
142 public:
143  UNVSceneFeatureExtractor_StencilMask(const FObjectInitializer& ObjectInitializer);
144 
145 protected:
146  virtual void UpdateSettings() override;
147 };
148 
149 
150 /// Base class for all the feature extractors that export the scene's vertex color buffer
151 UCLASS(Abstract)
153 {
154  GENERATED_BODY()
155 
156 public:
157  UNVSceneFeatureExtractor_VertexColorMask(const FObjectInitializer& ObjectInitializer);
158 
159 protected:
160  virtual void UpdateSettings() override;
161 };
UNVSceneCapturerViewpointComponent: Represents each viewpoint from where the capturer captures data...
Base class for all the feature extractors that export the scene's depth buffer.
Base class for all the feature extractors that export the scene's vertex color buffer.
Base class for all the feature extractors that capture the scene view in pixel data format...
TFunction< void(const FNVTexturePixelData &, UNVSceneFeatureExtractor_PixelData *)> OnFinishedCaptureScenePixelsDataCallback
Callback function get called after the scene capture component finished capturing scene and read back...
The scene exporter actor.
Base class for all the feature extractors that export the scene's stencil mask buffer.