亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? cvcam.cpp

?? 是一個人臉識別特征提取的Vc代碼
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
/*M//////////////////////////////////////////////////////////////////////////////////////
//
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
//  By downloading, copying, installing or using the software you agree to this license.
//  If you do not agree to this license, do not download, install,
//  copy or use the software.
//
//
//                        Intel License Agreement
//                For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
//   * Redistribution's of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//
//   * Redistribution's in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//
//   * The name of Intel Corporation may not be used to endorse or promote products
//     derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/

//#include "windows.h"
//#include "AFXPRIV.H"

#include "highgui.h"
#include <cvstreams.h>
#include <initguid.h>
#include "iProxyTrans.h"
#include "ProxyTransuids.h"
#include "iSyncFilter.h"
#include "syncfilteruids.h"
#include <windows.h>
#include <objbase.h>
#include "afxres.h"
#include "resource.h"
#include "cvcamavi.h"
#include "cvcam.h"

#include <vector>
using namespace std;

#define WM_GRAPHNOTIFY  WM_USER+13


struct _cam_properties
{
    int _enabled;
    int render;
    int window;
    void* callback;
    int rndwidth;
    int rndheight;

    _cam_properties() : _enabled(0), render(1), window(0), callback(0), rndwidth(0),
        rndheight(0) {};
};

static void* stereo_callback;

static vector<_cam_properties> cvcam_properties;

class SafeMoniker : public SafePointer<IMoniker>
{
public:
    SafeMoniker(const SafeMoniker& p) 
    {
        m_pointer = p.m_pointer;m_pointer->AddRef();
    };
    SafeMoniker(IMoniker* p) 
    {
        m_pointer = p;
    }
};

class SafeUnknown : public SafePointer<IUnknown>
{
public:
    SafeUnknown(const SafeUnknown& p) 
    {
        m_pointer = p.m_pointer;
        if(m_pointer)
        {
            m_pointer->AddRef();
        }
    };
    SafeUnknown(IUnknown* p) 
    {
        m_pointer = p;
    }
};



static IMoniker* _cvcamMon = 0;
static IBindCtx* _cvcamBCtx=0;
static SafePointer<ICreateDevEnum> _cvcamCreateDevEnum(NULL);
static SafePointer<IEnumMoniker>   _cvcamEnumMon(NULL);
static vector<SafeMoniker> _cvcamMonikers;
typedef SafePointer<IBaseFilter> SafeFilter;
static vector<SafeFilter> _cvcamSource(NULL);
//static SafePointer<IBaseFilter> _cvcamSource;
static SafePointer<IProxyTransform> _cvcamProxyTrans(NULL);
static SafePointer<ISyncFilter> _cvcamCvSync(NULL);
static SafePointer<IGraphBuilder> _cvcamGraphBuilder(NULL);
static SafePointer<IMediaControl> _cvcamMediaControl(NULL);
static SafePointer<IMediaEventEx> _cvcamMediaEventEx(NULL);
static SafePointer<IVideoWindow> _cvcamVideoWindow(NULL);
static SafePointer<IVideoWindow> _cvcamVideoWindow2(NULL);
//static SafePointer<IFilterGraph> _cvcamFilterGraph;
//typedef SafePointer<IBindCtx> SafeBindCtx;
//static vector<SafeBindCtx> _cvcamBindCtx;


static int camera_index = -1;

static cvcamAVIs theAvis;

/* Resets all the filters */
static void _cvcamReset()
{
    
    _cvcamSource.clear();
    _cvcamProxyTrans   = NULL;
    _cvcamMediaControl = NULL;
    _cvcamMediaEventEx = NULL;
    _cvcamVideoWindow  = NULL;
    _cvcamVideoWindow2 = NULL;
    _cvcamCvSync       = NULL;
    _cvcamGraphBuilder = NULL;

}
HINSTANCE DLLhinst;

BOOL WINAPI DllMain(
  HINSTANCE hinstDLL,  // handle to the DLL module
  DWORD fdwReason,     // reason for calling function
  LPVOID lpvReserved   // reserved
  )
{
    DLLhinst = hinstDLL;
    
    //*** it works, putting CoInitialize(0) and CoUninitialize() here 
    //although I'm not quite sure that this is a good place.  
    switch( fdwReason ) 
    { 
        case DLL_PROCESS_ATTACH:
            CoInitialize(0);
            break;
        case DLL_PROCESS_DETACH:
            CoUninitialize();
            break; 
    }

    return TRUE;

}


