Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Opencv 在open CV2.4.9和visual 2013中捕获并保存图像_Opencv - Fatal编程技术网

Opencv 在open CV2.4.9和visual 2013中捕获并保存图像

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

我尝试在下面的代码中使用带有openCV的照相机捕获单个图像并保存它。我使用F10按钮逐步运行此代码并保存图像,但当我在调试模式下运行时,它会显示代码中键入的错误,请告诉我解决方案和发生此情况的原因

#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;
}

这里

请详细说明一下?您看到了什么错误?请,我们需要查看您的代码和确切的错误消息。