Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ORB assertion failed with OpenCV 3.0.0

Hi there, I'm trying to use ORB points of interest to try to retrieve an object into an image (compute points of interest; then associated descriptors and finally try to see if we can pair them and retrieve a transformation).

Here is a part of the code I use :

Ptr<cv::orb> descriptor_ORB;

Mat model = imread(filename); //string filename -> the name of an image file std::vector<keypoint> keypoints_model; cout << "size model : " << model.cols << "\t" << models.rows << endl; //display 123 and 62 -> successfully load Mat gray_model = model; cvtColor(gray_model, gray_model, COLOR_BGR2GRAY); // convert to grayscale as in examples descriptor_ORB -> detect (gray_model, keypoints_model); // compute ORB points of interest on grayscale image and put the points in the keypoints_model vector

This last line gives me an assertion failure : OpenCV Error : Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x +roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file Matrix.cpp, line 499

Is it normal ? It is likely that the detect function is unable to retrieve any points of interest...

To avoid early, termination I put the detect call in a try/catch statement.

click to hide/show revision 2
No.2 Revision

updated 2017-01-19 08:09:59 -0600

berak gravatar image

ORB assertion failed with OpenCV 3.0.0

Hi there, I'm trying to use ORB points of interest to try to retrieve an object into an image (compute points of interest; then associated descriptors and finally try to see if we can pair them and retrieve a transformation).

Here is a part of the code I use :

Ptr<cv::orb> descriptor_ORB;

Ptr<cv::ORB> descriptor_ORB;

Mat model = imread(filename); //string filename -> the name of an image file
std::vector<keypoint> std::vector<KeyPoint> keypoints_model;
cout << "size model : " << model.cols << "\t" << models.rows << endl; //display 123 and 62 -> successfully load
Mat gray_model = model;
cvtColor(gray_model, gray_model, COLOR_BGR2GRAY); // convert to grayscale as in examples
descriptor_ORB -> detect (gray_model, keypoints_model); // compute ORB points of interest on grayscale image and put the points in the keypoints_model vector

vector

This last line gives me an assertion failure : :

OpenCV Error : Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x +roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file Matrix.cpp, line 499

499

Is it normal ? It is likely that the detect function is unable to retrieve any points of interest...

To avoid early, termination I put the detect call in a try/catch statement.

ORB assertion failed with OpenCV 3.0.0

Hi there, I'm trying to use ORB points of interest to try to retrieve an object into an image (compute points of interest; then associated descriptors and finally try to see if we can pair them and retrieve a transformation).

Here is a part of the code I use :

Ptr<cv::ORB> descriptor_ORB;

Mat model = imread(filename); //string filename -> the name of an image file
std::vector<KeyPoint> keypoints_model;
cout << "size model : " << model.cols << "\t" << models.rows << endl; //display 123 and 62 -> successfully load
Mat gray_model = model;
cvtColor(gray_model, gray_model, COLOR_BGR2GRAY); // convert to grayscale as in examples
descriptor_ORB -> detect (gray_model, keypoints_model); // compute ORB points of interest on grayscale image and put the points in the keypoints_model vector

This last line gives me an assertion failure :

OpenCV Error : Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x +roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file Matrix.cpp, line 499

Is it normal ? It is likely that the detect function is unable to retrieve any points of interest...

To avoid early, termination I put the detect call in a try/catch statement.

ORB assertion failed with OpenCV 3.0.0

Hi there, I'm trying to use ORB points of interest to try to retrieve an object into an image (compute points of interest; then associated descriptors and finally try to see if we can pair them and retrieve a transformation).

Here is a part of the code I use :

Ptr<cv::ORB> descriptor_ORB;
descriptor_ORB = cv::ORB::create(/*some values from a configuration file with atoi() and atof() to format values*/);

Mat model = imread(filename); //string filename -> the name of an image file
std::vector<KeyPoint> keypoints_model;
cout << "size model : " << model.cols << "\t" << models.rows << endl; //display 123 and 62 -> successfully load
Mat gray_model = model;
cvtColor(gray_model, gray_model, COLOR_BGR2GRAY); // convert to grayscale as in examples
descriptor_ORB -> detect (gray_model, keypoints_model); // compute ORB points of interest on grayscale image and put the points in the keypoints_model vector

This last line gives me an assertion failure :

OpenCV Error : Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x +roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in Mat, file Matrix.cpp, line 499

Is it normal ? It is likely that the detect function is unable to retrieve any points of interest...

To avoid early, termination I put the detect call in a try/catch statement.