Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions SolARFramework.pri
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +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/IKeyframeLoader.h \
interfaces/api/input/files/IMapLoader.h \
interfaces/api/input/files/IMeshLoader.h \
interfaces/api/input/files/IPointCloudLoader.h \
Expand All @@ -71,6 +72,8 @@ 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 \
interfaces/api/reloc/IRegression.h \
Expand Down
68 changes: 68 additions & 0 deletions interfaces/api/input/files/IKeyframeLoader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @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 <optional>
#include <xpcf/api/IComponentIntrospect.h>

namespace SolAR {
namespace api {
namespace input {
namespace files {

/**
* @class IKeyframeLoader
* @brief <B>Load a keyframe collection from file.</B>
* <TT>UUID: 2d1d125c-6bd2-4e2c-af76-f58910cb7791</TT>
*
*/
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<SolAR::datastructure::KeyframeCollection>& 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<SolAR::datastructure::KeyframeCollection>& keyframeCollection,
SRef<SolAR::datastructure::CameraParametersCollection>& 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
116 changes: 58 additions & 58 deletions interfaces/api/input/files/IMapLoader.h
Original file line number Diff line number Diff line change
@@ -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 <xpcf/api/IComponentIntrospect.h>
#include <xpcf/core/helpers.h>
#include "core/Messages.h"
#include "datastructure/Map.h"
namespace SolAR {
namespace api {
namespace input {
namespace files {
/**
* @class IMapLoader
* @brief <B>Loads a map from a file.</B>
* <TT>UUID: 84dbbc4f-cc65-40ff-946d-7ed4999fb3a5</TT>
*
*/
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<SolAR::datastructure::Map> & 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 <xpcf/api/IComponentIntrospect.h>
#include <xpcf/core/helpers.h>
#include "core/Messages.h"
#include "datastructure/Map.h"

namespace SolAR {
namespace api {
namespace input {
namespace files {
/**
* @class IMapLoader
* @brief <B>Loads a map from a file.</B>
* <TT>UUID: 84dbbc4f-cc65-40ff-946d-7ed4999fb3a5</TT>
*
*/
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<SolAR::datastructure::Map> & 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
66 changes: 66 additions & 0 deletions interfaces/api/pointCloud/IPCProjectOntoImage.h
Original file line number Diff line number Diff line change
@@ -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 <xpcf/api/IComponentIntrospect.h>
#include <xpcf/core/helpers.h>

namespace SolAR {
namespace api {
namespace pointCloud {

/**
* @class IPCProjectOntoImage
* @brief <B>Project a point cloud onto image.</B>
* <TT>UUId: 3700812e-0af5-4968-b972-4fdc6d3d7371</TT>
*/

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<SolAR::datastructure::PointCloud> pointCloud,
SRef<SolAR::datastructure::CameraParameters> cameraParameters,
const SolAR::datastructure::Transform3Df& pose,
SRef<SolAR::datastructure::Image>& 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
68 changes: 68 additions & 0 deletions interfaces/api/pointCloud/IPCSemanticFrom2D.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @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 <xpcf/api/IComponentIntrospect.h>
#include <xpcf/core/helpers.h>

namespace SolAR {
namespace api {
namespace pointCloud {

/**
* @class IPCSemanticFrom2D
* @brief <B>Estimate semantic Ids of cloud points from 2D information.</B>
* <TT>UUId: e7f67167-1512-4c1c-808a-adcfb606030e</TT>
*/

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
/// @return FrameworkReturnCode::_SUCCESS (semantic id estimated successfully) otherwise FrameworkReturnCode::_ERROR_ (failure)
virtual FrameworkReturnCode estimate(SRef<SolAR::datastructure::PointCloud> pointCloud,
SRef<SolAR::datastructure::KeyframeCollection> keyframeCollection,
SRef<SolAR::datastructure::CameraParametersCollection> cameraParametersCollection,
SRef<SolAR::datastructure::Mask2DCollection> 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
4 changes: 4 additions & 0 deletions interfaces/datastructure/KeyframeCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion interfaces/datastructure/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ class SOLARFRAMEWORK_API Map : public Trackable {
SRef<CameraParametersCollection> m_cameraParametersCollection = org::bcom::xpcf::utils::make_shared<CameraParametersCollection>();

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
};
Expand Down
11 changes: 11 additions & 0 deletions src/datastructure/KeyframeCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,17 @@ int KeyframeCollection::getNbKeyframes() const
return static_cast<int>(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) {
Expand Down