PFrame.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2018 Digital Barriers plc. All rights reserved.
3  * Contact: http://www.digitalbarriers.com/
4  *
5  * This file is part of the Papillon SDK.
6  *
7  * You can't use, modify or distribute any part of this file without
8  * the explicit written agreements of Digital Barriers.
9  */
10 
15 #pragma once
16 #include <PObject.h>
17 #include <PGuid.h>
18 #include <PImage.h>
19 
20 PAPILLON_BEGIN_NAMESPACE
21 
24 
25 class PDateTime;
26 class PPlugin;
27 class PProperties;
28 class PSizei;
29 
50 class PAPILLON_API_CORE PFrame : public PObject
51 {
52 public:
56  PFrame();
57 
61  PFrame(const PImage& image, const PGuid& frameId = PGuid::Null(), const PGuid& sourceId = PGuid::Null());
62 
68  PFrame(const PFrame& other);
69 
73  virtual ~PFrame();
74 
80  PFrame& operator=(const PFrame& other);
81 
85  const PGuid& GetFrameId() const;
86 
90  const PGuid& GetSourceId() const;
91 
95 // const PPlugin& GetPlugin() const;
96 
100  void SetFrameId(const PGuid& guid);
101 
105  void SetSourceId(const PGuid& guid);
106 
110 // void SetPlugin(const PPlugin& plugin);
111 
115  PSizei GetSize() const;
116 
120  papillon::int32 GetWidth() const;
121 
125  papillon::int32 GetHeight() const;
126 
130  PRectanglei GetRectangle() const;
131 
136  void SetNewImage(const PImage& image, const PGuid& frameId = PGuid::Null(), const PGuid& sourceId = PGuid::Null());
137 
143  void SetImage(const PImage& image);
144 
148  void SetFrameNumber(papillon::int32 frameNumber);
149 
153  void SetSourceFrameNumber(papillon::int32 frameNumber);
154 
159  void SetTimestampUTC(const PDateTime& timestamp);
160 
165  void SetTimestampToCurrentUTC();
166 
178  void Resize(const PSizei& newSize, PImage::EAspectRatioMode aspectRatioMode = PImage::E_IGNORE_ASPECT_RATIO, PImage::EInterpolation interpolation = PImage::E_INTERPOLATION_LINEAR);
179 
189  void Resize(float scaleFactor, PImage::EInterpolation interpolation = PImage::E_INTERPOLATION_LINEAR);
190 
195  void ConvertTo(PImage::EPixelFormat format);
196 
201  PResult Crop(const PRectanglei& r);
202 
211  PImage GetImageShared() const;
212 
221  const PImage& GetImage() const;
222 
232  PImage GetImageShared(PImage::EPixelFormat pixelFormat) const;
233 
240  papillon::int32 GetFrameNumber() const;
241 
248  papillon::int32 GetSourceFrameNumber() const;
249 
253  PDateTime GetTimestampUTC() const;
254 
263  PProperties GetPropertiesShared() const;
264 
268  const PProperties& GetProperties() const;
269 
273  void SetProperties(const PProperties& properties);
274 
279  void InvalidateCache();
280 
284  void Reset();
285 
293  PResult Display(const PString& title, papillon::int32 waitTimeMs = 0) const;
294 
304  PResult DisplayScaled(const PString& title, papillon::int32 width, papillon::int32 height, papillon::int32 waitTimeMs = 0) const;
305 
313  PResult DisplayScaled(const PString& title, papillon::int32 waitTimeMs = 0) const;
314 };
315 
317 
318 PAPILLON_END_NAMESPACE
319 
The PString class provides an Unicode character strings.
Definition: PString.h:37
EInterpolation
All the available interpolation mode for resize.
Definition: PImage.h:79
The PFrame class represents any 2D-image (RGB, gray-scale, ...) with a container of additional data p...
Definition: PFrame.h:50
EAspectRatioMode
All the available aspect ratio mode for resize.
Definition: PImage.h:92
The PSizei class represents the size of an image or a rectangle: width (int) and height (int); PSizei...
Definition: PSizei.h:27
Class PGuid: an immutable Globally Unique Identifier (GUID).
The PDateTime class provides date and time functions, including time-zone management and UTC conversi...
Definition: PDateTime.h:38
The PImage class represents a 2D-image; several pixel format and number of channels are supported (BG...
Definition: PImage.h:57
The PResult class represents the result returned by most of Papillon functions; this class is used to...
Definition: PResult.h:159
Bilinear interpolation.
Definition: PImage.h:82
The PProperties class represents a container of properties; each property has a name (PString) and a ...
Definition: PProperties.h:38
The PObject class is the root class of all Papillon classes; all PObject behaves like shared referenc...
Definition: PObject.h:27
The PPlugin class represents a Papillon plugin (input video source, detector, describer, ...); thread-safe.
Definition: PPlugin.h:45
Class PImage: a 2D-image, mainly a buffer of pixels (available pixel formats are grey, BGR, RGB, RGBA, YUV, etc.)
The PRectanglei class represents an axis-aligned rectangle with 32-bit int coordinates; PRectanglei i...
Definition: PRectanglei.h:33
The size is scaled freely; the aspect ratio is not preserve.
Definition: PImage.h:94
static const PGuid & Null()
Returns the constant holding the null GUID (i.e.
Definition: PGuid.h:44
The PGuid class represents a Globally Unique Identifier (GUID); PGuid instances are immutable (thread...
Definition: PGuid.h:28
Class PObject: the root class of all Papillon classes.
PObject & operator=(const PObject &obj)
Performs a shared copy of other to this object.
Definition: PObject.h:45
EPixelFormat
All the available pixel formats.
Definition: PImage.h:63