Agrarsense
SemanticSegmentationCamera.cpp
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
7
8ASemanticSegmentationCamera::ASemanticSegmentationCamera(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
9{
10 PrimaryActorTick.bCanEverTick = false;
11}
12
13void ASemanticSegmentationCamera::Init(FCameraBaseParameters parameters, bool SimulateSensor)
14{
15 // Defined in Camera.h
16 CameraName = "SemanticSegmentationCamera ";
17 FilePrefix = "Data/SemanticSegmentationCamera_";
18
19 AddPostProcessingMaterial("/Game/Agrarsense/Materials/PostProcessingMaterials/GTMaterial.GTMaterial");
20 Super::Init(parameters, SimulateSensor);
21
22 // This camera doesn't need to render shadows
23 SetShadowRendering(false);
24
25 // Or many other advanced show flags.
27}
28
30{
31 // Old way
32 //FColor* BufferPtr = buffer.GetData();
33
34 //for (int32 i = 0; i < buffer.Num(); ++i)
35 //{
36 // // Convert the current FColor (sRGB 0-255) to FLinearColor (linear 0.0-1.0)
37 // FLinearColor pixel = FLinearColor::FromSRGBColor(BufferPtr[i]);
38
39 // // Process the pixel and convert it back to FColor (sRGB 0-255)
40 // // This step applies gamma correction and ensures values are properly adjusted
41 // BufferPtr[i] = FColor(
42 // FMath::RoundToInt(pixel.R * 255.0f),
43 // FMath::RoundToInt(pixel.G * 255.0f),
44 // FMath::RoundToInt(pixel.B * 255.0f));
45 //}
46
48}
void AddPostProcessingMaterial(const FString &Path, float Weight=1.0f)
Definition: Camera.cpp:60
void ApplyGammaCorrectionLUT(TArray< FColor > &Buffer)
Definition: Camera.cpp:600
FString FilePrefix
Definition: Camera.h:281
void SetShadowRendering(bool RenderShadows)
Definition: Camera.cpp:849
FString CameraName
Definition: Camera.h:279
void DisableShowFlags()
Definition: Camera.cpp:889
void Init(FCameraBaseParameters parameters, bool SimulateSensor=true) override
ASemanticSegmentationCamera(const FObjectInitializer &ObjectInitializer)
virtual void AddProcessingToFrameBuffer(TArray< FColor > &buffer) final override