From cfcac336b6d7a7fd025c823faa0d6985806619ea Mon Sep 17 00:00:00 2001 From: "Yitian.Zhou" Date: Thu, 22 Jan 2026 16:18:11 +0100 Subject: [PATCH 1/5] feat: add interface api::pointCloud::IPCSemanticFrom2D --- SolARFramework.pri | 1 + interfaces/api/pointCloud/IPCSemanticFrom2D.h | 67 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 interfaces/api/pointCloud/IPCSemanticFrom2D.h diff --git a/SolARFramework.pri b/SolARFramework.pri index 13d1e997..5048a11d 100644 --- a/SolARFramework.pri +++ b/SolARFramework.pri @@ -71,6 +71,7 @@ interfaces/api/pipeline/IMapProcessingPipeline.h \ interfaces/api/pipeline/IRelocalizationTrackablePipeline.h \ interfaces/api/pointCloud/IPCFilter.h \ interfaces/api/pointCloud/IPCFilterCentroid.h \ +interfaces/api/pointCloud/IPCSemanticFrom2D.h \ interfaces/api/reloc/IKeyframeRetriever.h \ interfaces/api/reloc/IRelocalizer.h \ interfaces/api/reloc/IRegression.h \ diff --git a/interfaces/api/pointCloud/IPCSemanticFrom2D.h b/interfaces/api/pointCloud/IPCSemanticFrom2D.h new file mode 100644 index 00000000..d2e78988 --- /dev/null +++ b/interfaces/api/pointCloud/IPCSemanticFrom2D.h @@ -0,0 +1,67 @@ +/** + * @copyright Copyright (c) 2026 B-com http://www.b-com.com/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOLAR_IPCSEMANTICFROM2D_H +#define SOLAR_IPCSEMANTICFROM2D_H + +#include "core/Messages.h" +#include "datastructure/CameraParametersCollection.h" +#include "datastructure/KeyframeCollection.h" +#include "datastructure/Mask2DCollection.h" +#include "datastructure/PointCloud.h" +#include +#include + +namespace SolAR { +namespace api { +namespace pointCloud { + +/** + * @class IPCSemanticFrom2D + * @brief Estimate semantic Ids of cloud points from 2D information. + * UUId: e7f67167-1512-4c1c-808a-adcfb606030e + */ + +class XPCF_IGNORE IPCSemanticFrom2D : virtual public org::bcom::xpcf::IComponentIntrospect { +public: + /// @brief IPCSemanticFrom2D default constructor + IPCSemanticFrom2D() = default; + + /// @brief IPCSemanticFrom2D default destructor + virtual ~IPCSemanticFrom2D() = default; + + /// @brief Estimate point cloud semantic Ids from a keyframe collection and a mask collection + /// @param[in,out] pointCloud the point cloud for which semantic Ids will be estimated + /// @param[in] keyframeCollection input list of keyframes + /// @param[in] cameraParametersCollection input list of camera parameters + /// @param[in] maskCollection input list of masks + virtual FrameworkReturnCode estimate(SRef pointCloud, + SRef keyframeCollection, + SRef cameraParametersCollection, + SRef maskCollection) const = 0; + +}; +} +} +} // end of namespace Solar + +XPCF_DEFINE_INTERFACE_TRAITS(SolAR::api::pointCloud::IPCSemanticFrom2D, + "e7f67167-1512-4c1c-808a-adcfb606030e", + "IPCSemanticFrom2D", + "Interface for estimating semantic Ids of cloud points from 2D information"); + + +#endif // SOLAR_IPCSEMANTICFROM2D_H From 5c2c437091366802afdf4d9f62413706cf60afb6 Mon Sep 17 00:00:00 2001 From: "Yitian.Zhou" Date: Wed, 28 Jan 2026 10:33:09 +0100 Subject: [PATCH 2/5] fix: set descriptor type to UNDEFINED by default --- interfaces/datastructure/Map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/datastructure/Map.h b/interfaces/datastructure/Map.h index a136cb87..8c7d7fa4 100644 --- a/interfaces/datastructure/Map.h +++ b/interfaces/datastructure/Map.h @@ -299,7 +299,7 @@ class SOLARFRAMEWORK_API Map : public Trackable { SRef m_cameraParametersCollection = org::bcom::xpcf::utils::make_shared(); std::string m_version = SolAR::VERSION; // Version of the map (for compatibility) - datastructure::DescriptorType m_descriptorType = DescriptorType::AKAZE; // Type of descriptor used for the map + datastructure::DescriptorType m_descriptorType = DescriptorType::UNDEFINED; // Type of descriptor used for the map datastructure::GlobalDescriptorType m_globalDescriptorType = GlobalDescriptorType::UNDEFINED; // Type of global descriptor used for the map bool m_embedKeyframeImages = false; // Indicate if keyframe images must be embedded in datastructure }; From 6c23dad09738d3748bd119959b8e55f3f429ceb7 Mon Sep 17 00:00:00 2001 From: "Yitian.Zhou" Date: Fri, 30 Jan 2026 16:57:46 +0100 Subject: [PATCH 3/5] feat: add IKeyframeLoader in api::input::files --- SolARFramework.pri | 2 +- interfaces/api/input/files/IKeyframeLoader.h | 104 ++++++++++++++++ interfaces/api/input/files/IMapLoader.h | 116 +++++++++--------- interfaces/datastructure/KeyframeCollection.h | 4 + src/datastructure/KeyframeCollection.cpp | 11 ++ src/datastructure/Map.cpp | 6 + 6 files changed, 184 insertions(+), 59 deletions(-) create mode 100644 interfaces/api/input/files/IKeyframeLoader.h diff --git a/SolARFramework.pri b/SolARFramework.pri index 5048a11d..35458096 100644 --- a/SolARFramework.pri +++ b/SolARFramework.pri @@ -50,7 +50,7 @@ interfaces/api/input/devices/IDevice.h \ interfaces/api/input/devices/IIMU.h \ interfaces/api/input/devices/IRGBDCamera.h \ interfaces/api/input/devices/IStereoCameraCalibration.h \ -interfaces/api/input/files/IMapLoader.h \ +interfaces/api/input/files/IKeyframeLoader.h \ interfaces/api/input/files/IMeshLoader.h \ interfaces/api/input/files/IPointCloudLoader.h \ interfaces/api/input/files/ITrackableLoader.h \ diff --git a/interfaces/api/input/files/IKeyframeLoader.h b/interfaces/api/input/files/IKeyframeLoader.h new file mode 100644 index 00000000..9525a291 --- /dev/null +++ b/interfaces/api/input/files/IKeyframeLoader.h @@ -0,0 +1,104 @@ +/** + * @copyright Copyright (c) 2026 B-com http://www.b-com.com/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOLAR_IKEYFRAMELOADER_H +#define SOLAR_IKEYFRAMELOADER_H + +#include "datastructure/CameraParametersCollection.h" +#include "datastructure/KeyframeCollection.h" +#include +#include + +namespace SolAR { +namespace api { +namespace input { +namespace files { + +/** + * @enum keyframe file type +*/ +enum class KeyframeFileType { + TDF, /**< TDF format */ + UNDEFINED = 1000, +}; + +/// @brief Return the text definition (string) of a KeyframeFileType object +/// @param[in] keyframeFileType the keyframe file type +/// @return the text definition (string) +static std::string toString(const KeyframeFileType& keyframeFileType) +{ + switch (keyframeFileType) { + case KeyframeFileType::TDF: + return "TDF"; + case KeyframeFileType::UNDEFINED: + return "UNDEFINED"; + default: + return "Unknown value"; + } +} + +/// @brief Return the KeyframeFileType object from a text definition (string) +/// @param[in] textDefinition the text definition (string) +/// @return the keyframe file type +static std::optional parseKeyframeFileType(const std::string& textDefinition) +{ + if (textDefinition == "TDF") + return KeyframeFileType::TDF; + if (textDefinition == "UNDEFINED") + return KeyframeFileType::UNDEFINED; + LOG_ERROR("Unknown keyframe file type: {}", textDefinition); + return {}; +} + +/** + * @class IKeyframeLoader + * @brief Load a keyframe collection from file. + * UUID: 2d1d125c-6bd2-4e2c-af76-f58910cb7791 + * + */ +class XPCF_IGNORE IKeyframeLoader : virtual public org::bcom::xpcf::IComponentIntrospect { +public: + /// @brief default constructor + IKeyframeLoader() = default; + + /// @brief default destructor + virtual ~IKeyframeLoader() = default; + + /// @brief Load a keyframe collection from file + /// @param[out] keyframeCollection the loaded keyframe collection (camera ID is set to 0) + /// @return FrameworkReturnCode::_SUCCESS if load succeeded, else FrameworkReturnCode::_ERROR_ + virtual FrameworkReturnCode load(SRef& keyframeCollection) = 0; + + /// @brief Load a keyframe collection and a camera parameters collection from file + /// @param[out] keyframeCollection the loaded keyframe collection + /// @param[out] cameraParametersCollection the loaded camera parameters collection + /// @return FrameworkReturnCode::_SUCCESS if load succeeded, else FrameworkReturnCode::_ERROR_ + virtual FrameworkReturnCode load(SRef& keyframeCollection, + SRef& cameraParametersCollection) = 0; +}; + +} +} +} +} + +XPCF_DEFINE_INTERFACE_TRAITS(SolAR::api::input::files::IKeyframeLoader, + "2d1d125c-6bd2-4e2c-af76-f58910cb7791", + "IKeyframeLoader", + "Load a keyframe collection from file"); + + +#endif // SOLAR_IKEYFRAMELOADER_H diff --git a/interfaces/api/input/files/IMapLoader.h b/interfaces/api/input/files/IMapLoader.h index b792f7f4..7c673113 100644 --- a/interfaces/api/input/files/IMapLoader.h +++ b/interfaces/api/input/files/IMapLoader.h @@ -1,58 +1,58 @@ -/** - * @copyright Copyright (c) 2024 B-com http://www.b-com.com/ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SOLAR_IPOINTCLOUDLOADER_H -#define SOLAR_IPOINTCLOUDLOADER_H - -#include -#include -#include "core/Messages.h" -#include "datastructure/Map.h" - -namespace SolAR { -namespace api { -namespace input { -namespace files { -/** - * @class IMapLoader - * @brief Loads a map from a file. - * UUID: 84dbbc4f-cc65-40ff-946d-7ed4999fb3a5 - * - */ -class XPCF_IGNORE IMapLoader : - virtual public org::bcom::xpcf::IComponentIntrospect { -public: - IMapLoader() = default; - virtual ~IMapLoader() = default; - - /// @brief Load a Map from a filepath - /// @param[out] map the loaded map - /// @return FrameworkReturnCode::_SUCCESS if load succeed, else FrameworkReturnCode::_ERROR_ - virtual FrameworkReturnCode load(SRef & map) = 0; -}; - -} -} -} -} - -XPCF_DEFINE_INTERFACE_TRAITS(SolAR::api::input::files::IMapLoader, - "84dbbc4f-cc65-40ff-946d-7ed4999fb3a5", - "IMapLoader", - "Load a map from a file"); - - -#endif // SOLAR_IPOINTCLOUDLOADER_H +/** + * @copyright Copyright (c) 2024 B-com http://www.b-com.com/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOLAR_IMAPLOADER_H +#define SOLAR_IMAPLOADER_H + +#include +#include +#include "core/Messages.h" +#include "datastructure/Map.h" + +namespace SolAR { +namespace api { +namespace input { +namespace files { +/** + * @class IMapLoader + * @brief Loads a map from a file. + * UUID: 84dbbc4f-cc65-40ff-946d-7ed4999fb3a5 + * + */ +class XPCF_IGNORE IMapLoader : + virtual public org::bcom::xpcf::IComponentIntrospect { +public: + IMapLoader() = default; + virtual ~IMapLoader() = default; + + /// @brief Load a Map from a filepath + /// @param[out] map the loaded map + /// @return FrameworkReturnCode::_SUCCESS if load succeed, else FrameworkReturnCode::_ERROR_ + virtual FrameworkReturnCode load(SRef & map) = 0; +}; + +} +} +} +} + +XPCF_DEFINE_INTERFACE_TRAITS(SolAR::api::input::files::IMapLoader, + "84dbbc4f-cc65-40ff-946d-7ed4999fb3a5", + "IMapLoader", + "Load a map from a file"); + + +#endif // SOLAR_IMAPLOADER_H diff --git a/interfaces/datastructure/KeyframeCollection.h b/interfaces/datastructure/KeyframeCollection.h index 5ed37fd2..1488b4ca 100644 --- a/interfaces/datastructure/KeyframeCollection.h +++ b/interfaces/datastructure/KeyframeCollection.h @@ -105,6 +105,10 @@ class SOLARFRAMEWORK_API KeyframeCollection : public Lockable { /// @return The number of keyframes int getNbKeyframes() const; + /// @brief This method allows to get the number of keyframes having image data + /// @return The number of keyframes having image data + uint32_t getNbKeyframesHavingImage() const; + private: /// @brief This method allows to make reference keyframes consistent /// (e.g. this method can be called after having loaded a keyframe collection which may contain inconsistent ref keyframes) diff --git a/src/datastructure/KeyframeCollection.cpp b/src/datastructure/KeyframeCollection.cpp index d236139f..c433a1ba 100644 --- a/src/datastructure/KeyframeCollection.cpp +++ b/src/datastructure/KeyframeCollection.cpp @@ -188,6 +188,17 @@ int KeyframeCollection::getNbKeyframes() const return static_cast(m_keyframes.size()); } +uint32_t KeyframeCollection::getNbKeyframesHavingImage() const +{ + uint32_t n = 0; + for (const auto& [id, keyframe] : m_keyframes) { + if (keyframe && keyframe->getView()) { + n++; + } + } + return n; +} + void KeyframeCollection::nextSerializationWithoutKeyframeImages() { for (const auto& [id, kf]: m_keyframes) { diff --git a/src/datastructure/Map.cpp b/src/datastructure/Map.cpp index 87ee6625..26626bcc 100644 --- a/src/datastructure/Map.cpp +++ b/src/datastructure/Map.cpp @@ -98,6 +98,12 @@ void Map::setKeyframeCollection(const SRef keyframeCollectio // we use m_keyframesManager to access the keyframes and optimize their poses // the modifs on keyframes' poses will not be applied to the keyframe collection of m_map m_keyframeCollection = keyframeCollection; + if (!m_keyframeCollection) { + m_embedKeyframeImages = false; + } + else { + m_embedKeyframeImages = m_keyframeCollection->getNbKeyframesHavingImage() > 0; + } } const SRef Map::getConstCovisibilityGraph() const From 3d1ba2d68164f518039a00526377100f1e1753c6 Mon Sep 17 00:00:00 2001 From: "Yitian.Zhou" Date: Tue, 10 Feb 2026 17:15:34 +0100 Subject: [PATCH 4/5] feat: add interface IPCProjectOntoImage --- SolARFramework.pri | 1 + .../api/pointCloud/IPCProjectOntoImage.h | 66 +++++++++++++++++++ interfaces/api/pointCloud/IPCSemanticFrom2D.h | 1 + 3 files changed, 68 insertions(+) create mode 100644 interfaces/api/pointCloud/IPCProjectOntoImage.h diff --git a/SolARFramework.pri b/SolARFramework.pri index 35458096..b25bf1e1 100644 --- a/SolARFramework.pri +++ b/SolARFramework.pri @@ -71,6 +71,7 @@ interfaces/api/pipeline/IMapProcessingPipeline.h \ interfaces/api/pipeline/IRelocalizationTrackablePipeline.h \ interfaces/api/pointCloud/IPCFilter.h \ interfaces/api/pointCloud/IPCFilterCentroid.h \ +interfaces/api/pointCloud/IPCProjectOntoImage.h \ interfaces/api/pointCloud/IPCSemanticFrom2D.h \ interfaces/api/reloc/IKeyframeRetriever.h \ interfaces/api/reloc/IRelocalizer.h \ diff --git a/interfaces/api/pointCloud/IPCProjectOntoImage.h b/interfaces/api/pointCloud/IPCProjectOntoImage.h new file mode 100644 index 00000000..2fb984b8 --- /dev/null +++ b/interfaces/api/pointCloud/IPCProjectOntoImage.h @@ -0,0 +1,66 @@ +/** + * @copyright Copyright (c) 2026 B-com http://www.b-com.com/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SOLAR_IPCPROJECTONTOIMAGE_H +#define SOLAR_IPCPROJECTONTOIMAGE_H + +#include "datastructure/CameraDefinitions.h" +#include "datastructure/Image.h" +#include "datastructure/PointCloud.h" +#include +#include + +namespace SolAR { +namespace api { +namespace pointCloud { + +/** + * @class IPCProjectOntoImage + * @brief Project a point cloud onto image. + * UUId: 3700812e-0af5-4968-b972-4fdc6d3d7371 + */ + +class XPCF_IGNORE IPCProjectOntoImage : virtual public org::bcom::xpcf::IComponentIntrospect { +public: + /// @brief IPCProjectOntoImage default constructor + IPCProjectOntoImage() = default; + + /// @brief IPCProjectOntoImage default destructor + virtual ~IPCProjectOntoImage() = default; + + /// @brief Project a point cloud onto an image plane + /// @param[in] pointCloud the point cloud + /// @param[in] cameraParameters the camera parameters + /// @param[in] pose the camera pose + /// @param[out] image output image created from the point cloud + /// @return FrameworkReturnCode::_SUCCESS (pointcloud projected onto image successfully) otherwise FrameworkReturnCode::_ERROR_ (failure) + virtual FrameworkReturnCode project(SRef pointCloud, + SRef cameraParameters, + const SolAR::datastructure::Transform3Df& pose, + SRef& image) const = 0; + +}; +} +} +} // end of namespace Solar + +XPCF_DEFINE_INTERFACE_TRAITS(SolAR::api::pointCloud::IPCProjectOntoImage, + "3700812e-0af5-4968-b972-4fdc6d3d7371", + "IPCProjectOntoImage", + "Interface for projecting a point cloud onto image"); + + +#endif // SOLAR_IPCPROJECTONTOIMAGE_H diff --git a/interfaces/api/pointCloud/IPCSemanticFrom2D.h b/interfaces/api/pointCloud/IPCSemanticFrom2D.h index d2e78988..37cbafd3 100644 --- a/interfaces/api/pointCloud/IPCSemanticFrom2D.h +++ b/interfaces/api/pointCloud/IPCSemanticFrom2D.h @@ -48,6 +48,7 @@ class XPCF_IGNORE IPCSemanticFrom2D : virtual public org::bcom::xpcf::IComponent /// @param[in] keyframeCollection input list of keyframes /// @param[in] cameraParametersCollection input list of camera parameters /// @param[in] maskCollection input list of masks + /// @return FrameworkReturnCode::_SUCCESS (semantic id estimated successfully) otherwise FrameworkReturnCode::_ERROR_ (failure) virtual FrameworkReturnCode estimate(SRef pointCloud, SRef keyframeCollection, SRef cameraParametersCollection, From da047990421185190e261ab4247111f0a36a7c00 Mon Sep 17 00:00:00 2001 From: "Yitian.Zhou" Date: Tue, 24 Feb 2026 16:01:38 +0100 Subject: [PATCH 5/5] fix: remove KeyframeFileType and add IMapLoader.h in .pri --- SolARFramework.pri | 1 + interfaces/api/input/files/IKeyframeLoader.h | 36 -------------------- 2 files changed, 1 insertion(+), 36 deletions(-) diff --git a/SolARFramework.pri b/SolARFramework.pri index b25bf1e1..e5298afd 100644 --- a/SolARFramework.pri +++ b/SolARFramework.pri @@ -51,6 +51,7 @@ interfaces/api/input/devices/IIMU.h \ interfaces/api/input/devices/IRGBDCamera.h \ interfaces/api/input/devices/IStereoCameraCalibration.h \ interfaces/api/input/files/IKeyframeLoader.h \ +interfaces/api/input/files/IMapLoader.h \ interfaces/api/input/files/IMeshLoader.h \ interfaces/api/input/files/IPointCloudLoader.h \ interfaces/api/input/files/ITrackableLoader.h \ diff --git a/interfaces/api/input/files/IKeyframeLoader.h b/interfaces/api/input/files/IKeyframeLoader.h index 9525a291..21975853 100644 --- a/interfaces/api/input/files/IKeyframeLoader.h +++ b/interfaces/api/input/files/IKeyframeLoader.h @@ -27,42 +27,6 @@ namespace api { namespace input { namespace files { -/** - * @enum keyframe file type -*/ -enum class KeyframeFileType { - TDF, /**< TDF format */ - UNDEFINED = 1000, -}; - -/// @brief Return the text definition (string) of a KeyframeFileType object -/// @param[in] keyframeFileType the keyframe file type -/// @return the text definition (string) -static std::string toString(const KeyframeFileType& keyframeFileType) -{ - switch (keyframeFileType) { - case KeyframeFileType::TDF: - return "TDF"; - case KeyframeFileType::UNDEFINED: - return "UNDEFINED"; - default: - return "Unknown value"; - } -} - -/// @brief Return the KeyframeFileType object from a text definition (string) -/// @param[in] textDefinition the text definition (string) -/// @return the keyframe file type -static std::optional parseKeyframeFileType(const std::string& textDefinition) -{ - if (textDefinition == "TDF") - return KeyframeFileType::TDF; - if (textDefinition == "UNDEFINED") - return KeyframeFileType::UNDEFINED; - LOG_ERROR("Unknown keyframe file type: {}", textDefinition); - return {}; -} - /** * @class IKeyframeLoader * @brief Load a keyframe collection from file.