
本文共 4806 字,大约阅读时间需要 16 分钟。
������ OpenCV ������������������������
OpenCV���Open Source Computer Vision������������������������������������������������������������������������������������������������������������������������������������ OpenCV ������������������������������������������������������������������������������������������������������������������
OpenCV ��� ������ ������
OpenCV ��������������������������������������������������������������������������������������������������������������������������������� C/C++��������������������������������������� Python���Ruby���MATLAB ������������������������������������������������������������������������������������������������������������������������������������������ C ������������������������������������������
OpenCV ��� ������������
������ ������ ��� ������
������������������ OpenCV ������������������������������������������������������������Windows ������������������������������������������
������������������ ��������� ������
1. OpenCV ��� ������
��� Visual Studio ��������� OpenCV ������������������������������������
������ OpenCV ��������� ������ OpenCV ���������GitHub������������������������������
git clone --recursive https://github.com/opencv/opencv
������ OpenCV��� ������ Visual Studio ������ opencv.qxo
��������������������������� C++ ������������������������������������������������������������������������
��������������������� ������������ Property.Manual
��������������� necessary ��� library ��������� dependencies���
��������������������� ������������������������������������������������������������������������ OpenCV ���������������
������ ��������� ������
��������������������������������������������������������������������������������������� OpenCV ���������������
#include "stdafx.h"#include#include "opencv2/highgui/highgui.hpp"using namespace cv;int main() { // ������������������ Mat img = imread("pic.jpg"); // ������������ namedWindow("img"); // ������������ imshow("img", img); // ������������������������������������������ waitKey(6000); return 0;}
��� ��������������� ������ ������
������������������������������������������ OpenCV ���������������������������������������
������ ������������ OpenCV ��� ������ ������ ������
OpenCV ������������������������������ Mat
������������������������������������������������������������������������ 2D ������������������������������������������Mat
������������������������������������������������������������������������������������������
������ ������������������ ������
imread
��������������������������������������� Mat img = imread("pic.jpg");
namedWindow
������������������������ namedWindow("img");
imshow
������������������������������������ imshow("img", img);
waitKey
������������������������������������������������������������ waitKey(6000);
������������������ ��������� ��� ��� ������
��������������������������������������������������� OpenCV ������������������������������������������������������
#include "stdafx.h"#include#include "opencv2/highgui/highgui.hpp"using namespace cv;int main() { // ��������������������� Mat img1 = imread("pic1.jpg"); namedWindow("img1"); imshow("img1", img1); // ��������������������� Mat img2 = imread("pic2.jpg"); namedWindow("img2"); imshow("img2", img2); // ��������������������������������������������������� waitKey(0); return 0;}
���������������������������������������������������������������������������������������������������������������
������ ������ ��� ��� ������ ������
waitKey(0)
������������������������������������������������������������������������������������������������������������ OpenCV ������������������������������������������������������������������������