|
10 | 10 | #include <aliceVision/numeric/numeric.hpp>
|
11 | 11 | #include <aliceVision/feature/imageDescriberCommon.hpp>
|
12 | 12 | #include <aliceVision/feature/Regions.hpp>
|
| 13 | +#include <aliceVision/feature/regionsFactory.hpp> |
13 | 14 | #include <aliceVision/image/Image.hpp>
|
14 | 15 | #include <memory>
|
15 | 16 |
|
@@ -260,6 +261,115 @@ class ImageDescriber
|
260 | 261 | void LoadFeatures(Regions* regions, const std::string& sfileNameFeats) const { regions->LoadFeatures(sfileNameFeats); }
|
261 | 262 | };
|
262 | 263 |
|
| 264 | +/** |
| 265 | + * @brief Used to load descripters computed outside of meshroom. |
| 266 | + */ |
| 267 | +class UnknownImageDescriber : public ImageDescriber |
| 268 | +{ |
| 269 | + public: |
| 270 | + UnknownImageDescriber() = default; |
| 271 | + |
| 272 | + virtual ~UnknownImageDescriber() = default; |
| 273 | + |
| 274 | + /** |
| 275 | + * @brief Check if the image describer use CUDA |
| 276 | + * @return True if the image describer use CUDA |
| 277 | + */ |
| 278 | + bool useCuda() const override { return false; } |
| 279 | + |
| 280 | + /** |
| 281 | + * @brief Check if the image describer use float image |
| 282 | + * @return True if the image describer use float image |
| 283 | + */ |
| 284 | + bool useFloatImage() const override { return false; } |
| 285 | + |
| 286 | + /** |
| 287 | + * @brief Get the corresponding EImageDescriberType |
| 288 | + * @return EImageDescriberType |
| 289 | + */ |
| 290 | + EImageDescriberType getDescriberType() const override { return EImageDescriberType::UNKNOWN; } |
| 291 | + |
| 292 | + /** |
| 293 | + * @brief Get the total amount of RAM needed for a |
| 294 | + * feature extraction of an image of the given dimension. |
| 295 | + * @param[in] width The image width |
| 296 | + * @param[in] height The image height |
| 297 | + * @return total amount of memory needed |
| 298 | + */ |
| 299 | + std::size_t getMemoryConsumption(std::size_t width, std::size_t height) const override |
| 300 | + { |
| 301 | + return 0; |
| 302 | + } |
| 303 | + |
| 304 | + /** |
| 305 | + * @brief Set image describer always upRight |
| 306 | + * @param[in] upRight |
| 307 | + */ |
| 308 | + void setUpRight(bool upRight) override |
| 309 | + {} |
| 310 | + |
| 311 | + /** |
| 312 | + * @brief Set if yes or no imageDescriber need to use cuda implementation |
| 313 | + * @param[in] useCuda |
| 314 | + */ |
| 315 | + void setUseCuda(bool useCuda) override |
| 316 | + {} |
| 317 | + |
| 318 | + /** |
| 319 | + * @brief set the CUDA pipe |
| 320 | + * @param[in] pipe The CUDA pipe id |
| 321 | + */ |
| 322 | + void setCudaPipe(int pipe) override |
| 323 | + {} |
| 324 | + |
| 325 | + /** |
| 326 | + * @brief Use a preset to control the number of detected regions |
| 327 | + * @param[in] preset The preset configuration |
| 328 | + */ |
| 329 | + void setConfigurationPreset(ConfigurationPreset preset) override |
| 330 | + {} |
| 331 | + |
| 332 | + /** |
| 333 | + * @brief Detect regions on the 8-bit image and compute their attributes (description) |
| 334 | + * @param[in] image Image. |
| 335 | + * @param[out] regions The detected regions and attributes (the caller must delete the allocated data) |
| 336 | + * @param[in] mask 8-bit grayscale image for keypoint filtering (optional) |
| 337 | + * Non-zero values depict the region of interest. |
| 338 | + * @return True if detection succed. |
| 339 | + */ |
| 340 | + bool describe(const image::Image<unsigned char>& image, |
| 341 | + std::unique_ptr<Regions>& regions, |
| 342 | + const image::Image<unsigned char>* mask = nullptr) override |
| 343 | + { |
| 344 | + return false; |
| 345 | + } |
| 346 | + |
| 347 | + /** |
| 348 | + * @brief Detect regions on the float image and compute their attributes (description) |
| 349 | + * @param[in] image Image. |
| 350 | + * @param[out] regions The detected regions and attributes (the caller must delete the allocated data) |
| 351 | + * @param[in] mask 8-bit gray image for keypoint filtering (optional). |
| 352 | + * Non-zero values depict the region of interest. |
| 353 | + * @return True if detection succed. |
| 354 | + */ |
| 355 | + bool describe(const image::Image<float>& image, std::unique_ptr<Regions>& regions, const image::Image<unsigned char>* mask = nullptr) override |
| 356 | + { |
| 357 | + return false; |
| 358 | + } |
| 359 | + |
| 360 | + /** |
| 361 | + * @brief Allocate Regions type depending of the ImageDescriber |
| 362 | + * @param[in,out] regions |
| 363 | + */ |
| 364 | + void allocate(std::unique_ptr<Regions>& regions) const override |
| 365 | + { |
| 366 | + regions.reset(new UNKNOWN_Regions); |
| 367 | + } |
| 368 | + |
| 369 | + private: |
| 370 | + std::unique_ptr<ImageDescriber> _imageDescriberImpl = nullptr; |
| 371 | +}; |
| 372 | + |
263 | 373 | /**
|
264 | 374 | * @brief Create the desired ImageDescriber method.
|
265 | 375 | * Don't use a factory, perform direct allocation.
|
|
0 commit comments