diff --git a/modules/ovis/include/opencv2/ovis.hpp b/modules/ovis/include/opencv2/ovis.hpp index 8beebc9f4..cd171a28e 100644 --- a/modules/ovis/include/opencv2/ovis.hpp +++ b/modules/ovis/include/opencv2/ovis.hpp @@ -62,6 +62,16 @@ public: /// @overload CV_WRAP_AS(setBackgroundColor) virtual void setBackground(const Scalar& color) = 0; + /** + * enable an ordered chain of full-screen post processing effects + * + * this way you can add distortion or SSAO effects. + * The effects themselves must be defined inside Ogre .compositor scripts. + * @see addResourceLocation + * @param names compositor names that will be applied in order of appearance + */ + CV_WRAP virtual void setCompositors(const std::vector& names) = 0; + /** * place an entity of an mesh in the scene * diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index 9f43211c5..f0e6de57a 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include @@ -339,6 +340,23 @@ public: bgplane->setVisible(true); } + void setCompositors(const std::vector& names) + { + Viewport* vp = frameSrc->getViewport(0); + CompositorManager& cm = CompositorManager::getSingleton(); + + cm.removeCompositorChain(vp); // remove previous configuration + + for(size_t i = 0; i < names.size(); i++) + { + if (!cm.addCompositor(vp, names[i])) { + LogManager::getSingleton().logError("Failed to add compositor: " + names[i]); + continue; + } + cm.setCompositorEnabled(vp, names[i], true); + } + } + void setBackground(const Scalar& color) { // hide background plane