Ask Your Question
5

Does FREAK eat keypoints when it can't find any descriptors?

asked 2012-07-28 08:58:15 -0600

Emre gravatar image

updated 2012-07-28 11:25:55 -0600

I'm using OpenCV 2.4.2 with gcc 4.4.5 on a Debian testing box.

Basically I'm following FREAK sample in freak_demo.cpp with the following snippet:

    detector_.detect(img_, keypoints_);
    ASSERT(keypoints_.size() > 0);  // PASS
    FREAK* freak = new FREAK();
    freak->compute(img_, keypoints_, descriptors_);
    ASSERT(keypoints_.size() > 0); // FAIL
    ASSERT(descriptors_.rows > 0); // FAIL

detector_ is a FeatureDetector and instantiated with a SurfFeatureDetector here. ASSERTs are BOOST_ASSERT macros. I'm testing this with mainly binary images.

The first assertion passes, hence SURF detects some keypoints, but the second assertion fails and in between the only suspect is freak->compute. If I remove the second assertion, the third one also fails. So FREAK does not produce any descriptors_.

It may be related with the type of images I'm using, they are binary word or text line images. I changed the octave size to 2 (from the default 4) and will continue to test with different parameters.

Edit

The problem seems to be related with the parameters of SurfFeatureDescriptor which I set identical with the values in freak_demo.cpp. With default values (i.e. no explicit values in the constructor), FREAK retains some of the keypoints.

I also tested this with varying values for patternScale parameter of FREAK. The initial value is the default.

patternScale: 22 
keypoints.size() before: 118
keypoints.size() after: 5
...
patternScale: 18
keypoints.size() before: 118
keypoints.size() after: 15
...
patternScale: 14
keypoints.size() before: 118
keypoints.size() after: 33
...
patternScale: 8
keypoints.size() before: 118
keypoints.size() after: 82
...

So I think patternScale size should be set according to the image size.

Anyhow I'd not expect keypoints to be zeroed. Is this an expected behavior?

edit retag flag offensive close merge delete

Comments

2

I'm not sure the SURF detector is suited for the FREAK descriptor. When you read the publication, they used mutliscale AGAST (based on FAST). You do not need orientation-enabled detector, because FREAK will calculate the orientation itself.

Michal Kottman gravatar imageMichal Kottman ( 2012-09-20 06:24:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
5

answered 2012-09-18 10:22:41 -0600

jav_rock gravatar image

updated 2012-09-26 06:48:28 -0600

sammy gravatar image

I came across with this comment in the compute code:

/*
 * Compute the descriptors for a set of keypoints in an image.
 * image        The image.
 * keypoints    The input keypoints. 
 *              Keypoints for which a descriptor cannot be computed are removed.
 * descriptors  Copmputed descriptors. Row i is the descriptor for keypoint i.
 */
CV_WRAP void compute( const Mat& image, CV_OUT CV_IN_OUT vector<KeyPoint>& keypoints, 
                   CV_OUT Mat& descriptors ) const;

Pay attention to the line after keypoints. It says keypoints are removed if no descriptor is found. I think this answer the question of why they are zeroed.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-07-28 08:58:15 -0600

Seen: 1,574 times

Last updated: Sep 26 '12