我在我的linux薄膜机上运行openCV中的一些代码,以从我的网络摄像头获取图像并进行一些图像处理。但是,当我运行此代码时,图像似乎已损坏。我一直在我的终端收到此消息,而我的代码正在运行:
Corrupt JPEG data: 1 extraneous bytes before marker 0xd6
Corrupt JPEG data: 1 extraneous bytes before marker 0xd4
Corrupt JPEG data: 2 extraneous bytes before marker 0xd6
Corrupt JPEG data: 2 extraneous bytes before marker 0xd0
Corrupt JPEG data: 1 extraneous bytes before marker 0xd5
Corrupt JPEG data: 2 extraneous bytes before marker 0xd2
Corrupt JPEG data: 1 extraneous bytes before marker 0xd3
代码:
int main()
{
cv::Mat frame;
VideoCapture webcam;
if (!webcam.open(0))
{
cout << "file not opened"<<endl;
waitKey(0);
return EXIT_FAILURE;
}
for(;;)
{
Mat frame;
webcam >> frame;
if( frame.empty() ) break; // end of video stream
imshow("this is you, smile! :)", frame);
if( waitKey(10) == 27 ) break; // stop capturing by pressing ESC
}
}