Logo
ApraPipes 1.0
Loading...
Searching...
No Matches
ImageResizeCV.h
1#pragma once
2#include "FrameMetadata.h"
3#include "Module.h"
4#include "declarative/PropertyMacros.h"
5
7{
8public:
9 ImageResizeCVProps(int _width, int _height)
10 {
11 width = _width;
12 height = _height;
13 }
14
16
17 int width;
18 int height;
19
20 // ============================================================
21 // Property Binding for Declarative Pipeline
22 // ============================================================
23 template<typename PropsT>
24 static void applyProperties(
25 PropsT& props,
26 const std::map<std::string, apra::ScalarPropertyValue>& values,
27 std::vector<std::string>& missingRequired
28 ) {
29 apra::applyProp(props.width, "width", values, true, missingRequired);
30 apra::applyProp(props.height, "height", values, true, missingRequired);
31 }
32
33 apra::ScalarPropertyValue getProperty(const std::string& propName) const {
34 if (propName == "width") return static_cast<int64_t>(width);
35 if (propName == "height") return static_cast<int64_t>(height);
36 throw std::runtime_error("Unknown property: " + propName);
37 }
38
39 bool setProperty(const std::string& propName, const apra::ScalarPropertyValue& value) {
40 throw std::runtime_error("Cannot modify static property '" + propName + "' after initialization");
41 }
42
43 static std::vector<std::string> dynamicPropertyNames() {
44 return {};
45 }
46};
47
48class ImageResizeCV : public Module
49{
50
51public:
53 virtual ~ImageResizeCV();
54 bool init();
55 bool term();
56protected:
57 bool process(frame_container& frames);
58 bool processSOS(frame_sp& frame);
59 bool validateInputPins();
60 bool validateOutputPins();
61 void addInputPin(framemetadata_sp& metadata, string& pinId);
62 std::string addOutputPin(framemetadata_sp& metadata);
63
64private:
65 void setMetadata(framemetadata_sp& metadata);
68 class Detail;
69 boost::shared_ptr<Detail> mDetail;
71};
Definition ImageResizeCV.h:7
int width
Definition ImageResizeCV.h:17
ImageResizeCVProps(int _width, int _height)
Definition ImageResizeCV.h:9
int height
Definition ImageResizeCV.h:18
ImageResizeCVProps()
Definition ImageResizeCV.h:15
static void applyProperties(PropsT &props, const std::map< std::string, apra::ScalarPropertyValue > &values, std::vector< std::string > &missingRequired)
Definition ImageResizeCV.h:24
bool setProperty(const std::string &propName, const apra::ScalarPropertyValue &value)
Definition ImageResizeCV.h:39
static std::vector< std::string > dynamicPropertyNames()
Definition ImageResizeCV.h:43
apra::ScalarPropertyValue getProperty(const std::string &propName) const
Definition ImageResizeCV.h:33
Definition ImageResizeCV.cpp:13
Definition ImageResizeCV.h:49
void setMetadata(framemetadata_sp &metadata)
ImageResizeCVProps mProps
Definition ImageResizeCV.h:67
virtual ~ImageResizeCV()
Definition ImageResizeCV.cpp:44
bool validateOutputPins()
Definition ImageResizeCV.cpp:77
int mFrameType
Definition ImageResizeCV.h:66
size_t mMaxStreamLength
Definition ImageResizeCV.h:70
ImageResizeCV(ImageResizeCVProps _props)
Definition ImageResizeCV.cpp:39
boost::shared_ptr< Detail > mDetail
Definition ImageResizeCV.h:69
std::string addOutputPin(framemetadata_sp &metadata)
Definition ImageResizeCV.cpp:106
bool validateInputPins()
Definition ImageResizeCV.cpp:46
bool process(frame_container &frames)
Definition ImageResizeCV.cpp:121
void addInputPin(framemetadata_sp &metadata, string &pinId)
Definition ImageResizeCV.cpp:96
bool term()
Definition ImageResizeCV.cpp:116
bool init()
Definition ImageResizeCV.cpp:111
bool processSOS(frame_sp &frame)
Definition ImageResizeCV.cpp:140
Definition Module.h:33
Definition Module.h:151
void applyProp(T &member, const char *propName, const std::map< std::string, ScalarPropertyValue > &values, bool isRequired, std::vector< std::string > &missingRequired)
Definition PropertyMacros.h:36
std::variant< int64_t, double, bool, std::string > ScalarPropertyValue
Definition ModuleRegistry.h:30