Ask Your Question

Revision history [back]

HoughLinesP segmentation Fault

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;
        }
        else
        {
            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.