Capturing a still image from my camera into memory using DirectShow
- From: "moonlit" <u53249@uwe>
- Date: Mon, 13 Jul 2009 18:59:02 GMT
Hi all,
I hope this is the right forum for my question. I'm developing a library for
smartphones in C++ that captures an still image from the camera. I found an
example in the Windows Mobile SDK that does that. It can be found here:
C:\Program Files\Windows Mobile 5.0 SDK R2\Samples\PocketPC\CPP\Win32\
Cameracapture
My only problem is the image is captured into a file, and I need to have it
in memory for further processing. However since I'm not familiar with
DirectShow, I was wondering if you guys can help me in what I need to do to
put it into memory. Here is the code that creates a file with the image:
CGraphManager::CaptureStillImageInternal()
{
HRESULT hr = S_OK;
CComPtr<IFileSinkFilter> pFileSink;
CComPtr<IUnknown> pUnkCaptureFilter;
CComPtr<IPin> pStillPin;
CComPtr<IAMVideoControl> pVideoControl;
if(( m_pCaptureGraphBuilder == NULL ) || ( m_fGraphBuilt == FALSE ))
{
ERR( E_FAIL );
}
CHK( m_pImageSinkFilter.QueryInterface( &pFileSink ));
CHK( pFileSink->SetFileName( L"\\test.jpg", NULL ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pUnkCaptureFilter ));
CHK( m_pCaptureGraphBuilder->FindPin( pUnkCaptureFilter, PINDIR_OUTPUT,
&PIN_CATEGORY_STILL, &MEDIATYPE_Video, FALSE, 0, &pStillPin ));
CHK( m_pVideoCaptureFilter.QueryInterface( &pVideoControl ));
CHK( pVideoControl->SetMode( pStillPin, VideoControlFlag_Trigger ));
Cleanup:
if( FAILED( hr ))
{
NotifyMessage( MESSAGE_ERROR, L"Capturing a still image failed" );
}
return hr;
}
There has to be a place somewhere there where the image is stored into memory
but I cannot find it. Hopefully with that piece of code should be enough for
you guys to figure out how to get it. If you need more source code please let
me know.
Thanks a lot
.
- Follow-Ups:
- Prev by Date: Capturing a still image from my camera into memory using DirectShow
- Next by Date: Re: Capturing a still image from my camera into memory using DirectShow
- Previous by thread: Capturing a still image from my camera into memory using DirectShow
- Next by thread: Re: Capturing a still image from my camera into memory using DirectShow
- Index(es):
Relevant Pages
|