How to capture an image from an USB WebCam?
-
yes there is. here is what you have to do: 1) use the code you find below 2) create a BITMAPINFOHEADER 3) write the BITMAPINFOHEADER and the bitmap, that is captured below to a file. hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL); hdcCompatible = CreateCompatibleDC(hdcScreen); hbmScreen = CreateCompatibleBitmap(hdcScreen, Videobild.right, Videobild.bottom); if (hbmScreen == NULL) MessageBox("Bmp konnte nicht erstellt werden"); hbmScreen = ::CreateDIBSection(dc.GetSafeHdc(), (LPBITMAPINFO) m_dibFile.m_lpBMIH,DIB_RGB_COLORS, (LPVOID*) &m_dibFile.m_lpImage, NULL, 0); GDIObject=SelectObject(hdcCompatible, hbmScreen); if(GDIObject==NULL) MessageBox("Object konnte nicht selected werden"); if (!BitBlt(hdcCompatible, 0,0, Videobild.right, Videobild.bottom, hdcScreen, Videobild.left,Videobild.top, SRCCOPY)) MessageBox("Object konnte nicht geBitBltet werden");
-
There is always a way. I haven't actually looked at it for 2 years, so I can't help you directly. You'll probably want to look at DirectShow, everything that you want should be there. I believe I remember an example program in the SDK called Stillcap. Anyway good luck.