-
大小: 17.37MB文件类型: .rar金币: 1下载: 0 次发布日期: 2023-06-13
- 语言: C/C++
- 标签: mfc opencv directshow
资源简介
opencv+directshow+mfc同步打开4个摄像头
代码片段和文件信息
//////////////////////////////////////////////////////////////////////
// Video Capture using DirectShow
// Author: Shiqi Yu (shiqi.yu@gmail.com)
// Thanks to:
// HardyAI@OpenCV China
// flymanbox@OpenCV China (for his contribution to function CameraName and frame width/height setting)
// Last modification: April 9 2009
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// 使用说明:
// 1. 将CameraDS.h CameraDS.cpp以及目录DirectShow复制到你的项目中
// 2. 菜单 Project->Settings->Settings for:(All configurations)->C/C++->Category(Preprocessor)->Additional include directories
// 设置为 DirectShow/Include
// 3. 菜单 Project->Settings->Settings for:(All configurations)->link->Category(Input)->Additional library directories
// 设置为 DirectShow/Lib
//////////////////////////////////////////////////////////////////////
// CameraDS.cpp: implementation of the CCameraDS class.
//
//////////////////////////////////////////////////////////////////////
#include“stdafx.h“
#include “CameraDS.h“
#pragma comment(lib“Strmiids.lib“)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCameraDS::CCameraDS()
{
m_bConnected = m_bLock = m_bChanged = false;
m_nWidth = m_nHeight = 0;
m_nBufferSize = 0;
m_pframe = NULL;
m_pNullFilter = NULL;
m_pMediaEvent = NULL;
m_pSampleGrabberFilter = NULL;
m_pGraph = NULL;
CoInitialize(NULL);
}
CCameraDS::~CCameraDS()
{
CloseCamera();
CoUninitialize();
}
void CCameraDS::CloseCamera()
{
if(m_bConnected)
{
m_pMediaControl->Stop();
}
m_pGraph = NULL;
m_pDeviceFilter = NULL;
m_pMediaControl = NULL;
m_pSampleGrabberFilter = NULL;
m_pSampleGrabber = NULL;
m_pGrabberInput = NULL;
m_pGrabberOutput = NULL;
m_pCameraOutput = NULL;
m_pMediaEvent = NULL;
m_pNullFilter = NULL;
m_pNullInputPin = NULL;
if (m_pframe)
{
cvReleaseImage(&m_pframe);
}
m_bConnected = m_bLock = m_bChanged = false;
m_nWidth = m_nHeight = 0;
m_nBufferSize = 0;
}
bool CCameraDS::OpenCamera(int nCamID bool bDisplayProperties int nWidth int nHeight)
{
HRESULT hr = S_OK;
CoInitialize(NULL);
// Create the Filter Graph Manager.
hr = CoCreateInstance(CLSID_FilterGraph NULL CLSCTX_INPROC IID_IGraphBuilder (void **)&m_pGraph);
hr = CoCreateInstance(CLSID_SampleGrabber NULL CLSCTX_INPROC_SERVER IID_IbaseFilter (LPVOID *)&m_pSampleGrabberFilter);
hr = m_pGraph->QueryInterface(IID_IMediaControl (void **) &m_pMediaControl);
hr = m_pGraph->QueryInterface(IID_IMediaEvent (void **) &m_pMediaEvent);
hr = CoCreateInstance(CLSID_NullRenderer NULL CLSCTX_INPROC_SERVER IID_IbaseFilter (LPVOID*) &m_pNullFilter);
hr = m_pGraph->AddFilter(m_pNullFilter L“NullRenderer“);
hr = m_pSampleGrabberFilter->QueryInterface(IID_ISam
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2457600 2016-12-31 11:06 Directshow_4Camera\comba
文件 268800 2016-12-31 11:16 Directshow_4Camera\Debug\Directshow_4Camera.exe
文件 1904984 2016-12-31 11:16 Directshow_4Camera\Debug\Directshow_4Camera.ilk
文件 9129984 2016-12-31 11:16 Directshow_4Camera\Debug\Directshow_4Camera.pdb
文件 11416 2016-12-30 22:18 Directshow_4Camera\Directshow_4Camera\CameraDS.cpp
文件 3097 2010-11-16 17:20 Directshow_4Camera\Directshow_4Camera\CameraDS.h
文件 6960 2012-03-14 16:52 Directshow_4Camera\Directshow_4Camera\CvvImage.cpp
文件 1957 2016-11-26 17:01 Directshow_4Camera\Directshow_4Camera\CvvImage.h
文件 332161 2016-12-31 10:49 Directshow_4Camera\Directshow_4Camera\Debug\CameraDS.obj
文件 252225 2016-12-31 10:49 Directshow_4Camera\Directshow_4Camera\Debug\CvvImage.obj
文件 4106 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\cl.command.1.tlog
文件 94678 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\CL.read.1.tlog
文件 4912 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\CL.write.1.tlog
文件 175 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\Directshow_4Camera.lastbuildstate
文件 2854 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\li
文件 8162 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\li
文件 1460 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\li
文件 716 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\rc.command.1.tlog
文件 3006 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\rc.read.1.tlog
文件 354 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directsh.36A50D19.tlog\rc.write.1.tlog
文件 2139 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directshow_4Camera.log
文件 41502 2016-12-31 11:08 Directshow_4Camera\Directshow_4Camera\Debug\Directshow_4Camera.obj
文件 43253760 2016-12-31 10:49 Directshow_4Camera\Directshow_4Camera\Debug\Directshow_4Camera.pch
文件 70424 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directshow_4Camera.res
文件 344320 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\Directshow_4CameraDlg.obj
文件 905058 2016-12-31 10:49 Directshow_4Camera\Directshow_4Camera\Debug\stdafx.obj
文件 3058688 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\vc120.idb
文件 8474624 2016-12-31 11:16 Directshow_4Camera\Directshow_4Camera\Debug\vc120.pdb
文件 196608 2006-02-28 18:04 Directshow_4Camera\Directshow_4Camera\DirectShow\bin\libguide40.dll
文件 11687 2010-05-31 09:25 Directshow_4Camera\Directshow_4Camera\DirectShow\CameraDS.cpp
............此处省略191个文件信息
相关资源
- MFC PNG GDI 实现的Process 进度控件
- Qt结合OpenCV和VC++实现调用摄像头拍照
- 基于WinpCap的MFC网络抓包程序
- 兄弟 DCP-9020CDN MFC-9140CDN-9340CDW 维修手
- MFC局域网即时聊天系统
- 双线性插值放大缩小图片 bmp mfc程序
- 基于MFC的人脸检测程序使用OpenCV实现
- windows编程课设图书馆管理系统 mfc+c
- MFC 实现对圆等分N点,N个点彼此连线
- mfc可视化程序设计大作业俄罗斯方块
- MFC使用onvif协议
- MXC1730.zip
- opencv mfc vs2017读取图片,向图片加入噪
- 基于MFC和多线程的udp收发程序
- 简单的基于MFC的职工管理系统数据库
- MFCretry1.rar
- vs2015+opencv3.3+mfc读取摄像头显示在图片
- MFC中用c++语言实现连接SQLServer2008附添
- 基于可视化界面实现Ping命令
- 传播c++.txt
- 应用opencv库项目(Visual Studioc++)的
- 类似QQ飞秋的聊天软件(含源码+文档
- basler相机mfc控制
- 《MFC程序开发参考大全》pdf和代码
- High-speed Charting Control Demo
- c++二维码定位和识别+zbar+opencv+ubuntu
- 《MFC Windows程序设计第二版》 源代码
- MFC界面美化库BCGControlbar16.1
- MFC上位机源代码
- MFC中用CEF实现c++与js交互
评论
共有 条评论