I am trying to implement a code in c++ using opencv 2.4.10 that calculates frame's keypoints with ORB. When I run the code in VS community 2015 it gives me the assertion:
Program: ...l Studio 2015\Projects\lbplibrary-master\x64\Debug\prova1.exe File: c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0 Line: 106
Expression: "(_Ptr_user & (_BIG_ALLOCATION_ALIGNMENT - 1)) == 0" && 0
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
This is the code I am compiling. The execution works and it does the job but at the end I get the assertion!
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <string>
#include <fstream>
#include <opencv2/opencv.hpp>
#include "stdafx.h"
using namespace cv;
using namespace std;
using namespace lbplibrary;
static bool isFileExist(const String& filename)
{
/// Open the file
FILE* f = fopen(filename.c_str(), "rb");
/// in the event of a failure, return false
if (!f)
return false;
fclose(f);
return true;
}
string intToStr(int i, string path) {
string bla = "";
stringstream ss;
ss << i;
string ret = "";
ss >> ret;
string name = bla.substr(0, bla.size() - ret.size());
name = path + name + ret;
return name;
}
int main(int argc, const char **argv)
{
//keyframe
string current_window = "Current frame ";
Mat Current;
//keypoints
vector<KeyPoint> kp;
Ptr<ORB> detector = FeatureDetector::create("ORB");
fstream outputFile;
//elaborate keyframes
for (int i = 0; i< 178; i++)
{
//read and show keyframe
string Curr_name = intToStr(i, "dataset/backyard-seq/map/frame");
Current = imread(Curr_name + ".jpg", 1);
namedWindow(current_window, WINDOW_AUTOSIZE);
imshow(current_window, Current);
//calculate frame keypoints
detector->detect(Current, kp);
//save keypoints of each keyframe in txt
if (!isFileExist(Curr_name + ".txt"))
{
outputFile.open(Curr_name + ".txt", ios::out);
for (size_t ii = 0; ii < kp.size(); ++ii)
outputFile << kp[ii].pt.x << " " << kp[ii].pt.y << std::endl;
outputFile.close();
}
//draw and show keypoints
Mat out;
drawKeypoints(Current, kp, out, Scalar::all(255));
imshow("Keypoints", out);
}
return 0;
}
mainhas exited? - slawekwin