Hi,
another question concerning the LineSegmentDetector. I have one image and detect lines in it with the LineSegmentDetector. After that I resize the image and try the same but I get the error:
OpenCV Error: Assertion failed ((unsigned)(pt.x * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels())) in cv::Mat::at, file C:\opencv\opencv-master\modules\core\include\opencv2/core/mat.inl.hpp, line 978
Here is my code:
int main(int argc, char** argv)
{
// Load two images and modify them
Mat img_1, img_2;
img_1 = imread(argv[1], CV_LOAD_IMAGE_GRAYSCALE);
img_2 = imread(argv[2], CV_LOAD_IMAGE_GRAYSCALE);
if (!img_1.data || !img_2.data) {
cout << "Error reading image" << endl;
return EXIT_FAILURE;
}
Mat img_1_half;
vector<Vec4f> lines_1, lines_1_half;
Ptr<LineSegmentDetector> Line_Detector = createLineSegmentDetector();
cout << "First image..." << endl;
Line_Detector->detect(img_1, lines_1);
cout << "Second image..." << endl;
resize(img_1, img_1_half, Size(img_1.rows / 2, img_1.cols / 2));
Line_Detector->detect(img_1_half, lines_1_half);
return 0;
}