Bonjour à tous,
J'utilise les tutoriaux aux adresses suivantes :
http://opencv.itseez.com/doc/user_gu...eatures2d.html
http://opencv.itseez.com/doc/tutoria...n_matcher.html
Mon code est:
#include <stdio.h>
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
void readme();
/** @function main */
int main()
{
Mat img_1 = imread("monImage.jpg", CV_LOAD_IMAGE_GRAYSCALE);
if( !img_1.data )
{ std::cout<< " --(!) Error reading images " << std::endl; return -1; }
//-- Step 1: Detect the keypoints using SURF Detector
int minHessian = 400;
SurfFeatureDetector detector(minHessian);
std::vector<KeyPoint> keypoints_1;
detector.detect( img_1, keypoints_1 );
//-- Draw keypoints
Mat img_keypoints_1;
drawKeypoints( img_1, keypoints_1, img_keypoints_1, Scalar::all(-1), DrawMatchesFlags:EFAULT );
imshow("Keypoints 1", img_keypoints_1 );
waitKey(0);
readme();
system("pause");
return 0;
}
Mon problème vient de la ligne en rouge. En effet en fonction de la taille de l'image passée en paramètre le programme plante. Et retourne le message d'erreur :
Run-Time Check Failure #2 - Stack around the variable 'keypoints_1' was corrupted.
J'en ai conclu qu'il s'agissait d'un problème d'allocation du vecteur keypoint_1. En debuggant pas à pas, je me suis rendu compte que le programme plantait après le return 0. Surprenant....
Voilà, si quelqu'un avait une idée, cela m'aiderait grandement.
J'utilise visual studio C++ 2010 express et openCV 2.3
D'avance merci.
Partager