当前位置:网站首页>Opencv learn read images videos and webcams
Opencv learn read images videos and webcams
2022-07-26 07:07:00 【Heihei_ study】
Catalog
One 、 Import image

#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
// Import image
int main()
{
string path="C:\\Users\\Rong\\Desktop\\Resources\\test.png";
Mat img = imread(path);
imshow("Image", img);
waitKey(0);
}notes : The image path should be double backslash !
Two 、 Import video
A video is a picture frame by frame , Use while Loop through each frame
// Import video
int main() {
string path = "C:\\Users\\Rong\\Desktop\\Resources\\test_video.mp4";
VideoCapture cap(path);
Mat img;
while (true) {
cap.read(img);
imshow("Video", img);
waitKey(20);
}
}3、 ... and 、 camera
Change the path of that video into 0 Because there is only one camera on my computer ( If write 1 Will report a mistake !)
// camera
int main() {
VideoCapture cap(0);
Mat img;
while (true) {
cap.read(img);
imshow("Webcom", img);
waitKey(20);
}
}边栏推荐
- 曲线曲率展示
- Getting started with kernel PWN (5)
- [today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
- Common programming shortcut keys of idea (take off after learning the operation)
- Is there any online account opening process of Huatai Securities? Is online account opening safe
- Can you learn fast and well with dual stream network? Harbin Institute of Technology & Microsoft proposed a distillation dual encoder model for visual language understanding, which can achieve fast an
- “蔚来杯“2022牛客暑期多校训练营1补题记录(ACDGIJ)
- IDEA——使用@Slf4j打印日志
- Overview of new features of es11, ES12 and es13
- vulnhub Lampião: 1
猜你喜欢

mySql建表的基本操作 与常见的函数

Binary tree knowledge summary

从Architecture带你认识JVM

Curve curvature display

XSS labs (1-10) break through details

AcWing-每日一题

IDEA——使用@Slf4j打印日志

"Wei Lai Cup" 2022 Niuke summer multi school training camp 1 supplementary question record (acdgij)

Screen: frame paste, 0 fit, full fit
![[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal](/img/7d/7a01c8c6923077d6c201bf1ae02c8c.png)
[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
随机推荐
如何删除语句审计日志?
[hard ten treasures] - 7.2 [dynamic RAM] analysis of the difference between DDR4 and DDR3
MySql 执行计划
MySQL check whether the table is locked
曲线曲率展示
[Star Project] small hat aircraft War (IV)
one hundred and twenty-three million one hundred and twenty-three thousand one hundred and twenty-three
Yolov6 target detection practice: training your own data set (video tutorial)
[today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
为什么extern使用const修饰的变量会编译不过?
LTS(Light-Task-Scheduler)
JIT中的IR工具与JITWatch的下载,编译及使用
Huffman coding principle
Drools (4): drools basic syntax (2)
微信小程序 - 从入门到入土
Introduce you to JVM from architecture
MySQL read / write lock
【无标题】转载
Is the passenger flow always low? There is something wrong with the location of your store!
MySQL table read lock