1

I am writing an iPhone app to use OpenCV to detect the 2D location in the iPhone camera of some sort of predefined marker (only one). What is the best type of marker? Circle? Square? Color? What is the fastest way to detect that marker? In addition, the detection algorithm needs to run near real-time.

I have tried openCV's circle detection but I got 1 fps (640x480 image):

Mat gray;
vector<Vec3f> circles;

CGPoint findLargestCircle(IplImage *image) {
    Mat img(image);
    cvtColor(img, gray, CV_BGR2GRAY);
    // smooth it, otherwise a lot of false circles may be detected
    GaussianBlur( gray, gray, cv::Size(9, 9), 2, 2 );
    HoughCircles(gray, circles, CV_HOUGH_GRADIENT,
                             2, gray.rows/4, 200, 100 );
    double radius=-1;
    size_t ind;
    for( size_t i = 0; i < circles.size(); i++ ) {
        if(circles[i][2] > radius) {
            radius = circles[i][2];
            ind = i;
        }
    }
    if(ind == -1) {
        return CGPointMake(0, 0);
    }else {
        return CGPointMake(circles[ind][0], circles[ind][1]);
    }
}

Any advice or code would be helpful.

Thanks in advance.

cduck
  • 2,641
  • 6
  • 27
  • 35

1 Answers1

0

Maybe you can try some specific colored marker, then take color filtering into consideration. Another, the object with specific oriented texture is a good choice too.

Browny Lin
  • 2,071
  • 1
  • 23
  • 32
  • For color filtering, you would refer to 'cvInRangeS' function. For orientation detection, you would refer to [the thread](http://stackoverflow.com/questions/279410/opencv-object-detection-center-point) – Browny Lin Mar 19 '11 at 02:17