NVIDIA DeepLearning Dataset Synthesizer (NDDS)
 All Classes Namespaces Functions Variables Typedefs Pages
NVCameraSettings.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 "NVCameraSettings.generated.h"
14 
15 USTRUCT(Blueprintable)
17 {
18  GENERATED_BODY()
19 
20 public:
21  /// The image's width (in pixels).
22  UPROPERTY(EditAnywhere, meta = (UIMin = "1", ClampMin = "1"))
23  int32 Width;
24 
25  /// The image's height (in pixels).
26  UPROPERTY(EditAnywhere, meta = (UIMin = "1", ClampMin = "1"))
27  int32 Height;
28 
29 public:
30  FNVImageSize(int32 InWidth = 0, int32 InHeight = 0);
31  FIntPoint ConvertToIntPoint() const;
32  float GetAspectRatio() const;
33 };
34 
35 USTRUCT()
36 struct NVSCENECAPTURER_API FNVNamedImageSizePreset
37 {
38  GENERATED_BODY()
39 
40 public:
41  UPROPERTY(VisibleAnywhere)
42  FString Name;
43 
44  UPROPERTY(VisibleAnywhere)
45  FNVImageSize ImageSize;
46 };
47 
48 USTRUCT(BlueprintType)
49 struct NVSCENECAPTURER_API FCameraIntrinsicSettings
50 {
51  GENERATED_BODY()
52 
53 public:
54  /// Create the camera intrinsic settings from the horizontal field of view
55  FCameraIntrinsicSettings(int ResWidth = 640, int ResHeight = 480, float HFOV = 90.f);
56  FCameraIntrinsicSettings(int ResWidth, int ResHeight, float Fx, float Fy, float Cx, float Cy, float S = 0.f);
57 
58  FMatrix GetIntrinsicMatrix() const;
59  FMatrix GetProjectionMatrix() const;
60 
61  void UpdateSettings();
62 
63 public: // Editor properties
64  /// Resolution's width
65  UPROPERTY(EditAnywhere, meta = (DisplayName = "Resolution - X"))
66  int32 ResX;
67  /// Resolution's height
68  UPROPERTY(EditAnywhere, meta = (DisplayName = "Resolution - Y"))
69  int32 ResY;
70 
71  /// Focal length along X axis
72  UPROPERTY(EditAnywhere, meta = (DisplayName = "Focal length - X"))
73  float Fx;
74  /// Focal length along Y axis
75  UPROPERTY(EditAnywhere, meta = (DisplayName = "Focal length - Y"))
76  float Fy;
77 
78  /// Principal point offset
79  UPROPERTY(EditAnywhere, meta = (DisplayName = "Principal point - X"))
80  float Cx;
81  UPROPERTY(EditAnywhere, meta = (DisplayName = "Principal point - Y"))
82  float Cy;
83 
84  /// Skew coefficient
85  UPROPERTY(EditAnywhere, meta = (DisplayName = "Skew coefficient"))
86  float S;
87 
88  UPROPERTY(VisibleAnywhere, AdvancedDisplay, Category = "Matrix", meta = (DisplayName = "Intrinsic matrix"))
89  FMatrix IntrinsicMatrix;
90 
91  UPROPERTY(VisibleAnywhere, AdvancedDisplay, Category = "Matrix", meta = (DisplayName = "Projection matrix"))
92  FMatrix ProjectionMatrix;
93 };
94 
95 //============================= Camera settings factories =============================
96 /// Base class for all the different ways to create a camera settings
97 UCLASS(Blueprintable, DefaultToInstanced, editinlinenew, Abstract, ClassGroup = (NVIDIA))
98 class NVSCENECAPTURER_API UCameraSettingsFactoryBase : public UObject
99 {
100  GENERATED_BODY()
101 public:
102  FCameraIntrinsicSettings GetCameraSettings() const
103  {
104  return CameraSettings;
105  }
106 
107 protected:
108 #if WITH_EDITORONLY_DATA
109  virtual void PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent) override;
110 #endif //WITH_EDITORONLY_DATA
111 
112  virtual void UpdateCameraSettings();
113 
114 protected: // Editor properties
115  UPROPERTY(EditAnywhere, Category = Settings)
116  FNVImageSize Resolution;
117 
118 protected:
119  /// The camera settings which this factory present
120  UPROPERTY(VisibleAnywhere, AdvancedDisplay, Category = "Settings")
121  FCameraIntrinsicSettings CameraSettings;
122 };
123 
124 /// Create camera settings using horizontal field of view
125 UCLASS(Blueprintable, ClassGroup = (NVIDIA))
126 class NVSCENECAPTURER_API UCameraSettingFactory_HFOV : public UCameraSettingsFactoryBase
127 {
128  GENERATED_BODY()
129 
130 public:
132 
133 protected:
134  virtual void UpdateCameraSettings() override;
135 
136 protected: // Editor properties
137  UPROPERTY(EditAnywhere, Category = Settings, meta=(DisplayName="Horizontal Field-Of-View"))
138  float HFOV;
139 };
Create camera settings using horizontal field of view.
Base class for all the different ways to create a camera settings.