Quantcast
Channel: OpenCV Q&A Forum - Latest question feed
Viewing all articles
Browse latest Browse all 19555

assertion failure!

$
0
0
Hello,I got error at run time "debug assertion failure" Expression "vector subscription out of range" I debug my code step by step ,I figure out that code crashes at line `Mat final=Images[best];`..... how to solve this? code is..... int main( int argc, char** argv ) { int minHessian=400; char * filename = new char[100]; //to store the current input image Mat input; vectorbowTrain; //To store the keypoints that will be extracted by SURF vector keypoints1,keypoints2; //To store the SURF descriptor of current image Mat descriptor1,descriptor2; //To store all the descriptors that are extracted from all the images. Mat featuresUnclustered; //The SURF feature extractor and descriptor SurfDescriptorExtractor detector(minHessian,4,2,false); //I select 20 (1000/50) images from 1000 images to extract feature descriptors and build the vocabulary for(int f=0;f<2;f++){ //create the file name of an image sprintf(filename,"C:\\harshada\\OpenCV BoFSURF\\Release\\image1\\%i.jpg",f); if(filename==NULL) { printf("Error in reading"); } //open the file input = imread(filename, CV_LOAD_IMAGE_GRAYSCALE); //Load as grayscale //detect feature points detector.detect(input, keypoints1); //compute the descriptors for each keypoint detector.compute(input, keypoints1,descriptor1); bowTrain.push_back(descriptor1); //put the all feature descriptors in a single Mat object featuresUnclustered.push_back(descriptor1); } char * filename2 = new char[100]; sprintf(filename2,"C:\\harshada\\OpenCV BoFSURF\\Release\\image1\\0.jpg"); Mat img=imread(filename2,CV_LOAD_IMAGE_GRAYSCALE); //Mat img=imread("C:\\harshada\\OpenCV BoFSURF\\Release\\image1\\3.jpg",CV_LOAD_IMAGE_GRAYSCALE); detector.detect(img,keypoints2); detector.compute(img,keypoints2,descriptor2); BruteForceMatcher< L2> matcher; std::vector< DMatch > matches; int best=0; vectorImages; double max_dist = 0; double min_dist = 100; for(size_t i=0;i

Viewing all articles
Browse latest Browse all 19555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>