diff --git a/SDK/C++/CMakeLists.txt b/SDK/C++/CMakeLists.txt index 079129547f6aade847efb5f26f537008b9c46e93..b64eae3d9a119df248378b8b1e41f2b271187ba1 100644 --- a/SDK/C++/CMakeLists.txt +++ b/SDK/C++/CMakeLists.txt @@ -8,6 +8,7 @@ add_library(voltu SHARED private/pointcloud_impl.cpp private/pipeline_impl.cpp private/operator_impl.cpp + private/property_impl.cpp ) target_include_directories(voltu diff --git a/SDK/C++/private/operator_impl.cpp b/SDK/C++/private/operator_impl.cpp index 1acade35ea111ed332f1b61aba32a2ecfcc36774..a3e65a759388f01523a1d33c179bcd12bdbff802 100644 --- a/SDK/C++/private/operator_impl.cpp +++ b/SDK/C++/private/operator_impl.cpp @@ -1,4 +1,5 @@ #include "operator_impl.hpp" +#include "property_impl.hpp" #include <voltu/types/errors.hpp> using voltu::internal::OperatorImpl; @@ -16,5 +17,5 @@ OperatorImpl::~OperatorImpl() voltu::PropertyPtr OperatorImpl::property(const std::string &name) { - throw voltu::exceptions::NotImplemented(); + return std::make_shared<voltu::internal::CfgPropertyImpl>(cfg_, name); } diff --git a/SDK/C++/private/property_impl.cpp b/SDK/C++/private/property_impl.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bb3cd8dcd0364d458b7c6dd23be94719c7031f02 --- /dev/null +++ b/SDK/C++/private/property_impl.cpp @@ -0,0 +1,135 @@ +#include "property_impl.hpp" +#include <voltu/types/errors.hpp> + +using voltu::internal::CfgPropertyImpl; +//using voltu::internal::FloatCfgProperty; + +CfgPropertyImpl::CfgPropertyImpl(ftl::Configurable *cfg, const std::string &name) + : cfg_(cfg), name_(name) +{ + +} + +CfgPropertyImpl::~CfgPropertyImpl() +{ + +} + +void CfgPropertyImpl::setInt(int value) +{ + if (cfg_->is<int>(name_)) + { + cfg_->set(name_, value); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +void CfgPropertyImpl::setFloat(float value) +{ + if (cfg_->is<float>(name_)) + { + cfg_->set(name_, value); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +void CfgPropertyImpl::setString(const std::string &value) +{ + if (cfg_->is<std::string>(name_)) + { + cfg_->set(name_, value); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +void CfgPropertyImpl::setBool(bool value) +{ + if (cfg_->is<bool>(name_)) + { + cfg_->set(name_, value); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +int CfgPropertyImpl::getInt() +{ + if (cfg_->is<int>(name_)) + { + return *cfg_->get<int>(name_); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +float CfgPropertyImpl::getFloat() +{ + if (cfg_->is<float>(name_)) + { + return *cfg_->get<float>(name_); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +std::string CfgPropertyImpl::getString() +{ + if (cfg_->is<std::string>(name_)) + { + return *cfg_->get<std::string>(name_); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +bool CfgPropertyImpl::getBool() +{ + if (cfg_->is<bool>(name_)) + { + return *cfg_->get<bool>(name_); + } + else + { + throw voltu::exceptions::BadPropertyType(); + } +} + +// ==== Float ==== + +/*FloatCfgProperty::FloatCfgProperty(ftl::Configurable *cfg, const std::string &name) + : CfgPropertyImpl(cfg, name) +{ + +} + +FloatCfgProperty::~FloatCfgProperty() +{ + +} + +void FloatCfgProperty::setFloat(float) +{ + +} + +float FloatCfgProperty::getFloat() +{ + +}*/ diff --git a/SDK/C++/private/property_impl.hpp b/SDK/C++/private/property_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2adf96de3f172d07357a13cfd568ea7304dbd00d --- /dev/null +++ b/SDK/C++/private/property_impl.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include <ftl/configurable.hpp> +#include <voltu/types/property.hpp> +#include <string> + +namespace voltu +{ +namespace internal +{ + +class CfgPropertyImpl : public voltu::Property +{ +public: + CfgPropertyImpl(ftl::Configurable *cfg, const std::string &name); + virtual ~CfgPropertyImpl() override; + + virtual void setInt(int) override; + + virtual void setFloat(float) override; + + virtual void setString(const std::string &) override; + + virtual void setBool(bool) override; + + virtual int getInt() override; + + virtual float getFloat() override; + + virtual std::string getString() override; + + virtual bool getBool() override; + +private: + ftl::Configurable *cfg_; + std::string name_; +}; + +/*class FloatCfgProperty : public CfgPropertyImpl +{ +public: + FloatCfgProperty(ftl::Configurable *cfg, const std::string &name); + ~FloatCfgProperty() override; + + void setFloat(float) override; + + float getFloat() override; +};*/ + +} +} diff --git a/SDK/C++/public/include/voltu/types/errors.hpp b/SDK/C++/public/include/voltu/types/errors.hpp index b3d71c4c85cb56ccb9a64da46ca2776559d34e70..bbb8be620813c4d4fc94e5a7d868c05f3cff30aa 100644 --- a/SDK/C++/public/include/voltu/types/errors.hpp +++ b/SDK/C++/public/include/voltu/types/errors.hpp @@ -32,6 +32,9 @@ VOLTU_EXCEPTION(InvalidFrameObject, Exception, "Invalid Frame object"); VOLTU_EXCEPTION(InternalRenderError, Exception, "Internal renderer error"); VOLTU_EXCEPTION(InvalidProperty, Exception, "Unknown property enum"); VOLTU_EXCEPTION(PropertyUnavailable, Exception, "Property currently not available"); +VOLTU_EXCEPTION(BadPropertyName, Exception, "Not a valid property name"); +VOLTU_EXCEPTION(BadPropertyType, Exception, "Incorrect property data type"); +VOLTU_EXCEPTION(BadPropertyValue, Exception, "Property value out of allowed range"); VOLTU_EXCEPTION(BadParameterValue, Exception, "Method parameter is not valid"); VOLTU_EXCEPTION(NotImplemented, Exception, "Functionality not implemented"); VOLTU_EXCEPTION(ReadOnly, Exception, "Read only, write not allowed"); diff --git a/SDK/C++/public/samples/fusion_evaluator/main.cpp b/SDK/C++/public/samples/fusion_evaluator/main.cpp index d388851e9421b531ed7721efa8128d6b4620d76a..908d0925ed80bf5d4d125d6f184e6dc0d7a9f906 100644 --- a/SDK/C++/public/samples/fusion_evaluator/main.cpp +++ b/SDK/C++/public/samples/fusion_evaluator/main.cpp @@ -39,10 +39,13 @@ int main(int argc, char **argv) auto pipe = vtu->createPipeline(); auto op1 = pipe->appendOperator(voltu::OperatorId::kFusion); auto op2 = pipe->appendOperator(voltu::OperatorId::kGTEvaluator); + + op2->property("show_colour")->setBool(true); + pipe->submit(frame); pipe->waitCompletion(1000); - auto imgset = frame->getImageSet(voltu::Channel::kNormals); + auto imgset = frame->getImageSet(voltu::Channel::kColour); for (auto img : imgset) { diff --git a/SDK/C++/public/voltu_cv.cpp b/SDK/C++/public/voltu_cv.cpp index d74ad9313c8f6795a2a04113146f47d12c55c49e..0fae307111f1311bb73c675560bea18ecd00f539 100644 --- a/SDK/C++/public/voltu_cv.cpp +++ b/SDK/C++/public/voltu_cv.cpp @@ -1,4 +1,5 @@ #include <voltu/opencv.hpp> +#include <voltu/types/errors.hpp> #include <opencv2/imgproc.hpp> @@ -26,7 +27,7 @@ void voltu::cv::convert(voltu::ImagePtr img, ::cv::Mat &mat) void voltu::cv::convert(voltu::ImagePtr img, ::cv::cuda::GpuMat &mat) { - + throw voltu::exceptions::NotImplemented(); } void voltu::cv::visualise(voltu::ImagePtr img, ::cv::Mat &mat) diff --git a/components/common/cpp/include/ftl/configurable.hpp b/components/common/cpp/include/ftl/configurable.hpp index b2a66943d35e7cba6a86d6842e037d0068d15feb..dadba17b4c19b7d1e2ce8de103b4e8f6cb22ad9f 100644 --- a/components/common/cpp/include/ftl/configurable.hpp +++ b/components/common/cpp/include/ftl/configurable.hpp @@ -67,6 +67,9 @@ class Configurable { std::string getID() { return *get<std::string>("$id"); } + template <typename T> + inline bool is(const std::string &name) { return false; } + /** * Get a configuration property, but return a default if not found. */ @@ -191,6 +194,20 @@ extern template void ftl::Configurable::set<std::string>(const std::string &name extern template void ftl::Configurable::set<std::vector<std::string>>(const std::string &name, std::vector<std::string> value); extern template void ftl::Configurable::set<nlohmann::json>(const std::string &name, nlohmann::json value); +template <> bool ftl::Configurable::is<float>(const std::string &name); +template <> bool ftl::Configurable::is<int>(const std::string &name); +template <> bool ftl::Configurable::is<unsigned int>(const std::string &name); +template <> bool ftl::Configurable::is<std::string>(const std::string &name); +template <> bool ftl::Configurable::is<bool>(const std::string &name); +template <> bool ftl::Configurable::is<double>(const std::string &name); + +extern template bool ftl::Configurable::is<float>(const std::string &name); +extern template bool ftl::Configurable::is<int>(const std::string &name); +extern template bool ftl::Configurable::is<unsigned int>(const std::string &name); +extern template bool ftl::Configurable::is<std::string>(const std::string &name); +extern template bool ftl::Configurable::is<bool>(const std::string &name); +extern template bool ftl::Configurable::is<double>(const std::string &name); + template <typename T, typename... ARGS> T *ftl::Configurable::create(const std::string &name, ARGS ...args) { return ftl::config::create<T>(this, name, args...); diff --git a/components/common/cpp/src/configurable.cpp b/components/common/cpp/src/configurable.cpp index 1f377fc5185cdc533d8c5823514a3fb4bfda3e24..4f6bff5bac5cf66ca46af9c36c17aaaf43c074dc 100644 --- a/components/common/cpp/src/configurable.cpp +++ b/components/common/cpp/src/configurable.cpp @@ -121,6 +121,36 @@ template void ftl::Configurable::set<std::string>(const std::string &name, std:: template void ftl::Configurable::set<std::vector<std::string>>(const std::string &name, std::vector<std::string> value); template void ftl::Configurable::set<nlohmann::json>(const std::string &name, nlohmann::json value); +template <> +bool ftl::Configurable::is<float>(const std::string &name) { + return getConfig()[name].is_number_float(); +} + +template <> +bool ftl::Configurable::is<int>(const std::string &name) { + return getConfig()[name].is_number_integer(); +} + +template <> +bool ftl::Configurable::is<unsigned int>(const std::string &name) { + return getConfig()[name].is_number_unsigned(); +} + +template <> +bool ftl::Configurable::is<std::string>(const std::string &name) { + return getConfig()[name].is_string(); +} + +template <> +bool ftl::Configurable::is<bool>(const std::string &name) { + return getConfig()[name].is_boolean(); +} + +template <> +bool ftl::Configurable::is<double>(const std::string &name) { + return getConfig()[name].is_number_float(); +} + void Configurable::required(const char *f, const std::vector<std::tuple<std::string, std::string, std::string>> &r) { bool diderror = false; for (auto i : r) { diff --git a/components/operators/include/ftl/operators/antialiasing.hpp b/components/operators/include/ftl/operators/antialiasing.hpp index 5548c08578e96879f36f2c3a11b281b78ca4bf43..9c249f3d82a89aae0c4cdadba74e0079d69121d9 100644 --- a/components/operators/include/ftl/operators/antialiasing.hpp +++ b/components/operators/include/ftl/operators/antialiasing.hpp @@ -19,6 +19,8 @@ class FXAA : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/include/ftl/operators/clipping.hpp b/components/operators/include/ftl/operators/clipping.hpp index 25d8b76ff7bdbfc99717b01652497395e5ff7ea1..a45ba760ad2f444d1091a56d96e69acb7e921b38 100644 --- a/components/operators/include/ftl/operators/clipping.hpp +++ b/components/operators/include/ftl/operators/clipping.hpp @@ -19,6 +19,8 @@ class ClipScene : public ftl::operators::Operator { bool apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/include/ftl/operators/colours.hpp b/components/operators/include/ftl/operators/colours.hpp index a54539a67f829a7d1e9aa6c6306bb76a707081fa..d6745d17c58f01e1db5ecffae723aa7d863d1165 100644 --- a/components/operators/include/ftl/operators/colours.hpp +++ b/components/operators/include/ftl/operators/colours.hpp @@ -15,6 +15,8 @@ class ColourChannels : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: cv::cuda::GpuMat temp_; cv::cuda::GpuMat rbuf_; diff --git a/components/operators/include/ftl/operators/depth.hpp b/components/operators/include/ftl/operators/depth.hpp index 14f46b12d12b3adf933bd3ea7bd67463b36f19f2..38596dcc012e8395020d390762ebae913c0b0762 100644 --- a/components/operators/include/ftl/operators/depth.hpp +++ b/components/operators/include/ftl/operators/depth.hpp @@ -18,6 +18,8 @@ class DepthBilateralFilter : public::ftl::operators::Operator { inline ftl::operators::Operator::Type type() const override { return ftl::operators::Operator::Type::OneToOne; } bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: cv::cuda::GpuMat disp_int_; cv::cuda::GpuMat disp_int_result_; diff --git a/components/operators/include/ftl/operators/detectandtrack.hpp b/components/operators/include/ftl/operators/detectandtrack.hpp index 0d8b063d34cc2a9059d6cabe54d6c25484015891..2341d2d40bf544621950743ebcadb89676ce4809 100644 --- a/components/operators/include/ftl/operators/detectandtrack.hpp +++ b/components/operators/include/ftl/operators/detectandtrack.hpp @@ -48,6 +48,8 @@ class DetectAndTrack : public ftl::operators::Operator { void wait(cudaStream_t) override; + static void configuration(ftl::Configurable*) {} + protected: bool init(); @@ -126,6 +128,8 @@ class ArUco : public ftl::operators::Operator { ftl::codecs::Channel channel_in_; ftl::codecs::Channel channel_out_; + static void configuration(ftl::Configurable*) {} + private: bool estimate_pose_; float marker_size_; diff --git a/components/operators/include/ftl/operators/disparity.hpp b/components/operators/include/ftl/operators/disparity.hpp index 17993f24c5e1778957cc7f3f29762ccaa611b0cc..2e4365d8ce361d186aba42fcafeaebcb3ebc7dec 100644 --- a/components/operators/include/ftl/operators/disparity.hpp +++ b/components/operators/include/ftl/operators/disparity.hpp @@ -29,6 +29,8 @@ public: bool isMemoryHeavy() const override { return true; } + static void configuration(ftl::Configurable*) {} + private: bool init(); @@ -54,6 +56,8 @@ class FixstarsSGM : public ftl::operators::Operator { bool isMemoryHeavy() const override { return true; } + static void configuration(ftl::Configurable*) {} + private: bool init(); bool updateParameters(); @@ -99,6 +103,8 @@ class DisparityBilateralFilter : public::ftl::operators::Operator { inline Operator::Type type() const override { return Operator::Type::OneToOne; } bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: cv::Ptr<cv::cuda::DisparityBilateralFilter> filter_; cv::cuda::GpuMat disp_int_; @@ -121,6 +127,8 @@ class DisparityToDepth : public ftl::operators::Operator { ~DisparityToDepth() {}; inline Operator::Type type() const override { return Operator::Type::OneToOne; } bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + + static void configuration(ftl::Configurable*) {} }; /** @@ -138,6 +146,8 @@ class DepthChannel : public ftl::operators::Operator { bool apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cudaStream_t stream) override; bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::operators::Graph *pipe_; std::vector<cv::cuda::GpuMat> rbuf_; @@ -160,6 +170,8 @@ class OpticalFlowTemporalSmoothing : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: void _init(ftl::Configurable* cfg); bool init(); diff --git a/components/operators/include/ftl/operators/filling.hpp b/components/operators/include/ftl/operators/filling.hpp index ed2b3f39a20a949fa28dfe61232d44d15f56affe..c26b9ef80e7aa0705fb6877f06a1154ee8fc0078 100644 --- a/components/operators/include/ftl/operators/filling.hpp +++ b/components/operators/include/ftl/operators/filling.hpp @@ -19,6 +19,8 @@ class ScanFieldFill : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; class CrossSupportFill : public ftl::operators::Operator { @@ -30,6 +32,8 @@ class CrossSupportFill : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/include/ftl/operators/fusion.hpp b/components/operators/include/ftl/operators/fusion.hpp index ed0e5f9cd324f1e57979d9f20fc9d9a98f796ce0..d1e72ecfed516545a109f4530ecde9f330bb0205 100644 --- a/components/operators/include/ftl/operators/fusion.hpp +++ b/components/operators/include/ftl/operators/fusion.hpp @@ -17,6 +17,8 @@ class Fusion : public ftl::operators::Operator { bool apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::cuda::MLSMultiIntensity mls_; std::vector<cv::cuda::GpuMat> weights_; diff --git a/components/operators/include/ftl/operators/gt_analysis.hpp b/components/operators/include/ftl/operators/gt_analysis.hpp index cea34c9dba5477012bd2a620ebbbe0e079fdea51..efe0b64e63b27b6b999f79baa10ecf18f68ad3a9 100644 --- a/components/operators/include/ftl/operators/gt_analysis.hpp +++ b/components/operators/include/ftl/operators/gt_analysis.hpp @@ -21,6 +21,8 @@ class GTAnalysis : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*); + private: ftl::cuda::GTAnalysisData *output_; }; diff --git a/components/operators/include/ftl/operators/mask.hpp b/components/operators/include/ftl/operators/mask.hpp index 7d877d6579c329f7af513840b7140f187dbf7eed..863e085c2518700954a0aaac365edd3e37f418c6 100644 --- a/components/operators/include/ftl/operators/mask.hpp +++ b/components/operators/include/ftl/operators/mask.hpp @@ -21,6 +21,8 @@ class DiscontinuityMask : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -35,6 +37,8 @@ class BorderMask : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -49,6 +53,8 @@ class DisplayMask : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -63,6 +69,8 @@ class CullDiscontinuity : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/include/ftl/operators/mvmls.hpp b/components/operators/include/ftl/operators/mvmls.hpp index 0c0d6f4afb9715814199304ca0b430ac094071c4..56aafac1fe779832f9f7b6e857a1d67063113fdd 100644 --- a/components/operators/include/ftl/operators/mvmls.hpp +++ b/components/operators/include/ftl/operators/mvmls.hpp @@ -15,6 +15,8 @@ class MultiViewMLS : public ftl::operators::Operator { bool apply(ftl::rgbd::FrameSet &in, ftl::rgbd::FrameSet &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: std::vector<ftl::cuda::TextureObject<float4>*> centroid_horiz_; std::vector<ftl::cuda::TextureObject<float4>*> centroid_vert_; diff --git a/components/operators/include/ftl/operators/normals.hpp b/components/operators/include/ftl/operators/normals.hpp index c4d1a0190d27e9f307474eeed3f2234ac99e2e23..398b006c7e6286575bd9ed986b02f5b8d5a7fc73 100644 --- a/components/operators/include/ftl/operators/normals.hpp +++ b/components/operators/include/ftl/operators/normals.hpp @@ -19,6 +19,8 @@ class Normals : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -36,6 +38,8 @@ class NormalDot : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -51,6 +55,8 @@ class SmoothNormals : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::cuda::TextureObject<half4> temp_; diff --git a/components/operators/include/ftl/operators/operator.hpp b/components/operators/include/ftl/operators/operator.hpp index 3f77b6900e4456898076031b3d97ba5bae190f90..938f5e781ab8bd4435f7a80c7bca6c9e0afcceca 100644 --- a/components/operators/include/ftl/operators/operator.hpp +++ b/components/operators/include/ftl/operators/operator.hpp @@ -81,7 +81,7 @@ struct ConstructionHelperBase { template <typename T> struct ConstructionHelper : public ConstructionHelperBase { - explicit ConstructionHelper(ftl::Configurable *cfg) : ConstructionHelperBase(cfg) {} + explicit ConstructionHelper(ftl::Configurable *cfg) : ConstructionHelperBase(cfg) { T::configuration(cfg); } ~ConstructionHelper() {} ftl::operators::Operator *make(Graph *g) override { return new T(g, config); @@ -92,6 +92,7 @@ template <typename T, typename... ARGS> struct ConstructionHelper2 : public ConstructionHelperBase { explicit ConstructionHelper2(ftl::Configurable *cfg, ARGS... args) : ConstructionHelperBase(cfg) { arguments_ = std::make_tuple(args...); + T::configuration(cfg); } ~ConstructionHelper2() {} ftl::operators::Operator *make(Graph *g) override { diff --git a/components/operators/include/ftl/operators/opticalflow.hpp b/components/operators/include/ftl/operators/opticalflow.hpp index 21d8bbb200383b85a4f0c99a1f35e5e2e7b51385..cea1e7ba44f6f7b2f670cef318eb1ced4fcf7b7b 100644 --- a/components/operators/include/ftl/operators/opticalflow.hpp +++ b/components/operators/include/ftl/operators/opticalflow.hpp @@ -20,6 +20,8 @@ class NVOpticalFlow : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + protected: bool init(); diff --git a/components/operators/include/ftl/operators/poser.hpp b/components/operators/include/ftl/operators/poser.hpp index 8d762f8ba2ee371342adb8e20b07d359211d081e..2a6a4d6eb276471b6791e5efd55248a02dfb1db0 100644 --- a/components/operators/include/ftl/operators/poser.hpp +++ b/components/operators/include/ftl/operators/poser.hpp @@ -24,6 +24,8 @@ class Poser : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + static bool get(const std::string &name, Eigen::Matrix4d &pose); static bool get(const std::string &name, ftl::codecs::Shape3D &shape); static std::list<ftl::codecs::Shape3D*> getAll(int32_t fsid); diff --git a/components/operators/include/ftl/operators/segmentation.hpp b/components/operators/include/ftl/operators/segmentation.hpp index ec2f9e9a6d3ea8d683a6139a237849c82b8fe44a..0c3a4fff7337876d3d1a005acb12a8193ab958d9 100644 --- a/components/operators/include/ftl/operators/segmentation.hpp +++ b/components/operators/include/ftl/operators/segmentation.hpp @@ -18,6 +18,8 @@ class CrossSupport : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; /** @@ -32,6 +34,8 @@ class VisCrossSupport : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/include/ftl/operators/smoothing.hpp b/components/operators/include/ftl/operators/smoothing.hpp index db231cdd714a786df1dedf7ca54de06d2005ae4e..d035d399a74a2ecec1fd0dd06e118b20a54f6802 100644 --- a/components/operators/include/ftl/operators/smoothing.hpp +++ b/components/operators/include/ftl/operators/smoothing.hpp @@ -21,6 +21,8 @@ class HFSmoother : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: cv::cuda::GpuMat temp_; //ftl::rgbd::Frame frames_[4]; @@ -42,6 +44,8 @@ class SmoothChannel : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::cuda::TextureObject<uchar4> temp_[6]; }; @@ -60,6 +64,8 @@ class SimpleMLS : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::data::Frame temp_; }; @@ -77,6 +83,8 @@ class ColourMLS : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::data::Frame temp_; }; @@ -120,6 +128,8 @@ class AggreMLS : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::cuda::TextureObject<float4> centroid_horiz_; ftl::cuda::TextureObject<float4> centroid_vert_; @@ -144,6 +154,8 @@ class AdaptiveMLS : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + private: ftl::data::Frame temp_; }; diff --git a/components/operators/include/ftl/operators/weighting.hpp b/components/operators/include/ftl/operators/weighting.hpp index 8256a08cb23d03d42b9ef18a7107a858a34ebb8b..d829de145e7ac42f1c99d356fa2abf60c869b6d4 100644 --- a/components/operators/include/ftl/operators/weighting.hpp +++ b/components/operators/include/ftl/operators/weighting.hpp @@ -29,6 +29,8 @@ class PixelWeights : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; class CullWeight : public ftl::operators::Operator { @@ -40,6 +42,8 @@ class CullWeight : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; class DegradeWeight : public ftl::operators::Operator { @@ -51,6 +55,8 @@ class DegradeWeight : public ftl::operators::Operator { bool apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t stream) override; + static void configuration(ftl::Configurable*) {} + }; } diff --git a/components/operators/src/analysis/evaluation/gt_analysis.cpp b/components/operators/src/analysis/evaluation/gt_analysis.cpp index ee5d527dc8d30efe6a92a5328ee1b818fea671f5..c9559084eb53da55e13c8c4b22ccb221fcd9cb3f 100644 --- a/components/operators/src/analysis/evaluation/gt_analysis.cpp +++ b/components/operators/src/analysis/evaluation/gt_analysis.cpp @@ -9,6 +9,11 @@ GTAnalysis::GTAnalysis(ftl::operators::Graph *g, ftl::Configurable *cfg) : ftl:: cudaMalloc(&output_, sizeof(ftl::cuda::GTAnalysisData)); } +void GTAnalysis::configuration(ftl::Configurable *cfg) { + cfg->value("use_disparity", true); + cfg->value("show_colour", false); +} + GTAnalysis::~GTAnalysis() { cudaFree(output_); } @@ -68,7 +73,7 @@ bool GTAnalysis::apply(ftl::rgbd::Frame &in, ftl::rgbd::Frame &out, cudaStream_t ftl::cuda::GTAnalysisData err; for (const auto &o : (use_disp ? options_disparity : options_depth)) { - if (config()->value("show_colour", true)) { + if (config()->value("show_colour", false)) { ftl::cuda::gt_analysis( in.createTexture<uchar4>(Channel::Colour), in.createTexture<float>(Channel::Depth),