static int _cvcamInitVideoSource(IBaseFilter** filter);

static int _cvcamInit2Cams();

static int cvcamAVISetProperty(int camera, const char* property, void* value);

static int cvcamAVIGetProperty(int camera, const char* property, void* value);

static int _cvcamNumberOfEnabled()
{
    int j = 0;
    for(uint i = 0; i < cvcam_properties.size(); i++)
            {
                if(cvcam_properties[i]._enabled)
                    j++;
            }

    return j;

}

static IPin* get_source_pin( IBaseFilter* pFilter, PIN_DIRECTION dir )
{

    ICaptureGraphBuilder2* cgb2;
    IPin*       pPin =0;

    if(FAILED(CoCreateInstance( CLSID_CaptureGraphBuilder2, NULL, 
                                CLSCTX_INPROC_SERVER, 
                      IID_ICaptureGraphBuilder2, (void **)&cgb2 )))
            
    {
        return 0;
    }

    cgb2->FindPin(pFilter, dir, &PIN_CATEGORY_CAPTURE , 
                  &MEDIATYPE_Video, FALSE, 0, &pPin);


    cgb2->Release();
    return pPin;


}

IPin* get_pin( IBaseFilter* pFilter, PIN_DIRECTION dir )
{
    IEnumPins*  pEnumPins = 0;
    IPin*       pPin = 0;

    if( pFilter )
    {
        pFilter->EnumPins( &pEnumPins );
        if( pEnumPins != 0 )
        {
            for(;;)
            {
                ULONG  cFetched = 0;
                PIN_DIRECTION pinDir = PIN_DIRECTION(-1); 
                pPin = 0;

                pEnumPins->Next( 1, &pPin, &cFetched );
                if( cFetched == 1 && pPin != 0 )
                {
                    pPin->QueryDirection( &pinDir );
                    if( pinDir == dir ) break;
                    pPin->Release();
                }
                else if(cFetched == 0)
                {
                    return 0;
                }
            }
            pEnumPins->Release();
        }
    }

    return pPin;
}

//*** This function is actually taken from AMCAP,a DirectShow sample program. 
//Its original name was NukeDownstream, pretty cool. But I think this name make more sense.  
static void _cvcamDisconnectAllFilter(IBaseFilter *pf) 
{
    
    IPin *pP, *pTo;
    ULONG u;
    IEnumPins *pins = NULL;
    PIN_INFO pininfo;
    HRESULT hr = pf->EnumPins(&pins);
    pins->Reset();
    while(hr == NOERROR) {
        hr = pins->Next(1, &pP, &u);
        if(hr >= 0 && pP) {
            pP->ConnectedTo(&pTo);
            if(pTo) {
                hr = pTo->QueryPinInfo(&pininfo);
                if(hr == NOERROR) {
                    if(pininfo.dir == PINDIR_INPUT) {
                        _cvcamDisconnectAllFilter(pininfo.pFilter);
                        _cvcamGraphBuilder->Disconnect(pTo);
                        _cvcamGraphBuilder->Disconnect(pP);
                        _cvcamGraphBuilder->RemoveFilter(pininfo.pFilter);
                    }
                    pininfo.pFilter->Release();
                }
                pTo->Release();
            }
            pP->Release();
        }
    }
    if(pins)
        pins->Release();
}


//*** The main idea and name of this function is also taken from AMCAP.
//Basicly it just puts everything back to its initial state(before cvcamInit was called)
static void _cvcamTearDownGraph() 
{

    cvcamStop();
    if(_cvcamVideoWindow.is_valid() )
    {
        _cvcamVideoWindow->put_Visible(OAFALSE);
        _cvcamVideoWindow->put_Owner(NULL);
        _cvcamVideoWindow = NULL;
    }
        
    if(_cvcamVideoWindow2.is_valid() )
    {
        _cvcamVideoWindow2->put_Visible(OAFALSE);
        _cvcamVideoWindow2->put_Owner(NULL);
        _cvcamVideoWindow2 = NULL;
    }

    _cvcamMediaControl = NULL;
    _cvcamMediaEventEx = NULL;

    // disconnect the graph and release all filter, except _cvcamSource anyway
    for(int i = 0; i < _cvcamSource.size(); i++)
        if(_cvcamSource[i].is_valid())
            _cvcamDisconnectAllFilter(_cvcamSource[i].value());
}

