Ask Your Question
1

I have a question about how to use xml.

asked 2017-04-26 01:37:55 -0600

yhd gravatar image

updated 2017-04-26 07:26:40 -0600

cv::Mat A(181, 181, CV_32FC(28), Scalar(0));

There are 181 rows, 181 cols and 28 channels.

An error occurs when reading this after saving it in xml file.

FileStorage fs2("tau.yml", FileStorage::READ);
Mat AA;
fs2["A"] >> AA; // error occur

I think 181, 181, and 28 do not seem to parse.

Can I use the opencv library to solve this?

Or should I write new code to read this?

Thanks for reading.

edit retag flag offensive close merge delete

Comments

Fixed all typo's first, then wondered if you would be able to add the actual error and the YML file because how else can we help you further...

StevenPuttemans gravatar imageStevenPuttemans ( 2017-04-26 07:27:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-04-26 07:48:36 -0600

LBerger gravatar image

updated 2017-04-26 07:51:26 -0600

Yes I agree whith you (vs 2015 opencv 3.2-dev). there is a problem with this code

{
    cv::Mat A(2, 3, CV_32FC(181), Scalar(0));
    FileStorage fs1("tau.yml", FileStorage::WRITE);
    fs1 << "A" << A;
    fs1.release();

}
FileStorage fs2("tau.yml", FileStorage::READ);
Mat AA;
if (!fs2["A"].empty())
fs2["A"] >> AA;
cout << AA;
fs2.release();

now problem is at these lines

if( fmt_pair_count != 1 || fmt_pairs[0] > 4 )
    CV_Error( CV_StsError, "Too complex format for the matrix" );

If you have build opencv using cmake you can change fmt_pairs[0] > 4 in fmt_pairs[0] > 256 and it should work. Something better : make an issue and give this post in reference

edit flag offensive delete link more

Comments

maybe this will be helpful as an alternative way

sturkmen gravatar imagesturkmen ( 2017-04-26 15:50:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-04-26 01:37:55 -0600

Seen: 195 times

Last updated: Apr 26 '17