opencv 学习入门篇

时间:2023-03-09 00:22:37
opencv 学习入门篇

unbuntu 安装:http://blog.****.net/cocoaqin/article/details/78163171

windows 安装:https://jingyan.baidu.com/article/64d05a025a686bde54f73b54.html

1.图片读取

http://blog.****.net/hujingshuang/article/details/47184717

include <iostream>
#include <opencv2/highgui/highgui.hpp> using namespace cv;
using namespace std; int main()
{
//①老版
IplImage *pic = cvLoadImage("lena.jpg", );
cvShowImage("load", pic);
cvWaitKey();
//②新版
Mat img = imread("lena.jpg");
imshow("read", img);
waitKey(); return ;
}

2.颜色空间转换

http://www.360doc.com/content/13/1202/14/10724725_333867110.shtml

3.视频读取

基本操作,其中 capture>>frame;  if (frame.empty()){break;}语句等效于if (!captrue.read(frame))。

#include <cv.h>
#include "stdafx.h"
#include <opencv2\opencv.hpp>
using namespace cv; int _tmain(int argc, _TCHAR* argv[])
{
VideoCapture capture;
capture.open("E:\\Workspace\\OpenCV\\test\\video\\video.avi");
while(true)
{
Mat frame;
capture>>frame;         if (frame.empty())

{
          break;

}
          imshow("readvideo",frame);

        waitKey();
}
return ;
}

4.直方图

http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.html

5.矩阵Mat

http://www.opencv.org.cn/opencvdoc/2.3.2/html/doc/tutorials/core/mat%20-%20the%20basic%20image%20container/mat%20-%20the%20basic%20image%20container.html

http://blog.****.net/yc461515457/article/details/48720165

MAT矩阵计算:http://blog.****.net/iracer/article/details/51296631

6.计算时间

GetTickcount函数:它返回从操作系统启动到当前所经的计时周期数。
getTickFrequency函数:返回每秒的计时周期数。

http://blog.****.net/u013476464/article/details/42419831

7.Mat, vector<point2f>,Iplimage等等常见类型转换

http://www.cnblogs.com/SevenTien/archive/2013/01/29/2882066.html