B.Kosmowski
B.Kosmowski

Reputation: 143

FAST function OpenCV Debug Assertion Faild

when I try debug my project, I get Debug Assertion Failed, at the end of the execution up. You can see it below.

Debug Assertion Filed

I think that the problem is related to FAST function from OpenCV, because when I comment out the line which contains this function, it works fine.

This is my code:

#pragma once
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main()
{
    string table[2] = { "background_2.jpg","foreground_2.jpg" };
    Mat firstImage = imread(table[0], IMREAD_COLOR);
    Mat secondImage = imread(table[1], IMREAD_COLOR);
    Mat result;
    subtract(firstImage, secondImage, result);
    Mat resultGray, firstImageGray, secondImageGray;

    cvtColor(firstImage, firstImageGray, COLOR_BGR2GRAY);
    cvtColor(secondImage, secondImageGray, COLOR_BGR2GRAY);
    cvtColor(result, resultGray, COLOR_BGR2GRAY);

    Canny(firstImageGray, firstImageGray, 33, 100, 3);
    Canny(secondImageGray, secondImageGray, 33, 100, 3);
    Canny(resultGray, resultGray, 33, 100, 3);


    vector <KeyPoint> keyPoints;
    FAST(resultGray, keyPoints, 9, true);//Probably here is the problem.
    Mat resultKeyPoints;
    drawKeypoints(resultGray, keyPoints, resultKeyPoints, 156);

    return 0;
}

I build my project in Visual Studio 2015 Preview.

When I clicked "Retry" to break at that assertion, I got the following exception:

Unhandled exception at 0x00007FF851891B4B (ucrtbased.dll) in 

OpenCVProject.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.

This is in xmemory0 file from VS in 120 line.

Upvotes: 0

Views: 318

Answers (1)

B.Kosmowski
B.Kosmowski

Reputation: 143

I found the answer. I changed in Property Pages in my project Platform Toolset from Visual Studio 2015 (v140) to Visual Studio 2013 (v120). Now it works fine. It seems that the problem wasn't in FAST function, but in this case, that I use VS 2015 with OpenCV 3.0. @drescherjm thank you for help me do this.

Upvotes: 2

Related Questions