c++ - Is that possible to use a string as a name in opencv FileStorage -
c++ - Is that possible to use a string as a name in opencv FileStorage -
i'd write xml file using opencv filestorage object.
most of examples see works next
filestorage fs("d:\\1.xml" , filestorage::write); fs << "one" << 1; i'd write section modified name variable , means text not have inserted in compile time. this:
string st = "1"; fs << st.c_str() << 1; however maintain on getting run time error. it's refused work, have tried using opencv string type, stl string type , char* , still can't create work.
any help appreciated
this tricky one. looking in persistence.cpp have found error thrown because cv_isalpha checked on variable name. means variable name should origin letter!
try doing following:
int main() { string oname; oname = "a"; // now, crash if assign "number" characters, e.g "1" filestorage fs("test.yml", filestorage::write); fs << oname.c_str() << 1 ; homecoming 0; } this should work.
edited: can set numbers in 'string' variable long begin letter (e.g. "a1"), works too.
c++ opencv
Comments
Post a Comment