当前位置:网站首页>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
- 杰理之电话本获取【篇】
- 左程云 递归+动态规划
- 杰理之播内置 flash 提示音控制播放暂停【篇】
- Utilisation de la promesse dans es6
- 【Socket】①Socket技术概述
- “零售为王”下的家电产业:什么是行业共识?
- Es6中Promise的使用
- [2022 national tournament simulation] polygon - computational geometry, binary answer, multiplication
- Read fast RCNN in one article
猜你喜欢

Digital scrolling increases effect

Leetcode 77: combination

Statistics of radar data in nuscenes data set

A complete tutorial for getting started with redis: AOF persistence

换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看!

How-PIL-to-Tensor

Derivative, partial derivative, directional derivative

Install redis from zero

【2022国赛模拟】多边形——计算几何、二分答案、倍增

巴比特 | 元宇宙每日必读:IP授权是NFT的破圈之路吗?它的难点在哪里?Holder该如何选择合作平台?...
随机推荐
Detailed explanation of 19 dimensional integrated navigation module sinsgps in psins (time synchronization part)
Change your posture to do operation and maintenance! GOPs 2022 Shenzhen station highlights first!
凌云出海记 | 易点天下&华为云:推动中国电商企业品牌全球化
Form validation of uniapp
Derivative, partial derivative, directional derivative
换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看!
左程云 递归+动态规划
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
INS/GPS组合导航类型简介
Error: could not find a version that satisfies the requirement xxxxx (from versions: none) solutions
What management points should be paid attention to when implementing MES management system
杰理之发射端在接收端关机之后假死机【篇】
Use of promise in ES6
【Socket】①Socket技术概述
PSINS中19维组合导航模块sinsgps详解(时间同步部分)
Andrews - multimedia programming
Cryptography series: detailed explanation of online certificate status protocol OCSP
Hash table and full comments
Uniapp adaptation problem
Mmdetection3d loads millimeter wave radar data