Ask Your Question
4

BRISK feature detector giving poor results

asked 2013-07-17 18:06:28 -0600

paulheckbert gravatar image

When I try simple tests with OpenCV's BRISK feature detector, I get poor consistency of feature point location and orientation. If I take an image with clear features, and simply translate its pixels (no resampling), I would expect the feature locations and orientations to be translated, but otherwise unchanged, but that's not what I'm finding. Shift-invariant features is part of what the "R" (robust) in the name "BRISK" is supposed to deliver, right?

Below are pictures and source code for a simple test. I created (with Photoshop, and a 15 point Zapf Dingbat font), some nice white features on a black background, in a 200x200 pixel image (image zapf0.png). The features are far from the edges, to eliminate edge effects. You'd expect high contrast, high frequency image details like this to be about the easiest case for a feature detector that you could imagine. I then translated that picture 23 pixels to the left (simulating a stereo pair - also the simplest stereo pair you could imagine -- no noise, no scaling, no rotation, no occluded features..., zapf1.png). RGB pictures with 8 bits per channel.

Then I wrote a little C++ test program that runs BRISK with the default parameter values and visualizes feature point locations and orientations, linked that with OpenCV 2.4.5, and ran it, like so:

brisk_orient zapf0.png zapf0_orient.png; brisk_orient zapf1.png zapf1_orient.png

This program doesn't compute descriptors or do matching; it just does detection, and then visualizes the results. The two generated image files, zapf0_orient.png and zapf1_orient.png:

The results are disappointingly inconsistent. I'd expect these two images to have nearly identical features, except for translation. But if you look at the two squares and the two triangles, only about 2 out of 8 features match, in terms of position and orientation. I tried other parameter values for threshold and octaves and got similarly bad results.

My question: is this an unavoidable weakness of BRISK, a bug in OpenCV's implementation of BRISK, or a result of not using the right parameter settings and inputs to BRISK?

Have others encountered this weakness of BRISK?

thanks -Paul

the two input images:

the C++ source code, brisk_orient.cpp (also available via pastebin)


// read an RGB picture file, run BRISK feature detector on it
// create a picture of the feature points with their orientations, and write it out

#include <iostream>
#include <stdlib.h>

#include <opencv2/core/core.hpp>              // for cv::Mat
#include <opencv2/features2d/features2d.hpp>  // for cv::BRISK
#include <opencv2/highgui/highgui.hpp>        // for cv::imread

static void draw_dot(cv::Mat &pic, float x, float y, int radius, const cv::Vec3b &color) {
  int x0 = floor(x+.5);
  int y0 = floor(y+.5);
  assert(pic.type()==CV_8UC3);
  for (int y=y0-radius; y<=y0+radius; y++) {
    for (int x=x0-radius; x<=x0+radius; x++) {
      if (x>=0 && y>=0 && x<pic.cols && y<pic.rows)
        pic.at<cv::Vec3b>(y, x) = color;
    }
  }
}

static void draw_line_segment(cv::Mat &pic, float ...
(more)
edit retag flag offensive close merge delete

Comments

1

I find that too. BRISK works pretty bad on OpenCV

yes123 gravatar imageyes123 ( 2013-10-03 20:11:42 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
3

answered 2013-07-18 02:03:36 -0600

SR gravatar image

updated 2013-07-18 02:35:37 -0600

Good question. That doesn't seem like a weakness, it seems like a bug.

AFAIK BRISK is not a randomized algorithm per se so it should give deterministic results for identical input. Can you at least reproduce the same output for giving it repeatedly the same input?

Update: I can confirm this behaviour. It does not appear with the original BRISK code and the output of that looks entirely different. Once again, the OpenCV devs have broken the original code when adding it to OpenCV. sigh

Please file a bug report.

edit flag offensive delete link more

Comments

I found what looks like a related bug at http://code.opencv.org/issues/2491 so I added my notes & code there.

paulheckbert gravatar imagepaulheckbert ( 2013-07-22 13:02:05 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2013-07-17 18:06:28 -0600

Seen: 2,888 times

Last updated: Jul 18 '13