如题。
我手头有普通的dshow 操控摄像头的程序,能够修改分辨率,但是把这一部分代码弄到capturetex9 里面怎么也修改不了。
求助大家,应该怎么弄?ps: sdk里面的capturetex9 默认是320*240的分辨率。

解决方案 »

  1.   

    /*
    * 修改摄像头分辨率,色深,频率
    */BOOL SetFormat(ICaptureGraphBuilder2* pBuilder, IBaseFilter* pCap, long lWidth, long lHeight, unsigned short iColorBit, __int64 iRate )
    {
    VIDEOINFOHEADER* phead;
    IAMStreamConfig* iconfig;HRESULT hr; 
    hr = pBuilder -> FindInterface( &PIN_CATEGORY_CAPTURE,
    &MEDIATYPE_Interleaved,
    pCap, IID_IAMStreamConfig, (void **)&iconfig );
    if ( hr != NOERROR ) 
    {
    hr = pBuilder -> FindInterface( &PIN_CATEGORY_CAPTURE,
    &MEDIATYPE_Video, pCap,
    IID_IAMStreamConfig, (void **)&iconfig);
    }if ( FAILED( hr ) )
    return FALSE;AM_MEDIA_TYPE* pmt;
    if ( iconfig -> GetFormat( &pmt ) != S_OK )
    return FALSE;if ( pmt -> formattype == FORMAT_VideoInfo)
    {
    phead = ( VIDEOINFOHEADER* )pmt -> pbFormat;
    phead -> bmiHeader.biBitCount = iColorBit;
    phead -> bmiHeader.biWidth = lWidth;
    phead -> bmiHeader.biHeight = lHeight;
    phead -> bmiHeader.biSizeImage = lWidth * lHeight * iColorBit / 8;
    phead -> AvgTimePerFrame = iRate;
    if ( ( hr = iconfig -> SetFormat( pmt ) ) != S_OK )
    return FALSE;
    }
    iconfig -> Release();
    iconfig = NULL;
    FreeMediaType( *pmt );
    return TRUE;
    }
      

  2.   

    以前做过这样的软件,呵呵,留下EMAIL
      

  3.   

    myview请教一下,我拍的默认是320*240的,用了楼上的代码,会在
    if   (   (   hr   =   iconfig   ->   SetFormat(   pmt   )   )   !=   S_OK   )
    return   FALSE;
    } 返回,除非设lWidth=320;lHeight=240才行。我邮箱[email protected]。