简体   繁体   English

testcamcalib.exe 中 0x01221316 处未处理的异常:0xC0000005:访问冲突读取位置 0x00cf6000

[英]Unhandled exception at 0x01221316 in testcamcalib.exe: 0xC0000005: Access violation reading location 0x00cf6000

I am trying to trace lines using two cameras.我正在尝试使用两个摄像头追踪线条。 Everything works fine until Canny Edge detection.一切正常,直到 Canny Edge 检测。

After Canny the program shows an error of memory location the same as in my title saying:Canny之后,程序显示了一个与我的标题相同的内存位置错误说:

Unhandled exception at 0x01221316 in testcamcalib.exe: 0xC0000005: Access violation reading location 0x00cf6000. testcamcalib.exe 中 0x01221316 处未处理的异常:0xC0000005:访问冲突读取位置 0x00cf6000。

The pointer points at:指针指向:

float rho = lines[i][0], theta = lines[i][1];

This is my code:这是我的代码:

int main()
{
//initializing camera and allocate memory to load the video stream from camera 
cv::VideoCapture camera0(1);
cv::VideoCapture camera1(0);

if( !camera0.isOpened() ) return 1;
if( !camera1.isOpened() ) return 1;

while(true) {
    //capture and retrieve each frames of the video sequentially, one frame at time will be displayed 
    // capture from 1st camera
    Mat edges0, edges1, dst0, dst1, cdst0, cdst1;
    cv::Mat3b frame0;
    camera0 >> frame0;
    // Performing edge detection on camera 1
    cvtColor(frame0, edges0, CV_BGR2GRAY);
        GaussianBlur(edges0, edges0, Size(7,7), 1.5, 1.5);
    Canny(edges0, dst0, 0, 30, 3);
     vector<Vec2f> lines;
    // detect lines
    HoughLines(dst0, lines, 1, CV_PI/180, 150, 0, 0 );

    // draw lines
    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( cdst0, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
    }

    //capturing frames from second camera
    cv::Mat3b frame1;
    camera1 >> frame1;
    // performing edge detection on camera 2
    cvtColor(frame1, edges1, CV_BGR2GRAY);
    GaussianBlur(edges1, edges1, Size(7,7), 1.5, 1.5);
    Canny(edges1, dst1, 0, 30, 3);
    // detect lines
    HoughLines(dst1, lines, 1, CV_PI/180, 150, 0, 0 );

    // draw lines
    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( cdst1, pt1, pt2, Scalar(0,0,255), 3, CV_AA);
    }


    cv::imshow("edges0", cdst0);
    cv::imshow("edges1", cdst1);

    //wait for 40 milliseconds
    int c = cvWaitKey(30);

    //exit the loop if user press "Esif(27 == char(c)) breakc" key  (ASCII value of "Esc" is 27) 
    ;
}

return 0;
} 

You can try to debug your code.您可以尝试调试您的代码。 Maybe there is a problem with the second dimension of lines .也许lines的第二维有问题。 lines[i][0] or lines[i][1] could be not valid. lines[i][0]lines[i][1]可能无效。 You can put this two statements in separate lines and debug it to know more about the problem.您可以将这两个语句放在单独的行中并对其进行调试以了解有关问题的更多信息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 tester.exe中0x00b21840处未处理的异常:0xC0000005:访问冲突读取位置0x00000000 - Unhandled exception at 0x00b21840 in tester.exe: 0xC0000005: Access violation reading location 0x00000000 Project3.exe中0x00C61540的未处理异常:0xC0000005:访问冲突读取位置0x00000003 - Unhandled exception at 0x00C61540 in Project3.exe: 0xC0000005: Access violation reading location 0x00000003 …中的0x00C87963处未处理的异常:0xC0000005:访问冲突读取位置0xCCCCCCE0 - Unhandled exception at 0x00C87963 in …: 0xC0000005: Access violation reading location 0xCCCCCCE0 模拟Clock.exe中0x00BF57F9处未处理的异常:0xC0000005:访问冲突读取位置0x00000000 - Unhandled exception at 0x00BF57F9 in Analog Clock.exe: 0xC0000005: Access violation reading location 0x00000000 opencv_helloworld.exe中0x778715de处的未处理异常:0xC0000005:访问冲突读取位置0x00000004 - Unhandled exception at 0x778715de in opencv_helloworld.exe: 0xC0000005: Access violation reading location 0x00000004 NVIDIA未处理的异常,位于0x002a2da2中 <work.exe> 0xC0000005:访问冲突读取位置0x00000000 - NVIDIA Unhandled exception at 0x002a2da2 in <work.exe>0xC0000005: Access violation reading location 0x00000000 向量:AccountServer.exe中0x00066314处未处理的异常:0xC0000005:访问冲突读取位置0xccccccd0 - Vector: Unhandled exception at 0x00066314 in AccountServer.exe: 0xC0000005: Access violation reading location 0xccccccd0 program.exe中0x010F2F1C处未处理的异常:0xC0000005:访问冲突读取位置0xCCCCCCD0 - Unhandled exception at 0x010F2F1C in program.exe: 0xC0000005: Access violation reading location 0xCCCCCCD0 new_srdProg_d.exe中0x0040224d处未处理的异常:0xC0000005:访问冲突读取位置0xcdcdcdd1 - Unhandled exception at 0x0040224d in new_srdProg_d.exe: 0xC0000005: Access violation reading location 0xcdcdcdd1 LAB_3.exe 中 0x00898809 处的未处理异常:0xC0000005:访问冲突读取位置 0xCCCCCCF4。 发生了 - Unhandled exception at 0x00898809 in LAB_3.exe: 0xC0000005: Access violation reading location 0xCCCCCCF4. occurred
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM