Opencv 在open CV2.4.9和visual 2013中捕获并保存图像
我尝试在下面的代码中使用带有openCV的照相机捕获单个图像并保存它。我使用F10按钮逐步运行此代码并保存图像,但当我在调试模式下运行时,它会显示代码中键入的错误,请告诉我解决方案和发生此情况的原因Opencv 在open CV2.4.9和visual 2013中捕获并保存图像,opencv,Opencv,我尝试在下面的代码中使用带有openCV的照相机捕获单个图像并保存它。我使用F10按钮逐步运行此代码并保存图像,但当我在调试模式下运行时,它会显示代码中键入的错误,请告诉我解决方案和发生此情况的原因 #include <opencv\cv.h> #include <opencv\highgui.h> #include <time.h> using namespace cv; using namespace std; int main() { // C
#include <opencv\cv.h>
#include <opencv\highgui.h>
#include <time.h>
using namespace cv;
using namespace std;
int main()
{
// Capture the Image from the webcam
VideoCapture cap(0);
// Get the frame
Mat save_img;
while (1)
{
cap >> save_img;
time_t start_time, cur_time;
time(&start_time);
do
{
time(&cur_time);
} while ((cur_time - start_time) < 5);
if (save_img.empty())
{
std::cerr << "Something is wrong with the webcam, could not get frame." << std::endl;
}
// Save the frame into a file
imwrite("test.jpg", save_img);
char c = cvWaitKey(30);
if (c == 27) break;
}
return 0;
}
这里请详细说明一下?您看到了什么错误?请,我们需要查看您的代码和确切的错误消息。