欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

opencv闲篇(基于opencv的gpu硬解码)

程序员文章站 2022-07-14 18:26:12
...

opencv2.4.9的lib链接库

realse

opencv_calib3d249.lib
opencv_contrib249.lib
opencv_core249.lib
opencv_features2d249.lib
opencv_flann249.lib
opencv_gpu249.lib
opencv_highgui249.lib
opencv_imgproc249.lib
opencv_legacy249.lib
opencv_ml249.lib
opencv_nonfree249.lib
opencv_objdetect249.lib
opencv_ocl249.lib
opencv_photo249.lib
opencv_stitching249.lib
opencv_superres249.lib
opencv_ts249.lib
opencv_video249.lib
opencv_videostab249.lib

debug 

opencv_calib3d249d.lib
opencv_contrib249d.lib
opencv_core249d.lib
opencv_features2d249d.lib
opencv_flann249d.lib
opencv_gpu249d.lib
opencv_highgui249d.lib
opencv_imgproc249d.lib
opencv_legacy249d.lib
opencv_ml249d.lib
opencv_nonfree249d.lib
opencv_objdetect249d.lib
opencv_ocl249d.lib
opencv_photo249d.lib
opencv_stitching249d.lib
opencv_superres249d.lib
opencv_ts249d.lib
opencv_video249d.lib
opencv_videostab249d.lib

opencv的单击获取图片代码

#include<iostream>
#include<opencv.hpp>
using namespace std;
using namespace cv;

//全局函数的声明
Mat frame, left_image, right_image;
void on_MouseHandle(int event, int x, int y, int flags, void *param);
char imageFileName[100];
#define FrameNumber 15
int n = 1;
int m = 1;

int main()
{
    VideoCapture cap(0);
    if (!cap.isOpened())
        return -1;
    // Set the video resolution to HD720 (2560*720)
    cap.set(CV_CAP_PROP_FRAME_WIDTH, 640);
    cap.set(CV_CAP_PROP_FRAME_HEIGHT, 480);
    for (;;)
    {
        // Get a new frame from camera
        cap >> frame;
        // Extract left and right images from side-by-side
        left_image = frame(cv::Rect(0, 0, frame.cols / 2, frame.rows));
        right_image = frame(cv::Rect(frame.cols / 2, 0, frame.cols / 2, frame.rows));
        // Display images    
        //imshow("frame", frame);

        imshow("left", left_image);
        setMouseCallback("left", on_MouseHandle, (void *)&left_image);


        imshow("right", right_image);
        setMouseCallback("right", on_MouseHandle, (void *)&right_image);

        if (waitKey(30) >= 0) break;
    }
    return 0;
}
void on_MouseHandle(int event, int x, int y, int flags, void* param)
{
    Mat& image = *(Mat*)param;

    switch (event)
    {
    case EVENT_LBUTTONDOWN:
    {
        if (m < FrameNumber)
        {
            sprintf_s(imageFileName, "G:\\C++实践指导程序\\UVC捕获\\UVC捕获\\left%d.jpg", m);
            imwrite(imageFileName, image);
            printf("第%d的左相机图片已经完成获取\n", m);
            m++;
        }
        else
        {
            cout << "已经超出采集的最大数量" << endl;
            m = 1;
        }

    }
    break;
    case EVENT_RBUTTONDOWN:
    {
        if (n < FrameNumber)
        {
            sprintf_s(imageFileName, "G:\\C++实践指导程序\\UVC捕获\\UVC捕获\\right%d.jpg", n);
            imwrite(imageFileName, image);
            printf("第%d的右相机图片已经完成获取\n", n);
            n++;
        }
        else
        {
            cout << "已经超出采集的最大数量" << endl;
            n = 1;
        }
    }
    break;
    }
}

opencv关于GPU视频硬解码的思路(已实现验证)
opencv闲篇(基于opencv的gpu硬解码)
实现验证的博客:http://blog.csdn.net/qq_37837518/article/details/78619800

相关标签: opencv gpu