Updated by Alexander Shishkov about 13 years ago
Hi, all:
It looks there is some problem with CvEM::write_params() [[CvEM]]::write_params() and CvEM::read_params() [[CvEM]]::read_params() .
Whenever I didn't "read after write" the CvEM [[CvEM]] parameters, the predict() function works fine. However, whenever I called read_params() after I write_params() of a CvEM [[CvEM]] model, the predict() function goes crash.
I called the function in this way:
gmmModel.read_params(fs, 0);
Then, I noticed in the documentation of CvEM::read_params(), [[CvEM]]::read_params(),
If it is NULL, the function searches a node with parameters in all the top-level nodes (streams), starting with the first one.
Does that mean that there is no simple way to load all parameters in all level modes, instead of just the top-level nodes ????
Anyway, my trained .xml file is copied in the following and attached as file color001.xml:
please do give me a hand on how to CvEM::read_params() [[CvEM]]::read_params() successfully with all level parameters loaded using CvEM::read_params() [[CvEM]]::read_params() ???
Best Regards
Pei
<?xml version="1.0"?>
<opencv_storage>
<params>
<cov_mat_type>COV_MAT_DIAGONAL</cov_mat_type>
<start_step>START_AUTO_STEP</start_step>
<nclusters>3</nclusters>
<weights type_id="opencv-matrix">
<rows>1</rows>
<cols>3</cols>
<dt>d</dt>
<data>
4.7505367397911979e-001 4.0513001653020758e-001
1.1981630949067631e-001</data></weights>
<means type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
4.6735226574391647e-001 4.3428615328431247e-001
7.7229067746570723e-001 2.8662794138474235e-001
2.4997266948677280e-001 5.2728525926602976e-001 1. 1. 1.</data></means>
<covs>
<_ type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
3.1503335914751878e-003 0. 0. 0. 3.2953545487618106e-003 0. 0.
0. 7.2003084647408845e-003</data></_>
<_ type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
9.8828026607258000e-004 0. 0. 0. 1.3064142972168662e-003 0. 0.
0. 2.6975317757247349e-003</data></_>
<_ type_id="opencv-matrix">
<rows>3</rows>
<cols>3</cols>
<dt>d</dt>
<data>
1.1920928955078125e-007 0. 0. 0. 1.1920928955078125e-007 0. 0.
0. 1.1920928955078125e-007</data></_></covs></params>
</opencv_storage>