Skip to content
Snippets Groups Projects
Commit 11d5c2cc authored by Angel Santamaria-Navarro's avatar Angel Santamaria-Navarro
Browse files

before introducing quickharris

parent de075a1e
No related branches found
No related tags found
No related merge requests found
Showing
with 359 additions and 44 deletions
......@@ -212,11 +212,6 @@ bool TrifocalTensor::computeTensorRansac(const Eigen::MatrixXd& list1, const Eig
}
memcpy( tensor_, tensor_final, 27*sizeof(int) );
// DEBUG
std::cout << "=============" << std::endl;
std::cout << "best point idxs: " << idxs_best.transpose() << std::endl;
std::cout << "=============" << std::endl;
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return true;
......
......@@ -8,6 +8,41 @@ DetectorAGAST::DetectorAGAST(void)
DetectorAGAST::~DetectorAGAST(void)
{}
KeyPointVector DetectorAGAST::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorAGAST::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -31,11 +31,16 @@ class DetectorAGAST : public DetectorBase {
DetectorAGAST();
virtual ~DetectorAGAST(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,41 @@ DetectorAKAZE::DetectorAKAZE(void)
DetectorAKAZE::~DetectorAKAZE(void)
{}
KeyPointVector DetectorAKAZE::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorAKAZE::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -35,11 +35,16 @@ class DetectorAKAZE : public DetectorBase {
DetectorAKAZE();
virtual ~DetectorAKAZE(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,41 @@ DetectorBRISK::DetectorBRISK(void)
DetectorBRISK::~DetectorBRISK(void)
{}
KeyPointVector DetectorBRISK::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorBRISK::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -31,11 +31,16 @@ class DetectorBRISK : public DetectorBase {
DetectorBRISK();
virtual ~DetectorBRISK(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -10,41 +10,6 @@ DetectorBase::~DetectorBase(void)
{
}
KeyPointVector DetectorBase::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorBase::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
#include "detector_factory.h"
......
......@@ -45,8 +45,8 @@ class DetectorBase : public VUBase, public std::enable_shared_from_this<Detector
*/
virtual ~DetectorBase(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
virtual KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() ) = 0;
virtual KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi) = 0;
std::string getName(void);
......@@ -61,8 +61,6 @@ class DetectorBase : public VUBase, public std::enable_shared_from_this<Detector
int pattern_radius_;
FeatureDetectorPtr detector_;
void setName(const std::string& _name);
virtual void defineDetector(const ParamsBasePtr _params) = 0;
......
......@@ -8,6 +8,41 @@ DetectorFAST::DetectorFAST(void)
DetectorFAST::~DetectorFAST(void)
{}
KeyPointVector DetectorFAST::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorFAST::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -31,11 +31,16 @@ class DetectorFAST : public DetectorBase {
DetectorFAST();
virtual ~DetectorFAST(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,41 @@ DetectorGFTT::DetectorGFTT(void)
DetectorGFTT::~DetectorGFTT(void)
{}
KeyPointVector DetectorGFTT::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorGFTT::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -34,11 +34,16 @@ class DetectorGFTT : public DetectorBase {
DetectorGFTT();
virtual ~DetectorGFTT(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,41 @@ DetectorHARRIS::DetectorHARRIS(void)
DetectorHARRIS::~DetectorHARRIS(void)
{}
KeyPointVector DetectorHARRIS::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorHARRIS::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -34,11 +34,16 @@ class DetectorHARRIS : public DetectorBase {
DetectorHARRIS();
virtual ~DetectorHARRIS(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,41 @@ DetectorKAZE::DetectorKAZE(void)
DetectorKAZE::~DetectorKAZE(void)
{}
KeyPointVector DetectorKAZE::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorKAZE::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -34,11 +34,16 @@ class DetectorKAZE : public DetectorBase {
DetectorKAZE();
virtual ~DetectorKAZE(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,42 @@ DetectorMSER::DetectorMSER(void)
DetectorMSER::~DetectorMSER(void)
{}
KeyPointVector DetectorMSER::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorMSER::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
......@@ -37,11 +37,16 @@ class DetectorMSER : public DetectorBase {
DetectorMSER();
virtual ~DetectorMSER(void);
KeyPointVector detect(const cv::Mat& _image, const cv::InputArray& _mask=cv::noArray() );
KeyPointVector detect(const cv::Mat& _image, cv::Rect& _roi);
// Factory method
static DetectorBasePtr create(const std::string& _unique_name, const ParamsBasePtr _params);
private:
FeatureDetectorPtr detector_;
void defineDetector(const ParamsBasePtr _params);
};
......
......@@ -8,6 +8,42 @@ DetectorORB::DetectorORB(void)
DetectorORB::~DetectorORB(void)
{}
KeyPointVector DetectorORB::detect(const cv::Mat& _image, const cv::InputArray& _mask)
{
KeyPointVector kpts;
clock_t tStart = clock();
detector_->detect(_image, kpts, _mask);
comp_time_ = (double)(clock() - tStart) / CLOCKS_PER_SEC;
return kpts;
}
KeyPointVector DetectorORB::detect(const cv::Mat& _image, cv::Rect& _roi)
{
KeyPointVector kpts;
if (!_image.empty())
{
cv::Mat _image_roi;
adaptRoi(getPatternRadius(), _image, _roi, _image_roi);
try
{
kpts = detect(_image_roi);
for (int ii = 0; ii < kpts.size(); ++ii)
{
kpts[ii].pt.x = kpts[ii].pt.x + _roi.x;
kpts[ii].pt.y = kpts[ii].pt.y + _roi.y;
}
}
catch( cv::Exception& e )
{
std::cerr << "exception caught: " << e.what() << std::endl;
}
}
return kpts;
}
} /* namespace vision_utils */
// Register in the DetectorsFactory
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment