diff --git a/modules/ovis/include/opencv2/ovis.hpp b/modules/ovis/include/opencv2/ovis.hpp index 0369281e8..aa95f64bb 100644 --- a/modules/ovis/include/opencv2/ovis.hpp +++ b/modules/ovis/include/opencv2/ovis.hpp @@ -70,6 +70,12 @@ public: CV_WRAP virtual void createEntity(const String& name, const String& meshname, InputArray tvec = noArray(), InputArray rot = noArray()) = 0; + /** + * remove an entity from the scene + * @param name entity name + */ + CV_WRAP virtual void removeEntity(const String& name) = 0; + /** * convenience method to visualize a camera position * diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index f116a65f3..18d327834 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -342,6 +342,13 @@ public: node->attachObject(ent); } + void removeEntity(const String& name) { + SceneNode* node = _getSceneNode(sceneMgr, name); + node->getAttachedObject(name)->detachFromParent(); + sceneMgr->destroyEntity(name); + sceneMgr->destroySceneNode(node); + } + Rect2d createCameraEntity(const String& name, InputArray K, const Size& imsize, float zFar, InputArray tvec, InputArray rot) {