Ocean
Loading...
Searching...
No Matches
PixelImage.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_MEDIA_PIXEL_IMAGE_H
9#define META_OCEAN_MEDIA_PIXEL_IMAGE_H
10
11#include "ocean/media/Media.h"
13
14namespace Ocean
15{
16
17namespace Media
18{
19
20// Forward declaration.
21class PixelImage;
22
23/**
24 * Definition of a smart medium reference holding a pixel image object.
25 * @see SmartMediumRef, PixelImage.
26 * @ingroup media
27 */
29
30/**
31 * This class implements a frame medium object which uses an explicit frame only.
32 * A pixel image can be used to define an explicit frame without any e.g. image or movie stream.
33 * @ingroup media
34 */
35class OCEAN_MEDIA_EXPORT PixelImage : virtual public FrameMedium
36{
37 friend class Manager;
38
39 public:
40
41 /**
42 * Returns whether the medium is started currently.
43 * @see Medium:isStarted().
44 */
45 bool isStarted() const override;
46
47 /**
48 * Returns the transformation between the camera and device.
49 * @see PixelImage::device_T_camera(), setDevice_T_camera().
50 */
52
53 /**
54 * Sets the known camera profile of this frame medium.
55 * The camera profile will be the default camera profile, a per-frame camera profile can be specified in setPixelImage().
56 * @see FrameMedium::setCamera().
57 */
58 bool setCamera(SharedAnyCamera&& camera) override;
59
60 /**
61 * Sets the transformation between the camera and device.
62 * @param device_T_camera The transformation to be set, must be valid
63 * @see device_T_camera().
64 */
65 void setDevice_T_camera(const HomogenousMatrixD4& device_T_camera);
66
67 /**
68 * Starts the medium.
69 * @see Medium::start().
70 */
71 bool start() override;
72
73 /**
74 * Pauses the medium.
75 * @see Medium::pause().
76 */
77 bool pause() override;
78
79 /**
80 * Stops the medium.
81 * @see Medium::stop().
82 */
83 bool stop() override;
84
85 /**
86 * Returns the start timestamp.
87 * @see Medium::startTimestmap().
88 */
89 Timestamp startTimestamp() const override;
90
91 /**
92 * Returns the pause timestamp.
93 * @see Medium::pauseTimestamp().
94 */
95 Timestamp pauseTimestamp() const override;
96
97 /**
98 * Returns the stop timestamp.
99 * @see Medium::stopTimestamp().
100 */
101 Timestamp stopTimestamp() const override;
102
103 /**
104 * Sets or changes the explicit frame of this pixel image.
105 * Beware: The frame will not be set if the medium is not started, further the frame should have a valid timestamp.<br>
106 * @param frame The frame to be set, the frame will be moved
107 * @param anyCamera The camera profile of the given frame, will not be used for other frames, if known
108 * @return True, if succeeded
109 */
110 virtual bool setPixelImage(Frame&& frame, SharedAnyCamera anyCamera = nullptr);
111
112 /**
113 * Sets or changes the explicit frame of this pixel image.
114 * Beware: The frame will not be set if the medium is not started, further the frame should have a valid timestamp.<br>
115 * @param frame The frame to be set, the frame data will be copied
116 * @param anyCamera The camera profile of the given frame, will not be used for other frames, if known
117 * @return True, if succeeded
118 */
119 virtual bool setPixelImage(const Frame& frame, SharedAnyCamera anyCamera = nullptr);
120
121 protected:
122
123 /**
124 * Creates a new pixel image by an arbitrary url defining the name of the resulting object.
125 * @param url Arbitrary name to identify this pixel image later, if necessary
126 */
127 explicit PixelImage(const std::string& url);
128
129 protected:
130
131 /// Start timestamp.
133
134 /// Pause timestamp.
136
137 /// Stop timestamp.
139
140 /// Determining whether this image is 'started' and holds valid image data.
142
143 /// The camera profile for all images for which no per-frame camera profile is provided via setPixelImage(), nullptr if unknown.
145
146 /// The transformation between camera and device.
148};
149
150}
151
152}
153
154#endif // META_OCEAN_MEDIA_PIXEL_IMAGE_H
This class implements Ocean's image class.
Definition Frame.h:1879
This is the base class for all frame mediums.
Definition FrameMedium.h:53
This class is the manager for all media objects.
Definition media/Manager.h:34
This class implements a frame medium object which uses an explicit frame only.
Definition PixelImage.h:36
bool isStarted() const override
Returns whether the medium is started currently.
void setDevice_T_camera(const HomogenousMatrixD4 &device_T_camera)
Sets the transformation between the camera and device.
HomogenousMatrixD4 device_T_camera() const override
Returns the transformation between the camera and device.
bool start() override
Starts the medium.
virtual bool setPixelImage(Frame &&frame, SharedAnyCamera anyCamera=nullptr)
Sets or changes the explicit frame of this pixel image.
bool pause() override
Pauses the medium.
Timestamp startTimestamp_
Start timestamp.
Definition PixelImage.h:132
bool isStarted_
Determining whether this image is 'started' and holds valid image data.
Definition PixelImage.h:141
HomogenousMatrixD4 device_T_camera_
The transformation between camera and device.
Definition PixelImage.h:147
SharedAnyCamera camera_
The camera profile for all images for which no per-frame camera profile is provided via setPixelImage...
Definition PixelImage.h:144
bool setCamera(SharedAnyCamera &&camera) override
Sets the known camera profile of this frame medium.
PixelImage(const std::string &url)
Creates a new pixel image by an arbitrary url defining the name of the resulting object.
Timestamp stopTimestamp_
Stop timestamp.
Definition PixelImage.h:138
Timestamp stopTimestamp() const override
Returns the stop timestamp.
Timestamp pauseTimestamp() const override
Returns the pause timestamp.
virtual bool setPixelImage(const Frame &frame, SharedAnyCamera anyCamera=nullptr)
Sets or changes the explicit frame of this pixel image.
Timestamp pauseTimestamp_
Pause timestamp.
Definition PixelImage.h:135
bool stop() override
Stops the medium.
Timestamp startTimestamp() const override
Returns the start timestamp.
This class implements a smart medium reference.
Definition MediumRef.h:33
This class implements a timestamp.
Definition Timestamp.h:63
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:61
The namespace covering the entire Ocean framework.
Definition Accessor.h:15