-
大小: 1.1MB文件类型: .zip金币: 1下载: 0 次发布日期: 2023-08-29
- 语言: 其他
- 标签: DirectShow CameraDS OpenCV x64
资源简介
包含DirectShow 的依赖文件和库,64位、32位均有,以及CameraDS.h,CameraDS.cpp。用于基于opencv的摄像头/相机图像、视频采集程序,或将原X86平台程序移植至X64平台。
实践发现此DirectShow +CameraDS方法相比OpenCV自带videocapture 类在速度上快得多。
代码片段和文件信息
//////////////////////////////////////////////////////////////////////
// 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 = 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;
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;
}
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“NullRendere
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-03-13 10:49 dirtshow_x64_x86\
文件 11605 2011-04-30 16:26 dirtshow_x64_x86\CameraDS.cpp
文件 3302 2011-04-30 16:26 dirtshow_x64_x86\CameraDS.h
目录 0 2017-03-13 10:50 dirtshow_x64_x86\DirectShow\
目录 0 2015-11-30 16:04 dirtshow_x64_x86\DirectShow\Include\
文件 631 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\activecf.h
文件 1826 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\amaudio.h
文件 1065 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\amparse.h
文件 73261 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\amstream.h
文件 3974 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\amva.h
文件 19851 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\Amvideo.h
文件 1097 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\atsmedia.h
文件 1532 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\audevcod.h
文件 20543 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\austream.h
文件 13805 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\aviriff.h
文件 6820 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\ba
文件 125594 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\bdaiface.h
文件 54539 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\bdamedia.h
文件 53527 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\Bdatif.h
文件 15486 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\bdatypes.h
文件 944 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\comlite.h
文件 178266 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\control.h
文件 88071 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d.h
文件 72232 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d8.h
文件 16088 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d8caps.h
文件 63735 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d8types.h
文件 96132 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d9.h
文件 22164 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d9caps.h
文件 69800 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3d9types.h
文件 26113 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3dcaps.h
文件 14874 2011-04-30 16:26 dirtshow_x64_x86\DirectShow\Include\d3drm.h
............此处省略126个文件信息
- 上一篇:AD9854驱动
- 下一篇:2017年(最新)SSCI检索期刊目录
相关资源
-
opencvHaar特征进行的分类器-所有xm
- 视觉词袋训练
- vgg_generated_48,vgg_generated_64,vgg_gene
-
opencv的xm
l文件 - openCV 车牌分割
- 基于OpenCV的模拟仪表指针读数识别系
- 指纹提取与识别系统VC源码opencv
-
Measuring size of ob
jects in an image with - opencv实现两幅图像的极线约束匹配
- Criminisi算法OpenCV程序
- Kinect2.0+Opencv人体骨骼捕捉及绘制Vis
- OPENCV实现相机标定程序
- opencv 实现 meanshift 的目标跟踪
- opencv 的knn的训练数据
- 使用DirectShow驱动H264/265格式输出的U
- 单高斯背景建模opencv
- opencv高斯滤波模板及其滤波
- 基于OpenCV实现Retinex
- 虹膜识别VC2008+opencv2.3.1源码,改编自
- protobuf-cpp-3.1.0.tar.gz 下载192823
- opencv_xxx.310d.lib
- openCV图像检测资源包
- Opencv 下Cascade Classifier实现人脸识别的
-
opencv车牌识别xm
l文件 - Canny算子源代码
- 双目已知图像坐标求空间坐标opencv
- h264+ffmpeg+opencv开发手册
- opencvjs编译后的文件
- OpenCV图像处理教程 - 贾志刚 课程配套
- boostdesc vgg_generated.zip
评论
共有 条评论