|
-
July 13th, 2009, 09:59 AM
#1
Capturing a still image from my camera into memory
Hi all,
I hope this is the right forum. I'm developing an application 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:
Code:
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 coude please let me know.
Thanks a lot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|