DIC源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.4 KiB

3 months ago
#pragma once
#ifndef _FEATURE_AFFINE_H_
#define _FEATURE_AFFINE_H_
#include "oc_array.h"
#include "oc_dic.h"
#include "oc_image.h"
#include "oc_nearest_neighbor.h"
#include "oc_poi.h"
#include "oc_point.h"
namespace opencorr
{
//parameters in RANSAC
struct RansacConfig
{
int trial_number; //maximum number of trials in RANSAC
int sample_mumber; //number of samples in every trial
float error_threshold; //error threshold in RANSAC
};
class FeatureAffine2D : public DIC
{
private:
std::vector<NearestNeighbor*> instance_pool;
NearestNeighbor* getInstance(int tid);
protected:
float neighbor_search_radius; //seaching radius for mached keypoints around a POI
int min_neighbor_num; //minimum number of neighbors required by RANSAC
RansacConfig ransac_config;
public:
std::vector<Point2D> ref_kp; //matched keypoints in ref image
std::vector<Point2D> tar_kp; //matched keypoints in tar image
FeatureAffine2D(int radius_x, int radius_y, int thread_number);
~FeatureAffine2D();
RansacConfig getRansacConfig() const;
float getSearchRadius() const;
int getMinNeighborNumber() const;
void setSearchParameters(float neighbor_search_radius, int min_neighbor_num);
void setRansacConfig(RansacConfig ransac_config);
void setKeypointPair(std::vector<Point2D>& ref_kp, std::vector<Point2D>& tar_kp);
void prepare();
void compute(POI2D* poi);
void compute(std::vector<POI2D>& poi_queue);
};
class FeatureAffine3D : public DVC
{
private:
std::vector<NearestNeighbor*> instance_pool;
NearestNeighbor* getInstance(int tid);
protected:
float neighbor_search_radius; //seaching radius for mached keypoints around a POI
int min_neighbor_num; //minimum number of neighbors required by RANSAC
RansacConfig ransac_config;
public:
std::vector<Point3D> ref_kp; //matched keypoints in ref image
std::vector<Point3D> tar_kp; //matched keypoints in tar image
FeatureAffine3D(int radius_x, int radius_y, int radius_z, int thread_number);
~FeatureAffine3D();
RansacConfig getRansacConfig() const;
float getSearchRadius() const;
int getMinNeighborNumber() const;
void setSearchParameters(float neighbor_search_radius, int min_neighbor_num);
void setRansacConfig(RansacConfig ransac_config);
void setKeypointPair(std::vector<Point3D>& ref_kp, std::vector<Point3D>& tar_kp);
void prepare();
void compute(POI3D* poi);
void compute(std::vector<POI3D>& poi_queue);
};
}//namespace opencorr
#endif //_FEATURE_AFFINE_H_