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 transformation between the camera and device.
55 * @param device_T_camera The transformation to be set, must be valid
56 * @see device_T_camera().
57 */
58 void setDevice_T_camera(const HomogenousMatrixD4& device_T_camera);
59
60 /**
61 * Starts the medium.
62 * @see Medium::start().
63 */
64 bool start() override;
65
66 /**
67 * Pauses the medium.
68 * @see Medium::pause().
69 */
70 bool pause() override;
71
72 /**
73 * Stops the medium.
74 * @see Medium::stop().
75 */
76 bool stop() override;
77
78 /**
79 * Returns the start timestamp.
80 * @see Medium::startTimestmap().
81 */
82 Timestamp startTimestamp() const override;
83
84 /**
85 * Returns the pause timestamp.
86 * @see Medium::pauseTimestamp().
87 */
88 Timestamp pauseTimestamp() const override;
89
90 /**
91 * Returns the stop timestamp.
92 * @see Medium::stopTimestamp().
93 */
94 Timestamp stopTimestamp() const override;
95
96 /**
97 * Sets or changes the explicit frame of this pixel image.
98 * Beware: The frame will not be set if the medium is not started, further the frame should have a valid timestamp.<br>
99 * @param frame The frame to be set, the frame will be moved
100 * @param anyCamera The camera profile of the given frame, if known
101 * @return True, if succeeded
102 */
103 virtual bool setPixelImage(Frame&& frame, SharedAnyCamera anyCamera = nullptr);
104
105 /**
106 * Sets or changes the explicit frame of this pixel image.
107 * Beware: The frame will not be set if the medium is not started, further the frame should have a valid timestamp.<br>
108 * @param frame The frame to be set, the frame data will be copied
109 * @param anyCamera The camera profile of the given frame, if known
110 * @return True, if succeeded
111 */
112 virtual bool setPixelImage(const Frame& frame, SharedAnyCamera anyCamera = nullptr);
113
114 protected:
115
116 /**
117 * Creates a new pixel image by an arbitrary url defining the name of the resulting object.
118 * @param url Arbitrary name to identify this pixel image later, if necessary
119 */
120 explicit PixelImage(const std::string& url);
121
122 protected:
123
124 /// Start timestamp.
126
127 /// Pause timestamp.
129
130 /// Stop timestamp.
132
133 /// Determining whether this image is 'started' and holds valid image data.
135
136 /// The transformation between camera and device.
138};
139
140}
141
142}
143
144#endif // META_OCEAN_MEDIA_PIXEL_IMAGE_H
This class implements Ocean's image class.
Definition Frame.h:1808
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:125
bool isStarted_
Determining whether this image is 'started' and holds valid image data.
Definition PixelImage.h:134
HomogenousMatrixD4 device_T_camera_
The transformation between camera and device.
Definition PixelImage.h:137
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:131
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:128
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:36
std::shared_ptr< AnyCamera > SharedAnyCamera
Definition of a shared pointer holding an AnyCamera object with Scalar precision.
Definition AnyCamera.h:60
SmartMediumRef< PixelImage > PixelImageRef
Definition of a smart medium reference holding a pixel image object.
Definition PixelImage.h:28
The namespace covering the entire Ocean framework.
Definition Accessor.h:15