Simultaneous Previewing & Video Capture using DirectShow [modified]
-
You still aren't answering my questions. And I still don't know what the problem is nor what you are trying to do. The article presents a very unconventional way of capturing an image off a filter graph, and requires that a VMR video renderer be used. Depending on what you need, and what you can assume of the system it will be installed in, this may or may not be a good technique to use. Ok how about this, you copy the OnTimer handler and put it in your handler.
DWORD dwSize;
dwSize=this->m_VMRCap.GrabFrame();
if(dwSize>0)
{
BYTE *pImage;
this->m_VMRCap.GetFrame (&pImage);
this->m_ctrlCaptureIMG .ShowImage (pImage);
}void CDXCaptureDlg::OnCapImage() { DWORD dwSize; dwSize=this->m_VMRCap.GrabFrame (); if(dwSize>0) { BYTE *pImage; this->m_VMRCap.GetFrame (&pImage); this->m_ctrlCaptureIMG .ShowImage (pImage); } } this code is used to capture a video, but I want to capture a bitmap aloha -- modified at 2:51 Tuesday 20th June, 2006
-
void CDXCaptureDlg::OnCapImage() { DWORD dwSize; dwSize=this->m_VMRCap.GrabFrame (); if(dwSize>0) { BYTE *pImage; this->m_VMRCap.GetFrame (&pImage); this->m_ctrlCaptureIMG .ShowImage (pImage); } } this code is used to capture a video, but I want to capture a bitmap aloha -- modified at 2:51 Tuesday 20th June, 2006
The code does not capture a video and I don't even know how you came to that conclusion. I would suggest you read the code and understand what is going on first. The code gets the current bitmap in the VMR renderer and ensures that it is in RGB24. pImage will end up as an array of RGBTRIPLEs that makes up the image. Note that he discards the bitmap header in GrabFrame() all you have is just the RGB24 data. If you want to create a HBITMAP with this, look up CreateDIBitmap on msdn.