|
-
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
-
July 22nd, 2009, 09:50 AM
#2
Re: Capturing a still image from my camera into memory
You need to replace the File Sink filter with another renderer. Have a look at this page for a sample you can build on.
Regards
Robert Thompson
-
July 22nd, 2009, 11:23 AM
#3
Re: Capturing a still image from my camera into memory
 Originally Posted by TSYS
You need to replace the File Sink filter with another renderer. Have a look at this page for a sample you can build on.
Thanks a lot.
That example seems to be exactly what I need, but the problem is I think it's only for Windows not for Windows Mobile. I have tried to compile it but I get all kind of errors.
-
July 22nd, 2009, 12:40 PM
#4
Re: Capturing a still image from my camera into memory
I'm not familiar with Windows Mobile so I can't help you much more. But I hope the example I cited at least points you in the right direction, and that somebody else will follow up on this thread.
Regards
Robert Thompson
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
|