zoukankan      html  css  js  c++  java
  • opencv测试代码

    摄像头摄影

    #include <iostream>
    #include <opencv2/opencv.hpp>
    using namespace cv;
    using namespace std;
    int main()
    {
            Mat input_image;
            VideoCapture cam(0);
            if (!cam.isOpened()) exit(0);
            Size s(320, 240);
            VideoWriter writer = VideoWriter("myvideo.avi", CV_FOURCC('M', 'J', 'P', 'G'), 25, s);
            if (!writer.isOpened())
            {
                    cout << "cannot create a file. " << endl;
                    return -1;
            }

            namedWindow("input image");
            while (true) {
                    cam >> input_image;
                    //WriteFrame(writer, outimage)
    //                cvWriteFrame(writer, input_image);
                    imshow("input image", input_image);
    //                writer << input_image;
                    if (27 == waitKey(30))
                            break;
            }
            
    }

  • 相关阅读:
    cz_health_day07
    cz_health_day06
    mysql索引底层原理
    cz_health_day05
    redis无法获取连接原因分析
    cz_health_day04
    cz_health_day03
    cz_health_day02
    cz_health_day01
    Spring学习
  • 原文地址:https://www.cnblogs.com/guohaoyu110/p/6607188.html
Copyright © 2011-2022 走看看