Commit 2d85137e authored by cbalint13's avatar cbalint13

More fixes, reorganize, fix memleaks, more API tests.

parent 0c32bce3
...@@ -150,7 +150,6 @@ public: ...@@ -150,7 +150,6 @@ public:
@param q_radius amount of radial range division quantity @param q_radius amount of radial range division quantity
@param q_theta amount of angular range division quantity @param q_theta amount of angular range division quantity
@param q_hist amount of gradient orientations range division quantity @param q_hist amount of gradient orientations range division quantity
@param mode choose computation mode of descriptors where
DAISY::ONLY_KEYS means to compute descriptors only for keypoints in the list (default) and DAISY::ONLY_KEYS means to compute descriptors only for keypoints in the list (default) and
DAISY::COMP_FULL will compute descriptors for all pixels in the given image DAISY::COMP_FULL will compute descriptors for all pixels in the given image
@param norm choose descriptors normalization type, where @param norm choose descriptors normalization type, where
...@@ -168,12 +167,73 @@ class CV_EXPORTS DAISY : public DescriptorExtractor ...@@ -168,12 +167,73 @@ class CV_EXPORTS DAISY : public DescriptorExtractor
public: public:
enum enum
{ {
ONLY_KEYS = 0, COMP_FULL = 1,
NRM_NONE = 100, NRM_PARTIAL = 101, NRM_FULL = 102, NRM_SIFT = 103, NRM_NONE = 100, NRM_PARTIAL = 101, NRM_FULL = 102, NRM_SIFT = 103,
}; };
static Ptr<DAISY> create( float radius = 15, int q_radius = 3, int q_theta = 8, static Ptr<DAISY> create( float radius = 15, int q_radius = 3, int q_theta = 8,
int q_hist = 8, int mode = DAISY::ONLY_KEYS, int norm = DAISY::NRM_NONE, int q_hist = 8, int norm = DAISY::NRM_NONE, InputArray H = noArray(),
InputArray H = noArray() , bool interpolation = true, bool use_orientation = false ); bool interpolation = true, bool use_orientation = false );
/** @overload
* @param image image to extract descriptors
* @param keypoints of interest within image
* @param descriptors resulted descriptors array
*/
virtual void compute( InputArray image, std::vector<KeyPoint>& keypoints, OutputArray descriptors ) = 0;
/** @overload
* @param image image to extract descriptors
* @param roi region of interest within image
* @param descriptors resulted descriptors array for roi image pixels
*/
virtual void compute( InputArray image, Rect roi, OutputArray descriptors ) = 0;
/**@overload
* @param image image to extract descriptors
* @param descriptors resulted descriptors array for all image pixels
*/
virtual void compute( InputArray image, OutputArray descriptors ) = 0;
/**
* @param y position y on image
* @param x position x on image
* @param ori orientation on image (0->360)
* @param descriptor supplied array for descriptor storage
*/
virtual void get_descriptor( double y, double x, int orientation, float* descriptor ) const = 0;
/**
* @param y position y on image
* @param x position x on image
* @param ori orientation on image (0->360)
* @param H homography matrix for warped grid
* @param descriptor supplied array for descriptor storage
* @param get_descriptor true if descriptor was computed
*/
virtual bool get_descriptor( double y, double x, int orientation, double* H, float* descriptor ) const = 0;
/**
* @param y position y on image
* @param x position x on image
* @param ori orientation on image (0->360)
* @param descriptor supplied array for descriptor storage
*/
virtual void get_unnormalized_descriptor( double y, double x, int orientation, float* descriptor ) const = 0;
/**
* @param y position y on image
* @param x position x on image
* @param ori orientation on image (0->360)
* @param H homography matrix for warped grid
* @param descriptor supplied array for descriptor storage
* @param get_unnormalized_descriptor true if descriptor was computed
*/
virtual bool get_unnormalized_descriptor( double y, double x, int orientation, double* H, float* descriptor ) const = 0;
/**
* @param image set image as working
*/
virtual void set_image( InputArray image ) = 0;
}; };
......
...@@ -22,12 +22,12 @@ PERF_TEST_P(daisy, extract, testing::Values(DAISY_IMAGES)) ...@@ -22,12 +22,12 @@ PERF_TEST_P(daisy, extract, testing::Values(DAISY_IMAGES))
Mat mask; Mat mask;
declare.in(frame).time(90); declare.in(frame).time(90);
// use DAISY in COMP_FULL mode (every pixel, dense baseline mode) Ptr<DAISY> descriptor = DAISY::create();
Ptr<DAISY> descriptor = DAISY::create(15, 3, 8, 8, DAISY::COMP_FULL, DAISY::NRM_NONE, noArray(), true, false);
vector<KeyPoint> points; vector<KeyPoint> points;
vector<float> descriptors; vector<float> descriptors;
TEST_CYCLE() descriptor->compute(frame, points, descriptors); // compute all daisies in image
TEST_CYCLE() descriptor->compute(frame, descriptors);
SANITY_CHECK(descriptors, 1e-4); SANITY_CHECK(descriptors, 1e-4);
} }
This diff is collapsed.
...@@ -654,7 +654,7 @@ TEST(Features2d_RotationInvariance_Descriptor_SIFT, regression) ...@@ -654,7 +654,7 @@ TEST(Features2d_RotationInvariance_Descriptor_SIFT, regression)
TEST(Features2d_RotationInvariance_Descriptor_DAISY, regression) TEST(Features2d_RotationInvariance_Descriptor_DAISY, regression)
{ {
DescriptorRotationInvarianceTest test(BRISK::create(), DescriptorRotationInvarianceTest test(BRISK::create(),
DAISY::create(15, 3, 8, 8, DAISY::ONLY_KEYS, DAISY::NRM_NONE, noArray(), true, true), DAISY::create(15, 3, 8, 8, DAISY::NRM_NONE, noArray(), true, true),
NORM_L1, NORM_L1,
0.79f); 0.79f);
test.safe_run(); test.safe_run();
...@@ -721,7 +721,7 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression) ...@@ -721,7 +721,7 @@ TEST(Features2d_RotationInvariance2_Detector_SURF, regression)
TEST(Features2d_ScaleInvariance_Descriptor_DAISY, regression) TEST(Features2d_ScaleInvariance_Descriptor_DAISY, regression)
{ {
DescriptorScaleInvarianceTest test(BRISK::create(), DescriptorScaleInvarianceTest test(BRISK::create(),
DAISY::create(15, 3, 8, 8, DAISY::ONLY_KEYS, DAISY::NRM_NONE, noArray(), true, true), DAISY::create(15, 3, 8, 8, DAISY::NRM_NONE, noArray(), true, true),
NORM_L1, NORM_L1,
0.075f); 0.075f);
test.safe_run(); test.safe_run();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment