changing directshow capture dimension
many thanks deji |
many thanks deji |
The list of supported capabilities is returned by IAMStreamConfig::GetStreamCaps. You can change the settings with IAMStreamConfig::SetFormat.
From the list of supported formats i get dimesions 144*176 , 288*352, and multiples
i do not have 176*144 as one of the supported formats.
can i give any abritrary dimension to set dimensions? I have errors when i do setFormat(176,144).
many thanks
You generally can't use arbitrary dimensions no. What is listed as the possible media types is usually all that is available.
So do I surmise that you video is in a portrait 3x4 configuration or that the image is sideways (90 degree rotation)?
Do you check for any hardware settings? Sometimes there is an option to use the device in landscape mode which may also rotate the camera.
deji
IImagingFactory *pImgFactory;
IImage *pImage;
IBasicBitmapOps *pBasicBitmapOps;
CComPtr<IBitmapImage> pBitmapImage;
RECT rc = { 0, 0, 130, 88};
ImageInfo imageInfo;
IBitmapImage* newBitmap = NULL;
UINT anchura = 15;
UINT altura = 10;
CoInitializeEx(NULL, COINIT_MULTITHREADED);
// Create the imaging factory. if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,NULL,
CLSCTX_INPROC_SERVER,
IID_IImagingFactory,
(
void **)&pImgFactory))){
if (SUCCEEDED(pImgFactory->CreateImageFromFile(TEXT(
"Storage Card/test.bmp"),&pImage)))
{
// Draw the image.pImage->Draw(pDC->m_hDC,&rc,NULL);
pImage->GetImageInfo(&imageInfo);
if (SUCCEEDED(pImgFactory->CreateBitmapFromImage(pImage, imageInfo.Width, imageInfo.Height,
PixelFormatDontCare, InterpolationHintDefault,
&pBitmapImage)))
{
pBitmapImage->QueryInterface(IID_IBasicBitmapOps,
(
void**)&pBasicBitmapOps);if (SUCCEEDED(pBasicBitmapOps->Resize(anchura,altura,PixelFormatDontCare, InterpolationHintDefault,
&newBitmap)))
{
pImage->Release();
newBitmap->QueryInterface(IID_IImage, (
void**)(&pImage));pImage->Draw(pDC->m_hDC,&rc,NULL);
AfxMessageBox(L
"Imagen modificada con exito");}
// Codigo para rotar una imagen /* pBasicBitmapOps->Rotate(90, InterpolationHintNearestNeighbor,&newBitmap);
pImage->Release();
newBitmap->QueryInterface(IID_IImage, (void**)(&pImage));
pImage->Draw(pDC->m_hDC,&rc,NULL);
*/}
}
pBasicBitmapOps->Release();
newBitmap->Release();
pImgFactory->Release();
}
CoUninitialize();