Custom Search

Wednesday, February 24, 2010

opencv read xml file contents

I spent 1 hour trying to find out what was the problem of reading the contents of an xml file.

When reading a single parameter,

eg. 0

you have to use cvReadIntByName

When reading multiple parameters

eg. 0 30 200 10 3

you have to use CvSeq* s = cvGetFileNodeByName(fs,0,"calibration")->data.seq;

then cvReadInt( (CvFileNode*)cvGetSeqElem(s,index) );

My problem was I was reading a single parameter and I used the second method but specifying index = 0. This doesn't work! CvSeq* s returns rubbish when there is only 1 parameter.


No comments: