当前位置:网站首页>opencv环境的搭建,并打开一个本地PC摄像头。
opencv环境的搭建,并打开一个本地PC摄像头。
2022-07-06 19:36:00 【全栈程序员站长】
大家好,又见面了,我是全栈君
1、opencv环境结构
推荐连结 http://www.cnblogs.com/Anykong/archive/2011/04/06/Anykong_OpenCV1.html
2、以下是基本測试,和打开摄像头程序:
我的測试是在win8 系统上。
#include <cv.h>
#include <highgui.h>
#if 0
//測试opencv环境数据
int main()
{
const char* filename = "g:\\test.jpg" ;//换成你自己的文件路径名!!请注意,双斜杠!!
const char* wndname = "http://blog.csdn.net/moc062066" ; IplImage* pImage = cvLoadImage(filename,CV_LOAD_IMAGE_COLOR) ; cvNamedWindow(wndname,CV_WINDOW_AUTOSIZE); cvShowImage(wndname,pImage); cvWaitKey(0); cvReleaseImage(&pImage); cvDestroyWindow(wndname); return 0; } #else //採集摄像头数据#include <cv.h>#include <cxcore.h>#include <highgui.h> int main( int argc, char** argv ){ //声明IplImage指针 IplImage* pFrame = NULL; //获取摄像头 CvCapture* pCapture = cvCreateCameraCapture(-1); //创建窗体 cvNamedWindow("video", 1); cvResizeWindow("video",300,300); //显示视屏 while(1) { pFrame=cvQueryFrame( pCapture ); if(!pFrame)break; cvShowImage("video",pFrame); char c=cvWaitKey(33); if(c==27)break; } cvReleaseCapture(&pCapture); cvDestroyWindow("video");}#endif
版权声明:本文博主原创文章,博客,未经同意不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/116782.html原文链接:https://javaforall.cn
边栏推荐
- Error: could not find a version that satisfies the requirement xxxxx (from versions: none) solutions
- [2022 national tournament simulation] polygon - computational geometry, binary answer, multiplication
- A complete tutorial for getting started with redis: problem location and optimization
- PSINS中19维组合导航模块sinsgps详解(时间同步部分)
- Mmdetection3d loads millimeter wave radar data
- Redis introduction complete tutorial: client case analysis
- Wireshark installation
- Oauth2协议中如何对accessToken进行校验
- Left value, right value
- What management points should be paid attention to when implementing MES management system
猜你喜欢
A complete tutorial for getting started with redis: problem location and optimization
Oauth2协议中如何对accessToken进行校验
What are the characteristics of the operation and maintenance management system
How-PIL-to-Tensor
Hash table and full comments
Redis getting started complete tutorial: client management
Le tube MOS réalise le circuit de commutation automatique de l'alimentation principale et de l'alimentation auxiliaire, et la chute de tension "zéro", courant statique 20ua
【Socket】①Socket技术概述
MySQL is an optimization artifact to improve the efficiency of massive data query
The whole process of knowledge map construction
随机推荐
C language exercises_ one
Wireshark installation
What are the characteristics of the operation and maintenance management system
[secretly kill little partner pytorch20 days] - [Day1] - [example of structured data modeling process]
杰理之开启经典蓝牙 HID 手机的显示图标为键盘设置【篇】
Uniapp adaptation problem
Redis getting started complete tutorial: replication configuration
uniapp适配问题
Redis getting started complete tutorial: replication topology
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
Summary of basic debugging steps of S120 driver
Unity uses maskablegraphic to draw a line with an arrow
从零安装Redis
tensorboard的使用
Remember the problem analysis of oom caused by a Jap query
杰理之电话本获取【篇】
How-PIL-to-Tensor
Redis入门完整教程:RDB持久化
Utilisation de la promesse dans es6
Cryptography series: detailed explanation of online certificate status protocol OCSP