Hello Luiz.
Not sure what causes the E_FAIL error in your project. The following two functions for saving and loading of sfm reconstructions should work.
- Code:
HRESULT SaveSfmReconstruction( CapturingReality::Sfm::ISfmReconstruction *pRec, const WCHAR *url )
{
HRESULT hr = S_OK;
CComPtr< IStream > spStream;
hr = SHCreateStreamOnFile( url, STGM_WRITE | STGM_CREATE, &spStream );
if ( SUCCEEDED( hr ) )
{
hr = spRec->SaveToStream( spStream );
}
if ( SUCCEEDED( hr ) )
{
hr = spStream->Commit( STGC_DEFAULT );
}
return hr;
}
- Code:
HRESULT LoadSfmReconstruction( const WCHAR *url, CapturingReality::Sfm::ISfmReconstruction **ppRec )
{
HRESULT hr = CapturingReality::Sfm::CreateSfmReconstructionFromFile( url, ppRec );
return hr;
}
Make sure, that you have permission to read and write in the folder you are specifying in the url argument.
Let me know, if this doesn’t work and what error result you are getting.
-Filip