#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 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 ref_kp; //matched keypoints in ref image std::vector 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& ref_kp, std::vector& tar_kp); void prepare(); void compute(POI2D* poi); void compute(std::vector& poi_queue); }; class FeatureAffine3D : public DVC { private: std::vector 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 ref_kp; //matched keypoints in ref image std::vector 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& ref_kp, std::vector& tar_kp); void prepare(); void compute(POI3D* poi); void compute(std::vector& poi_queue); }; }//namespace opencorr #endif //_FEATURE_AFFINE_H_