testcamcali.exe中0x01221316处未处理的异常:0xC0000005:读取位置0x00cf6000时
Unhandled exception at 0x01221316 in testcamcalib.exe: 0xC0000005: Access violation reading location 0x00cf6000
我正试图用两台相机来追踪线条。在Canny Edge检测之前,一切都很好。
Canny
之后,程序显示内存位置错误,与我的标题中相同:
testcamcali.exe中0x01221316处未处理的异常:0xC0000005:读取位置0x00cf6000时发生访问冲突。
指针指向:
float rho = lines[i][0], theta = lines[i][1];
这是我的代码:
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;
}
您可以尝试调试代码。也许CCD_ 2的第二维度存在问题。lines[i][0]
或lines[i][1]
可能无效。您可以将这两条语句放在不同的行中,并对其进行调试以了解更多有关该问题的信息。
相关文章:
- 0xC0000005:访问冲突读取位置 0x00000000. 重载 == 运算符的问题
- (此函数用于计算 SMA).在 FA.exe 中0x00509159引发异常: 0xC0000005:访问冲突读取位置0
- 0xC0000005:读取位置0xCDCDCDC1时发生访问冲突
- 0xC0000005:读取位置0xCDCDCDCD时发生访问冲突
- 0x0F50DF58:0xC0000005:访问冲突读取位置0x0047CA04时未处理的异常
- 0xC0000005:访问冲突读取位置0x0000000000000008
- OPENCV.3.0错误:0xc0000005:访问违规读取位置0x00000000
- 功能.exe:0xc0000005:访问违规读取地点0x0000000000000000
- 实验室中0x6BE20E11 (ucrtbased.dll) 的未处理异常.exe: 0xC0000005:访问冲突读取
- 0xC0000005:访问冲突读取位置0x0000000000000000.C++
- 0xC0000005:读取位置0xccccccc0的访问冲突
- opencv_helloworld.exe中0x778715de处未处理的异常:0xC0000005:读取位置0x000
- ..中0x00C87963处出现未处理的异常:0xC0000005:读取位置0xCCCCCCE0时发生访问冲突
- application.exe中0x0872340b(CAN.dll)处未处理的异常:0xC0000005:读取位置0x
- C++:xxx中0x00101890处未处理的异常:0xC0000005:读取位置0xcccccccc的访问冲突
- 0xC0000005:读取位置0x00000000时发生访问冲突.c++vs2015
- 运算符重载实现:0xC0000005:读取位置存在访问冲突
- testcamcali.exe中0x01221316处未处理的异常:0xC0000005:读取位置0x00cf6000时
- 0xC0000005:读取Integer的位置时发生访问冲突
- 矢量:AccountServer.exe中0x00066314处未处理的异常:0xC0000005:读取位置0xcccc