资源简介
在VS2015下配置directshow和opencv。用来显示多个USB摄像头
代码片段和文件信息
//////////////////////////////////////////////////////////////////////
// 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 “CameraDS.h“
#pragma comment(lib“Strmiids.lib“)
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CCameraDS::CCameraDS()
{
m_bConnected = false;
m_nWidth = 0;
m_nHeight = 0;
m_bLock = false;
m_bChanged = false;
m_pframe = NULL;
m_nBufferSize = 0;
m_pNullFilter = NULL;
m_pMediaEvent = NULL;
m_pSampleGrabberFilter = NULL;
m_pGraph = NULL;
m_IsOpen = false;
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 = false;
m_nWidth = 0;
m_nHeight = 0;
m_bLock = false;
m_bChanged = false;
m_nBufferSize = 0;
m_IsOpen = false;
}
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_pNul
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 196608 2006-02-28 18:04 DirectShow\bin\libguide40.dll
文件 631 2008-02-27 14:52 DirectShow\include\activecf.h
文件 1826 2008-02-27 14:52 DirectShow\include\amaudio.h
文件 1065 2008-02-27 14:52 DirectShow\include\amparse.h
文件 73261 2008-02-27 14:52 DirectShow\include\amstream.h
文件 3974 2008-02-27 14:52 DirectShow\include\amva.h
文件 19851 2008-02-27 14:52 DirectShow\include\Amvideo.h
文件 1097 2008-02-27 14:52 DirectShow\include\atsmedia.h
文件 1532 2008-02-27 14:52 DirectShow\include\audevcod.h
文件 20543 2008-02-27 14:52 DirectShow\include\austream.h
文件 13805 2008-02-27 14:52 DirectShow\include\aviriff.h
文件 6820 2008-02-27 14:52 DirectShow\include\ba
文件 125594 2008-02-27 14:52 DirectShow\include\bdaiface.h
文件 54539 2008-02-27 14:52 DirectShow\include\bdamedia.h
文件 53527 2008-02-27 14:52 DirectShow\include\Bdatif.h
文件 15486 2008-02-27 14:52 DirectShow\include\bdatypes.h
文件 11687 2010-05-31 09:25 DirectShow\include\CameraDS.cpp
文件 3280 2010-05-31 09:26 DirectShow\include\CameraDS.h
文件 944 2008-02-27 14:52 DirectShow\include\comlite.h
文件 178266 2008-02-27 14:52 DirectShow\include\control.h
文件 88071 2008-02-27 14:52 DirectShow\include\d3d.h
文件 72232 2008-02-27 14:52 DirectShow\include\d3d8.h
文件 16088 2008-02-27 14:52 DirectShow\include\d3d8caps.h
文件 63735 2008-02-27 14:52 DirectShow\include\d3d8types.h
文件 96132 2008-02-27 14:52 DirectShow\include\d3d9.h
文件 22164 2008-02-27 14:52 DirectShow\include\d3d9caps.h
文件 69800 2008-02-27 14:52 DirectShow\include\d3d9types.h
文件 26113 2008-02-27 14:52 DirectShow\include\d3dcaps.h
文件 14874 2008-02-27 14:52 DirectShow\include\d3drm.h
文件 24261 2008-02-27 14:52 DirectShow\include\d3drmdef.h
............此处省略130个文件信息
- 上一篇:AZENUI 移动端UI
- 下一篇:华为服务解决方案销售题库
相关资源
-
SimplePla
yer(DShow).zip - directshow实现的视频采集程序AVCap
- 基于opencv的双摄像头读取程序含Dire
- 最简单的基于DirectShow的
- DirectShow的视频播放器.rar
- opencv 、directshow捕获摄像头实时播放
- OpenCV图像视频采集 DirectShow 64位32位库
- 使用DirectShow驱动H264/265格式输出的U
- qt+directshow usb摄像头及音频设备录制视
- AMCap源代码DirectShow
- V7.1A文件包
- 使用DirectShow采集桌面、语音并实时进
- 虚拟摄像头Filter代码--VirtualCamFilter_
- 虚拟摄像头Filter,没有USB摄像头也可
- amCap工具源码
- directshow9
- 基于directShow打造全能播放器系列之二
- DirectShow获取视频和音频数据
- 使用DirectShow采集摄像头并对视音频进
- DirectShow虚拟摄像头工程
- CameraDs.h CameraDs.cpp directshow文件夹
- 基于DirectShow的网络视频传输实现
- DirectShow Filter : 字幕叠加 带注释
- 使用DShow进行摄像头采集并拍照
- Delphi USBCamera DirectShow 视频预览、视频
- 使用directshow采集视音频并进行H264和
- Windows下通过DirectShow控制USB摄像头捕获
- 基于directshow的摄像头预览
- Directshow实现的虚拟摄像头
- YUVFilter Directshow Transform Filter
评论
共有 条评论