Opencv视觉学习--读取、写入、显示图像
发布日期:2021-05-10 23:38:07 浏览次数:10 分类:精选文章

本文共 3318 字,大约阅读时间需要 11 分钟。

OpenCV������������������������

���������������������OpenCV������������������������������������������������������������������������������������������������OpenCV������������������������������������������������������������

������������������

������������������������������������QT������������������������������ Qt 5.12 ������������������ OpenCV 4.1.0������������������������.pro���������������������������������

TEMPLATE = appCONFIG += consoleCONFIG -= app_bundleCONFIG -= qtINCLUDEPATH += /usr/local/include \             /usr/local/include/opencv \             /usr/local/include/opencv2 \             /usr/local/include/librealsense2LIBS += /usr/local/lib/libopencv*SOURCES += main.cpp

������������������

��� OpenCV ������������������������������������������������������������������������������������������������������������������������������������/���������������������//���������������������������������������


������������������

���������������������

������������������������ OpenCV ���������������������������������������������

#include 
#include
using namespace std;using namespace cv;int main() { // ������������ Mat image = imread("������������"); // ������������ imwrite("������������������", image); // ������������ imshow("������������", image); // ������������������ waitKey(0); return 0;}

������������

������������������������������������������������������������������������������������������������

#include 
#include
using namespace std;using namespace cv;int main() { while (1) { // ������������ Mat image = imread("/home/jiajia/������/002.jpg"); // ������������ imwrite("/home/jiajia/outputs/image.jpg", image); // ������������ imshow("������������", image); // ������������������ int key = waitKey(1); // ��������������������� ESC ������ if (char(key) == 27) { break; } } return 0;}

������������������

������������������������������������������������ VideoCapture ������������������

#include 
#include
using namespace std;using namespace cv;int main() { VideoCapture capture("������������������"); while (1) { Mat image; bool read������ = capture >> image; if (!read������) { break; } // ������������ imwrite("������������������", image); // ������������ imshow("������������", image); // ������������������ int key = waitKey(1); if (char(key) == 27) { break; } } return 0;}

������������������

  • ���������������������������������������������������������������������������������������������������������������������������������������������������
  • ������������������������������������������ imread ��� VideoCapture ������������������������������������������������������������
  • ��������������������������������� waitKey ������������������������������������������������������������������waitKey(1) ��������� CPU ������������������������ waitKey(0) ���������

���������������������������������������������������������������������������������������������������������������������������������������������������������

上一篇:Opencv视觉学习--调用摄像头、显示视频图像
下一篇:Linux Makefile获取当前系统时间固定函数

发表评论

最新留言

表示我来过!
[***.240.166.169]2025年04月02日 04时29分39秒