|
我本来就有一段程序,但,他只用有从摄像头中取到320*240的图像,我现在 要做800*480,有如下,代码,据说可以实现,哪位,知道,告诉我下,这段代码,放在程序的哪里有,有做这方面我想会知道。
HRESULT hr;
IBaseFilter *pCap;
CComPtr pCGB2;
hr = pCGB2.CoCreateInstance (CLSID_CaptureGraphBuilder, NULL, CLSCTX_INPROC);
IAMStreamConfig *pConfig = NULL;
hr = pCGB2->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pCap, IID_IAMStreamConfig, (void **)&pConfig);
// Query the output pin for IAMStreamConfig (not shown).
AM_MEDIA_TYPE *pmt = NULL;
hr = pConfig->GetFormat(&pmt);
if (SUCCEEDED(hr))
{
//DeleteMediaType(pmt);
VIDEOINFOHEADER *vh = (VIDEOINFOHEADER *)pmt->pbFormat;
vh->bmiHeader.biWidth = 480;
vh->bmiHeader.biHeight = 320;
vh->bmiHeader.biSizeImage = pmt->lSampleSize = \
vh->bmiHeader.biWidth * \
vh->bmiHeader.biHeight * \
vh->bmiHeader.biPlanes * \
vh->bmiHeader.biBitCount / 8;
pmt->pbFormat = (BYTE *)vh;
hr = pConfig->SetFormat(pmt);
ASSERT(hr == S_OK);
}
|
|