资源简介
OpenCV_MFC_版本1.0.1
代码片段和文件信息
//////////////////////////////////////////////////////////////////////
// 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“ // 2010.8.14 修改
#include “stdafx.h“ // 2010.8.14 修改
#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 (LPV
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2011-12-23 09:22 OpenCV_MFC_版本1.0.1\
目录 0 2011-12-23 09:21 OpenCV_MFC_版本1.0.1\版本1.0.1\
目录 0 2011-12-23 09:21 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\
目录 0 2011-12-23 09:21 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\
文件 19851 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Amvideo.h
文件 53527 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Bdatif.h
文件 3214 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\DShow.h
文件 8142 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\DxDiag.h
文件 3715 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Iwstdec.h
文件 1510 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Mpeg2Bits.h
文件 4095 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Mpeg2Error.h
文件 277368 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Mstvca.h
文件 430711 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Mstve.h
文件 73978 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Msvidctl.h
文件 108028 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Msvidctl.tlb
文件 565095 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Segment.h
文件 53292 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\Tuner.tlb
文件 631 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\activecf.h
文件 1826 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\amaudio.h
文件 1065 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\amparse.h
文件 73261 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\amstream.h
文件 3974 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\amva.h
文件 1097 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\atsmedia.h
文件 1532 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\audevcod.h
文件 20543 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\austream.h
文件 13805 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\aviriff.h
文件 6820 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\ba
文件 125594 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\bdaiface.h
文件 54539 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\bdamedia.h
文件 15486 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\bdatypes.h
文件 944 2008-02-27 14:52 OpenCV_MFC_版本1.0.1\版本1.0.1\DirectShow\Include\comlite.h
............此处省略163个文件信息
- 上一篇:OpenCV_MFC_版本1.0
- 下一篇:wavelet的dll封装与c++调用
评论
共有 条评论