//*** Make a builder graph object 
static int _cvcamMakeGraph() 
{
    // we have one already
    if(_cvcamGraphBuilder.is_valid())
        return 1;

    HRESULT hr = CoCreateInstance( CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, 
                      IID_IGraphBuilder, (void **)&_cvcamGraphBuilder );

    return (hr == NOERROR) ? 1 : 0;
}

//*** connect source filter and add it to graph builder so we are ready to call the video source Property Page
static int _cvcamInitCapFilters(int camera)  
{
    //camera_index will point to the last source filter
    camera_index = camera;
    
    HRESULT hr;

    if(!_cvcamMakeGraph())
        return -1;

    IBaseFilter* filter;
    hr = _cvcamMonikers[camera]->BindToObject(0, 0, IID_IBaseFilter, (void **)&filter);
    if(hr >= 0)
        _cvcamSource[camera]=filter;
    else
    {
        cvcam_properties[(uint)camera]._enabled = 0;
        return -2;
    }

    hr = _cvcamGraphBuilder->AddFilter(_cvcamSource[camera].value(), L"Video Source");
    if(hr < 0)
        return -3;

    return 1;
}


/* The function creates a video source enumerator */
static int _cvcamInitVideoSourceEnum()
{
    //*** 
//  CoInitialize(0);

    vector<SafeUnknown>> _objects;
    
    if(FAILED(CoCreateInstance( CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER,
                      IID_ICreateDevEnum, (void**)&_cvcamCreateDevEnum )) ||
                      !_cvcamCreateDevEnum.is_valid())
    {
        return -1;
    }

    return 0;
}
/* The function iterates through all video sources and returns the number of them; 
if the input argument is nonzero, returns the pointer to IBaseFilter of the source 
that was selected previously. If no source has been selected, selects the first one. 
The interface that is returned, should not be released by the user; it will be released 
automatically.*/
static int _cvcamInitVideoSource(IBaseFilter** filter)
{
    //*** I think it is better idea to let user do 
    //both CoInitialize and CoUninitialize in their code
    //Anyway I can find CoUninitialize anywhere in this file!! 
//  CoInitialize(0);

    if(!_cvcamCreateDevEnum.is_valid())
    {
        int ret = _cvcamInitVideoSourceEnum();
        if(ret < 0)
            return ret;
    }

    ASSERT(_cvcamCreateDevEnum.is_valid());

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区高清| 丁香激情综合国产| 激情久久五月天| 国产三级一区二区| 欧美日韩国产一级| 精品国产伦一区二区三区免费| 精品欧美久久久| 亚洲最大成人网4388xx| 国产99精品视频| 91麻豆精品国产91久久久使用方法| 国产精品久久网站| 国产老女人精品毛片久久| 欧美精品xxxxbbbb| 亚洲另类一区二区| 99久久精品免费看| 国产调教视频一区| 国产精品中文字幕欧美| 欧美一级欧美三级在线观看| 亚洲午夜在线电影| 91丨porny丨中文| 精品成人免费观看| 麻豆精品久久久| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 国产欧美一区二区三区网站| 国内精品久久久久影院一蜜桃| 日韩一区二区在线看| 午夜精品久久久久久久久久| 欧美丝袜自拍制服另类| 一个色在线综合| 色婷婷国产精品综合在线观看| 国产日韩欧美高清| 国产乱妇无码大片在线观看| 国产情人综合久久777777| 国产精品亚洲专一区二区三区| 日韩精品资源二区在线| 蜜臀91精品一区二区三区| 91精品在线一区二区| 成人久久18免费网站麻豆 | 久久一区二区三区四区| 视频精品一区二区| 6080午夜不卡| 麻豆免费看一区二区三区| 精品毛片乱码1区2区3区| 精品在线视频一区| 国产调教视频一区| 91老司机福利 在线| 亚洲美腿欧美偷拍| 91久久精品一区二区二区| 亚洲精品免费在线观看| 欧美人与禽zozo性伦| 蜜桃久久av一区| 欧美国产日本视频| 日本大香伊一区二区三区| 亚洲第一福利一区| 欧美大片在线观看一区二区| 国产suv精品一区二区三区| 国产精品第四页| 欧美酷刑日本凌虐凌虐| 久久电影网电视剧免费观看| 国产精品伦一区二区三级视频| 在线看国产日韩| 免费在线观看成人| 中文幕一区二区三区久久蜜桃| 欧美福利视频导航| 夜夜嗨av一区二区三区网页| 欧美日本一区二区在线观看| 国产麻豆成人精品| 亚洲男人的天堂av| 欧美videofree性高清杂交| 不卡高清视频专区| 日韩精品久久久久久| 中文字幕第一区| 6080午夜不卡| 色综合亚洲欧洲| 在线免费观看视频一区| 久久国产福利国产秒拍| 亚洲色图清纯唯美| 2023国产精品视频| 欧美日韩一区二区三区四区| 国产成人免费视频网站| 日韩成人免费看| 亚洲人被黑人高潮完整版| 精品免费国产二区三区 | 日韩欧美一卡二卡| 91国产丝袜在线播放| 国产福利一区二区三区视频在线 | 久久这里只有精品首页| 欧美吞精做爰啪啪高潮| 成人激情图片网| 毛片一区二区三区| 午夜精品久久久| 国产欧美日本一区视频| 欧美一区二区视频观看视频 | 国产精品中文欧美| 艳妇臀荡乳欲伦亚洲一区| 欧美精彩视频一区二区三区| 欧美xxxxxxxx| 日韩一区二区三区视频在线观看| 欧美体内she精视频| 成人av在线一区二区| 国产一区二区美女| 毛片av中文字幕一区二区| 亚洲超碰精品一区二区| 亚洲免费av观看| 国产精品福利电影一区二区三区四区| 精品黑人一区二区三区久久| 欧美高清hd18日本| 欧美欧美欧美欧美| 欧美日韩一区二区三区在线| 色婷婷av一区二区三区软件| 91在线免费播放| 色视频成人在线观看免| 色哟哟精品一区| 91福利精品视频| 精品视频色一区| 3atv一区二区三区| 91精品国产高清一区二区三区| 欧美一级高清片| 26uuu精品一区二区| 久久中文娱乐网| 国产午夜精品美女毛片视频| 久久久久国色av免费看影院| 日本一区二区三区视频视频| 国产精品九色蝌蚪自拍| 中文字幕亚洲在| 亚洲尤物视频在线| 日本欧美一区二区三区乱码| 久久av中文字幕片| 国产98色在线|日韩| 91香蕉视频污| 欧美丝袜丝交足nylons图片| 日韩午夜av电影| 久久久久久久久久久久久女国产乱 | 91久久一区二区| 制服丝袜亚洲播放| 久久久久青草大香线综合精品| 国产精品视频九色porn| 亚洲午夜电影在线观看| 久久99精品久久久| 成人高清视频在线| 欧美日韩一区 二区 三区 久久精品| 欧美视频一区二区| 精品久久久久一区二区国产| 中文字幕一区视频| 亚洲bdsm女犯bdsm网站| 美女精品自拍一二三四| 成人av网址在线观看| 欧美三级电影一区| 国产亚洲欧洲一区高清在线观看| 国产精品国产精品国产专区不片| 亚洲国产精品综合小说图片区| 狠狠v欧美v日韩v亚洲ⅴ| 成人深夜在线观看| 欧美日韩高清影院| 国产精品免费久久久久| 日韩经典一区二区| 成人av在线电影| 日韩一区二区三区四区五区六区| 中文字幕五月欧美| 久久精品国产99久久6| 91啦中文在线观看| 久久夜色精品一区| 亚洲国产精品一区二区久久恐怖片| 国产一区二区三区在线看麻豆| 欧美影视一区在线| 欧美激情资源网| 久久精品免费观看| 欧美日韩三级在线| 自拍偷在线精品自拍偷无码专区| 久久精品国产免费| 欧美精品在线观看播放| 亚洲视频资源在线| 国产精品自在欧美一区| 欧美一区三区二区| 夜色激情一区二区| 色一情一伦一子一伦一区| 国产精品日韩成人| 国产美女精品人人做人人爽| 91麻豆精品久久久久蜜臀| 亚洲六月丁香色婷婷综合久久 | 欧美日韩不卡一区二区| 综合激情成人伊人| av色综合久久天堂av综合| 久久综合资源网| 久草这里只有精品视频| 欧美精品tushy高清| 亚洲最大成人综合| 欧美自拍偷拍一区| 中文字幕在线免费不卡| 粉嫩av一区二区三区在线播放 | 午夜精品久久久久久久久久久 | 久久激五月天综合精品| 欧美一区二区三区在线观看| 五月激情综合色| 欧美另类z0zxhd电影| 亚洲成人免费视| 欧美日本一道本在线视频| 亚洲国产精品嫩草影院| 欧美无砖专区一中文字| 视频在线观看一区|