c++ - Blurring images of an image pyramid - Vector subscript out of range -
i trying load image, calculate image pyramid (save every image) , blur every single image of pyramid opencv 3.2 in c++. when run program receive error:
vector line:1740 expression: vector subscript out of range
here code:
#include "stdafx.h" #include <opencv2/highgui/highgui.hpp> #include <opencv2/xfeatures2d.hpp> #include <iostream> #include <opencv2/shape/shape.hpp> using namespace std; using namespace cv; using namespace cv::xfeatures2d; int main(int argc, char** argv) { // read image mat img_1; img_1 = imread(argv[1], cv_load_image_grayscale); // build image pyramid , save in vector of mat vector<mat> img_1_pyramid; int pyramid_octaves = 3; buildpyramid(img_1, img_1_pyramid, pyramid_octaves); /* void cv::buildpyramid (inputarray src, outputarrayofarrays dst, int maxlevel, int bordertype = border_default) */ // initialize parameters first image pyramid vector<mat> reduced_noise_1; blur(img_1_pyramid[0], reduced_noise_1[0], size(3,3)); /* void cv::blur (inputarray src, outputarray dst, size ksize, point anchor=point(-1,-1), int bordertype=border_default)*/ return 0; }
i tried mat object: mat reduced_noise_1;
or vector of predefined size vector<mat> reduced_noise(4);
and can draw img_1_pyramid[0]
imshow
, receive right image...
when debug program receive error in line 621 of cvstd.hpp:
string::string(const char* s) : cstr_(0), len_(0) { if (!s) return; size_t len = strlen(s); // here appears error (only in german;)) memcpy(allocate(len), s, len); }
Comments
Post a Comment