2014-09-30 14:56:00 -0500 commented question HoughLines Debug Assertion Failed Sorry for my late reply... I was using vs2008, but also have vs2013 installed and wanted to see if maybe I setup something wrong under vs2008. I used this setup tutorial: http://www.youtube.com/watch?v=vwhTKsvHwfQ to setup my project. Now when I run the program, I am able to get through the program and display the images to the screen (including the lines produced from the houghline function), however, when I press a key (to exit the program) I get a "Windows has triggered a breakpoint in test.exe". If I comment out the houghlines function call then I don't get this problem. I found a person with the same exact problem as me at this link: http://stackoverflow.com/questions/19169560/hough-line-transform-on-live-video-causes-breakpoint. Does anyone have any suggestions to fix this? 2014-09-08 14:55:06 -0500 asked a question HoughLines Debug Assertion Failed Good Evening, I have an application where I need to detect straight line segments within an image. It is my understanding that the "HoughLines" function would be the right function to be used to achieve this. I found an example at the following link: Here is a copy of the exact code I'm using: #include #include #include #include #include using namespace cv; using namespace std; int main( int argc, char** argv ) { Mat src = cvLoadImage("Untitled.png", 0); if(src.empty()) { cout << "can't open file" << endl; return -1; } Mat dst; Canny(src, dst, 50, 200, 3); Mat cdst; cvtColor(dst, cdst, CV_GRAY2BGR); vector lines; HoughLines(dst, lines, 1, CV_PI/180, 100, 0, 0 ); for( size_t i = 0; i < lines.size(); i++ ) { float rho = lines[i][0], theta = lines[i][1]; Point pt1, pt2; double a = cos(theta), b = sin(theta); double x0 = a*rho, y0 = b*rho; pt1.x = cvRound(x0 + 1000*(-b)); pt1.y = cvRound(y0 + 1000*(a)); pt2.x = cvRound(x0 - 1000*(-b)); pt2.y = cvRound(y0 - 1000*(a)); line( cdst, pt1, pt2, Scalar(0,0,255), 3, CV_AA); } imshow("source", src); imshow("detected lines", cdst); waitKey(); return 0; }  When I run this code I'm thrown the following: "Debug Assertion Failed! Program: c:\Projects\OtherFiles\TestOpenCV\Debug\TestOpenCV.exe File: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\vector Line: 157 Expression: vector iterator + offset out of range I've been searching for the solution to this for a number of days now and can't seem to find anyone else with my exact same problem, otherwise I would not have posted to a forum. If anyone could provide me with a solution to this problem or could direct me to another forum post with some more help then I would very much appreciate it. By the way, this is being written in Microsoft Visual Studio 2008 Professional Edition on a Windows 7 machine. Thanks, Stanton