Skip to content
Snippets Groups Projects
Commit 75ddd43e authored by Guillaume Pasero's avatar Guillaume Pasero
Browse files

WRG: use C++ interface to avoid warning cast-align

parent 82100782
No related branches found
No related tags found
No related merge requests found
...@@ -281,27 +281,28 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Load(const st ...@@ -281,27 +281,28 @@ void NeuralNetworkMachineLearningModel<TInputValue, TOutputValue>::Load(const st
if ( !name.empty() ) if ( !name.empty() )
lname = name.c_str(); lname = name.c_str();
CvFileStorage* fs = 0; cv::FileNode model_node;
CvFileNode* model_node = 0; cv::FileStorage fs(filename,cv::FileStorage::READ);
fs = cvOpenFileStorage(filename.c_str(), 0, CV_STORAGE_READ); if (!fs.isOpened())
if ( !fs )
{ {
itkExceptionMacro("Could not open the file " << filename << " for reading"); itkExceptionMacro("Could not open the file " << filename << " for reading");
} }
if( lname ) if( lname )
model_node = cvGetFileNodeByName(fs, 0, lname); model_node = fs[lname];
else else
{ {
CvFileNode* root = cvGetRootFileNode( fs ); cv::FileNode root = fs.root();
if( root->data.seq->total > 0 ) if ( root.size() > 0)
model_node = (CvFileNode*)cvGetSeqElem( root->data.seq, 0 ); {
model_node = *(root.begin());
}
} }
m_ANNModel->read(fs, model_node); m_ANNModel->read(*fs,*model_node);
m_CvMatOfLabels = (CvMat*)cvReadByName( fs, model_node, "class_labels" ); m_CvMatOfLabels = (CvMat*)cvReadByName( *fs, *model_node, "class_labels" );
cvReleaseFileStorage(&fs); fs.release();
} }
template<class TInputValue, class TOutputValue> template<class TInputValue, class TOutputValue>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment