Life is a game, take it seriously

Posts Tagged ‘surfmex’

SURFmex bugs

In Computer Vision, Matlab on May 8, 2011 at 9:46 am

written by Gooly

Continuing the last post, I have to mention some bugs in SURFmex that needed to be noticed.

First, be aware of the orientation the SURFPOINTS function give back. It is in a counter clockwise direction, however if you try to plot on Matlab, the column row axis is in the clockwise direction; it is easy to get confused and have the wrong direction. Actually this is one of the mistakes in the surfplot function given by SURFmex under the common folder. Another bug is the degree to radian problem, be aware that the SURFPOINTS function gives the orientation in degree; the surfplot function uses it assuming it is radian instead. Change the surfplot function as follows to correct the bugs.

function surfplot(points,info)

    colorline= {'r-','b-','c-','g-','m-'};
    phi = linspace(0,2*pi);
    x = cos(pi/2 + phi);
    y = sin(pi/2 + phi);
    bbox = [x 0; y 0];

    for k = 1:size(points,2)
        scale = info(1,k);
        ori   = -info(3,k)*pi/180;

        R = [cos(ori) -sin(ori);sin(ori) cos(ori)];

        pbox = scale*R*bbox + points(:,k)*ones(1,size(bbox,2));
        hold on;
        plot(pbox(1,:),pbox(2,:),colorline{mod(k,5)+1});
    end
end

Another bug is an OpenCV bug, an error would occur if you input a pretty flat image which it couldn’t find any interest points. A work around of this is to check if it’s a flat image before calling SURFPOINTS, since if it’s a flat image, you probably wouldn’t want to match it; or you can do a histogram equalization before calling SURFPOINTS, this would solve the problem.

Advertisements