Fast feature detect

asked 2015-12-09 04:49:02 -0500

uavcamera gravatar image

updated 2015-12-09 21:28:03 -0500

Hi,

i have a gStreamer Pipeline and output the Frames to my application via an appsink.

cv::Mat frame = cv::Mat(cv::Size(720, 405), CV_8UC3, (char*)map.data, cv::Mat::AUTO_STEP);
    cv::Mat frame_gray;
    if (frame.channels() > 1) {
        cv::cvtColor(frame, frame_gray, CV_BGR2GRAY);
    } else {
        frame_gray = frame;
    }

the map.data is 874.800 bytes. the format seems to be right. i pass the frame_gray to my algorithm:

             cv::Rect rect = Rect(250,250,pipeCtrl->displayData->getSelectionRectWidth(),pipeCtrl->displayData->getSelectionRectHeight());
            pipeCtrl->algo.consensus.estimate_scale = false;
            pipeCtrl->algo.consensus.estimate_rotation = true;
            pipeCtrl->algo.initialize(frame_gray, rect);

there i try to use the fast feature detector.

 void algo::initialize(const Mat im_gray, const Rect rect) {

     imshow( "Display window", im_gray );

    detector = cv::FastFeatureDetector::create();
    descriptor = cv::BRISK::create();
    vector<KeyPoint> keypoints;   
    detector->detect(im_gray, keypoints);
    [whatever...]
}

the imshow works fine. i can see the scaled (720x405 px) gray scale image. but the fast festure detector finds ~4.2 billion features in the image, at least that is what keypoints.size() returns after the fast algorithm runs.

The algorithm works fine if i use VideoCapture and a webcam as input using the same grayscale conversion. so i think it might be a problem with the data i get from the gStreamer app sink. but that seems to be ok. (imshow works on the not grayscale image too)

Do i miss something? Is there a way to debug the input to the fast feature detect without messing around with the source code?

Hava a nice day!

[edit]

it seems to be a general problem. if i load a picture from the harddisk and try to use it with the fast detector -> same 4 billion features.

i am using opencv inside an QT5.5 application and it think that is the problem. but don't know what exactly goes wrong :/

edit retag flag offensive close merge delete

Comments

How big is your image? Have you tried to eliminate the noise first?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-09 04:56:37 -0500 )edit

291.600 px -> 720x405

even if there is a lot of noise how can it find 4 billion features?

uavcamera gravatar imageuavcamera ( 2015-12-09 18:03:54 -0500 )edit

4 bilion features???? Are you sure your keypoints vector is not empty?

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-10 02:36:20 -0500 )edit

4 bil. is what vector.size() returns after running the fast detect. more precise: thats the output. but the application seems to crash in another thread and then displaying bullshit for the debugging output. i am not sure about anything right now :/

something goes terribly wrong inside the fast detector algorithm for some, to me, unknown reason. compiling without any IPP/SSE/TBB features right now to hopefully get a single point of failure

[edit]

its not a problem of the fast detector. agast fails too :/

[edit2] have a look at this:

http://postimg.org/image/7nzkh1tj5/

thats totally weired. these values are not right.. not at all.

uavcamera gravatar imageuavcamera ( 2015-12-10 21:04:53 -0500 )edit

It seems like undefined... some strange memory values (not initialized), or empty keypoints vector. How does your image look like? Have you tried to check if the vector is not empty after detection? Try if (keypoints.empty()) { std::cout << "empty" << std::endl; exit(-5); }. I am pretty sure your problem is there somewhere.

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-12-11 06:56:52 -0500 )edit
1

problem solved. used the non debug libraries in a project compiled with debug flags. that why some of the algorithms fail.

uavcamera gravatar imageuavcamera ( 2015-12-22 03:53:34 -0500 )edit