在做一个opencv电脑摄像头获取图像时候,出现这个问题,请问是为什么?
intmain(){VideoCapturecap(0);if(!cap.isOpened()){return-1;}Matframe;Matedges;boolstop...
int main()
{
VideoCapture cap(0);
if(!cap.isOpened())
{
return -1;
}
Mat frame;
Mat edges;
bool stop = false;
while(!stop)
{
cap>>frame;
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("当前视频",edges);
if(waitKey(30) >=0)
stop = true;
}
return 0;
} 展开
{
VideoCapture cap(0);
if(!cap.isOpened())
{
return -1;
}
Mat frame;
Mat edges;
bool stop = false;
while(!stop)
{
cap>>frame;
cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
imshow("当前视频",edges);
if(waitKey(30) >=0)
stop = true;
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询