Agrarsense
PhotoCapture.h
Go to the documentation of this file.
1// Copyright (c) 2024 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
6#pragma once
7
8#include "CoreMinimal.h"
9#include "GameFramework/Actor.h"
10
11#include "PhotoCapture.generated.h"
12
13class ACamera;
14
15USTRUCT(Blueprintable)
16struct AGRARSENSE_API FCaptureData
17{
18 GENERATED_BODY()
19
20 UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
21 TArray<ACamera*> Cameras;
22
23 UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
24 TArray<FTransform> CapturePositions;
25
26 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
27 int32 CurrentCaptureIndex = 0;
28
29 UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
30 int32 FramesToKeepInSamePosition = 4;
31};
32
33/*
34* This Actor automates the process of gathering synthetic camera data by capturing images
35* at predefined positions.
36* Usage:
37* 1) Spawn any Camera (RGB, Depth, Semantic, Thermal or DVS)
38* 2) Spawn this Actor and call SetupPhotoCapture with FCaptureData struct
39*/
40UCLASS()
41class AGRARSENSE_API APhotoCapture : public AActor
42{
43 GENERATED_BODY()
44
45public:
46
47 APhotoCapture(const FObjectInitializer& ObjectInitializer);
48
49 UFUNCTION(BlueprintCallable)
50 void SetupPhotoCapture(FCaptureData NewCaptureData);
51
52protected:
53
54 virtual void BeginPlay() override;
55
56 virtual void Tick(float DeltaTime) override;
57
58 virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
59
60private:
61
62 /*
63 * Capture one Image each frame and move to next position next frame.
64 */
65 void Capture();
66
67 void UpdateCameraPositions(const FTransform& Transform);
68
69 void CaptureImages();
70
71 void DestroyCameras();
72
74
75 int32 FrameCounter = 0;
76};
Definition: Camera.h:52
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
Definition: Camera.cpp:410
virtual void BeginPlay() override
Definition: Camera.cpp:375
FCaptureData CaptureData
Definition: PhotoCapture.h:73