Skip to content

Commit

Permalink
changed:调整特征信息类型定义位置和特重命名征操作头文件
Browse files Browse the repository at this point in the history
  • Loading branch information
GengGode committed Dec 7, 2023
1 parent e6d214c commit b9488ed
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
#pragma once
#include "algorithms.include.h"

namespace tianli::algorithms::features
namespace tianli::algorithms::feature
{
struct features
static features from_image(const cv::Ptr<cv::xfeatures2d::SURF> &detector, const cv::Mat &image, const cv::Mat &mask = cv::Mat())
{
std::vector<size_t> indexs;
std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;

size_t size() const { return keypoints.size(); }

static features from_image(const cv::Ptr<cv::xfeatures2d::SURF> &detector, const cv::Mat &image, const cv::Mat &mask = cv::Mat())
{
features fts;
detector->detectAndCompute(image, mask, fts.keypoints, fts.descriptors);
return fts;
}
};
features fts;
detector->detectAndCompute(image, mask, fts.keypoints, fts.descriptors);
return fts;
}

static features merge(const features &features_upper, const features &features_lower)
{
Expand Down
8 changes: 8 additions & 0 deletions source/algorithms/algorithms.include.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ struct odometer_config
double scale = 1.0;
};

struct features
{
std::vector<size_t> indexs;
std::vector<cv::KeyPoint> keypoints;
cv::Mat descriptors;
size_t size() const { return keypoints.size(); }
};

class point_index
{
public:
Expand Down
6 changes: 3 additions & 3 deletions tests/algorithms_feature_merge/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <opencv2/xfeatures2d/nonfree.hpp>
#include "resources/binary/resources.binary.h"
#include <fmt/format.h>
#include "algorithms/algorithms.features.h"
#include "algorithms/algorithms.feature.h"

using namespace tianli::algorithms::features;
using namespace tianli::algorithms::feature;

cv::Mat get(int i)
{
Expand All @@ -23,7 +23,7 @@ cv::Ptr<cv::xfeatures2d::SURF> detector = cv::xfeatures2d::SURF::create();

features gen(int i)
{
features fts = features::from_image(detector, get(i));
features fts = from_image(detector, get(i));
cv::Mat mat;
drawKeypoints(get(i), fts.keypoints, mat, cv::Scalar::all(-1), cv::DrawMatchesFlags::DRAW_RICH_KEYPOINTS);
cv::imwrite(fmt::format("org_key_{}.png", i), mat);
Expand Down
4 changes: 2 additions & 2 deletions tests/container_treeset/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include <iostream>
#include <opencv2/xfeatures2d/nonfree.hpp>
#include <fmt/format.h>
#include "algorithms/algorithms.features.h"
#include "algorithms/algorithms.feature.h"
#include "algorithms/container/container.set.h"
#include "resources/Resources.h"

using namespace tianli::algorithms::features;
using namespace tianli::algorithms::feature;
#include <psapi.h>


Expand Down

0 comments on commit b9488ed

Please sign in to comment.