From fc28d02a1e4a2547c9f3d169556863f1fffa539a Mon Sep 17 00:00:00 2001 From: Alexander Alekhin Date: Sun, 28 Oct 2018 16:35:52 +0000 Subject: [PATCH 1/4] sfm: fix public includes don't include internal 3rdparty header --- modules/sfm/include/opencv2/sfm/numeric.hpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/sfm/include/opencv2/sfm/numeric.hpp b/modules/sfm/include/opencv2/sfm/numeric.hpp index f191b2b9f..fc23c010b 100644 --- a/modules/sfm/include/opencv2/sfm/numeric.hpp +++ b/modules/sfm/include/opencv2/sfm/numeric.hpp @@ -38,8 +38,6 @@ #include -#include - namespace cv { namespace sfm From 5002e934053d19fc54847f60c37bc1e015341af1 Mon Sep 17 00:00:00 2001 From: Varvrar Date: Wed, 31 Oct 2018 15:38:18 +0300 Subject: [PATCH 2/4] Now when the element of the vector is removed j does not increase --- modules/line_descriptor/src/binary_descriptor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/line_descriptor/src/binary_descriptor.cpp b/modules/line_descriptor/src/binary_descriptor.cpp index b2fd19698..e5de2f9aa 100644 --- a/modules/line_descriptor/src/binary_descriptor.cpp +++ b/modules/line_descriptor/src/binary_descriptor.cpp @@ -625,11 +625,12 @@ void BinaryDescriptor::computeImpl( const Mat& imageSrc, std::vector& k /* delete useless OctaveSingleLines */ for ( size_t i = 0; i < sl.size(); i++ ) { - for ( size_t j = 0; j < sl[i].size(); j++ ) + for ( size_t j = 0; j < sl[i].size(); ) { //if( (int) ( sl[i][j] ).octaveCount > params.numOfOctave_ ) if( (int) ( sl[i][j] ).octaveCount > octaveIndex ) ( sl[i] ).erase( ( sl[i] ).begin() + j ); + else j++; } } From 31dff1e0995dd5c150babc61a4eff19334ad4f00 Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Wed, 31 Oct 2018 15:00:18 +0100 Subject: [PATCH 3/4] ovis: add more CV_MAT <> Ogre::PixelFormat conversions --- modules/ovis/src/ovis.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index ca1a34f25..cc2334ecf 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -43,8 +43,14 @@ void _createTexture(const String& name, Mat image) case CV_8UC1: format = PF_BYTE_L; break; + case CV_16UC1: + format = PF_L16; + break; + case CV_32FC1: + format = PF_FLOAT32_R; + break; default: - CV_Error(Error::StsBadArg, "currently only CV_8UC1, CV_8UC3, CV_8UC4 textures are supported"); + CV_Error(Error::StsBadArg, "currently supported formats are only CV_8UC1, CV_8UC3, CV_8UC4, CV_16UC1, CV_32FC1"); break; } @@ -388,18 +394,26 @@ public: int dst_type; switch(src_type) { + case PF_R8: + case PF_L8: + dst_type = CV_8U; + break; case PF_BYTE_RGB: dst_type = CV_8UC3; break; case PF_BYTE_RGBA: dst_type = CV_8UC4; break; + case PF_FLOAT32_R: + dst_type = CV_32F; + break; case PF_FLOAT32_RGB: dst_type = CV_32FC3; break; case PF_FLOAT32_RGBA: dst_type = CV_32FC4; break; + case PF_L16: case PF_DEPTH16: dst_type = CV_16U; break; From cd7a6eaf78edbc68bdef58333b3c4b2cdfa3d5dd Mon Sep 17 00:00:00 2001 From: Pavel Rojtberg Date: Wed, 31 Oct 2018 15:42:36 +0100 Subject: [PATCH 4/4] ovis: add ENTITY_AABB_WORLD property and implement getEntityProperty --- modules/ovis/include/opencv2/ovis.hpp | 9 +++++++++ modules/ovis/src/ovis.cpp | 29 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/modules/ovis/include/opencv2/ovis.hpp b/modules/ovis/include/opencv2/ovis.hpp index b4063683e..5e5db358d 100644 --- a/modules/ovis/include/opencv2/ovis.hpp +++ b/modules/ovis/include/opencv2/ovis.hpp @@ -45,6 +45,7 @@ enum EntityProperty { ENTITY_MATERIAL, ENTITY_SCALE, + ENTITY_AABB_WORLD }; /** @@ -106,6 +107,14 @@ public: /// @overload CV_WRAP virtual void setEntityProperty(const String& name, int prop, const String& value) = 0; + /** + * get the property of an entity + * @param name entity name + * @param prop @ref EntityProperty + * @param value the value + */ + CV_WRAP virtual void getEntityProperty(const String& name, int prop, OutputArray value) = 0; + /** * convenience method to visualize a camera position * diff --git a/modules/ovis/src/ovis.cpp b/modules/ovis/src/ovis.cpp index cc2334ecf..58f67b848 100644 --- a/modules/ovis/src/ovis.cpp +++ b/modules/ovis/src/ovis.cpp @@ -563,6 +563,35 @@ public: node.setScale(value[0], value[1], value[2]); } + void getEntityProperty(const String& name, int prop, OutputArray value) + { + SceneNode& node = _getSceneNode(sceneMgr, name); + switch(prop) + { + case ENTITY_SCALE: + { + Vector3 s = node.getScale(); + Mat_(1, 3, s.ptr()).copyTo(value); + return; + } + case ENTITY_AABB_WORLD: + { + Entity* ent = dynamic_cast(node.getAttachedObject(name)); + CV_Assert(ent && "invalid entity"); + AxisAlignedBox aabb = ent->getWorldBoundingBox(true); + Vector3 mn = aabb.getMinimum(); + Vector3 mx = aabb.getMaximum(); + Mat_ ret(2, 3); + Mat_(1, 3, mn.ptr()).copyTo(ret.row(0)); + Mat_(1, 3, mx.ptr()).copyTo(ret.row(1)); + ret.copyTo(value); + return; + } + default: + CV_Error(Error::StsBadArg, "unsupported property"); + } + } + void _createBackground() { String name = "_" + sceneMgr->getName() + "_DefaultBackground";