HoughLinesP segmentation Fault

asked 2014-05-21 05:26:56 -0500

Pulsar gravatar image

Hi, im using the HoughLinesP function in a c++ project to recognize lines. I'm new to open cv and followed the tutorials but I can't seem to get the function working properly, running my code leads to a segmentation fault.

I initialize my matrix as such:

cv::Mat Binary(2048,2048,CV_8UC1);
for (int i = 0 ; i<2048; i++){
    for (int j = 0 ; j<2048; j++){
        if (indexAtProcessed(i,j)==100){
            Binary.at<int>(i,j) = (uchar)255;
            Binary.at<int>(i,j) = (uchar)0;

And for my output vector lines3 I use:

std::vector<cv::Vec4i> lines3;

Now using the function:

cv::HoughLinesP(Binary,lines3, 1, 0.1, 80, 30, 10 );

I reckon the problem must be in my matrix, but I have no idea what could be wrong.

Any help would be greatly appreciated.

edit retag flag offensive close merge delete



cv::Mat Binary(2048,2048,CV_8UC1); // uchar mat. if you want int, use CV_32SC1

Binary.at<int>(i,j) = (uchar)255; // int access. for a uchar mat use at<uchar>()

berak gravatar imageberak ( 2014-05-21 07:07:24 -0500 )edit