Lines Matching refs:num_states
147 hmm[0].num_states = state_number[0];
181 for( i = 0; i < hmm[0].num_states; i++ )
185 hmm[i+1].num_states = state_number[i+1];
190 hmm[i].transP = icvCreateMatrix_32f( hmm[i].num_states, hmm[i].num_states );
204 for( i = 0; i < hmm[0].num_states + 1; i++ )
275 int superstate = (int)((i * hmm->num_states)*inv_y);/* /obs_info->obs_y; */
281 int state = (int)((j * hmm->u.ehmm[superstate].num_states)* inv_x); /* / obs_info->obs_x; */
294 if ( hmm->num_states > obs_info->obs_y ) return CV_BADSIZE_ERR;
297 float row_per_state = (float)obs_info->obs_y / hmm->num_states;
301 for( i = 0; i < hmm->num_states; i++ )
304 col_per_state[i] = (float)obs_info->obs_x / ehmm->num_states;
309 for( i = 0; i < hmm->num_states - 1; i++ )
313 ss_bound[hmm->num_states - 1] = obs_info->obs_y;
319 for( i = 0; i < hmm->num_states; i++ )
326 for( j = 0; j < ehmm->num_states - 1; j++ )
330 es_bound[ehmm->num_states - 1] = obs_info->obs_x;
334 for( j = 0; j < ehmm->num_states; j++ )
395 for( i = 0 ; i < hmm->num_states; i++ )
397 total += hmm->u.ehmm[i].num_states;
610 for( j = 0; j < hmm->num_states; j++ )
612 total_states += hmm->u.ehmm[j].num_states;
619 obs_info->obs_y * hmm->num_states * sizeof( CvMatr32f) );
634 obs_info->obs_y * hmm->num_states * sizeof( CvMatr32f/*(float*)*/ ) );
673 for( i = 0; i < hmm->num_states; i++ )
682 for( i = 0; i < hmm->num_states; i++ )
689 tmpf += ehmm->num_states * obs_info->obs_x;
709 for( i = 0; i < hmm->num_states; i++ )
715 for( j = 0; j < ehmm->num_states; j++ )
720 max_mix *= ehmm->num_states;
739 for( i = 0; i < hmm->num_states; i++ )
745 int n_states = ehmm->num_states;
748 for( j = 0; j < ehmm->num_states; j++ )
840 for( i = 0; i < hmm->num_states; i++ )
858 float* matr_line = B + k * ehmm->num_states;
860 for( m = 0; m < ehmm->num_states; m++ )
897 icvSetZero_32f( hmm->transP, hmm->num_states, hmm->num_states );
898 for (i = 0; i < hmm->num_states; i++ )
900 icvSetZero_32f( hmm->u.ehmm[i].transP , hmm->u.ehmm[i].num_states, hmm->u.ehmm[i].num_states );
925 int transP_size = hmm->num_states;
934 int transP_size = hmm->u.ehmm[superstate].num_states;
943 for( i = 0; i < hmm->num_states; i++)
947 for( j = 0; j < hmm->num_states; j++)
949 total += hmm->transP[i * hmm->num_states + j];
955 for( j = 0; j < hmm->num_states; j++)
957 hmm->transP[i * hmm->num_states + j] =
958 hmm->transP[i * hmm->num_states + j] ?
959 (float)log( hmm->transP[i * hmm->num_states + j] * inv_total ) : -BIG_FLT;
964 for( k = 0; k < hmm->num_states; k++ )
968 for( i = 0; i < ehmm->num_states; i++)
972 for( j = 0; j < ehmm->num_states; j++)
974 total += ehmm->transP[i*ehmm->num_states + j];
979 for( j = 0; j < ehmm->num_states; j++)
981 ehmm->transP[i * ehmm->num_states + j] =
982 (ehmm->transP[i * ehmm->num_states + j]) ?
983 (float)log( ehmm->transP[i * ehmm->num_states + j] * inv_total) : -BIG_FLT ;
1094 icvViterbiSegmentation( int num_states, int /*num_obs*/, CvMatr32f transP,
1108 int m_numStates = num_states;
1110 float* m_pi = (float*)cvAlloc( num_states* sizeof(float) );
1114 CvMatr32f m_b = B + start_obs * num_states;
1132 CvMatr32f m_Gamma = icvCreateMatrix_32f( num_states, m_maxNumObs );
1133 int* m_csi = (int*)cvAlloc( num_states * m_maxNumObs * sizeof(int) );
1155 for (i = 0; i < num_states; i++)
1157 m_Gamma[0 * num_states + i] = m_pi[i] + m_b[0 * num_states + i];
1158 m_csi[0 * num_states + i] = 0;
1171 m_Gamma[t * num_states + 0] = m_Gamma[(t-1) * num_states + 0] + m_a[0];
1172 m_csi[t * num_states + 0] = 0;
1174 for (j = 1; j < num_states; j++)
1176 float self = m_Gamma[ (t-1) * num_states + j] + m_a[ j * num_states + j];
1177 float prev = m_Gamma[ (t-1) * num_states +(j-1)] + m_a[ (j-1) * num_states + j];
1181 m_csi[t * num_states + j] = j-1;
1182 m_Gamma[t * num_states + j] = prev;
1186 m_csi[t * num_states + j] = j;
1187 m_Gamma[t * num_states + j] = self;
1190 m_Gamma[t * num_states + j] = m_Gamma[t * num_states + j] + m_b[t * num_states + j];
1199 for (j = 0; j < num_states; j++)
1202 m_Gamma[ t*num_states + j] = m_Gamma[(t-1) * num_states + 0] + m_a[0*num_states+j];
1203 m_csi[t *num_states + j] = 0;
1205 for (i = 1; i < num_states; i++)
1207 float currGamma = m_Gamma[(t-1) *num_states + i] + m_a[i *num_states + j];
1208 if (currGamma > m_Gamma[t *num_states + j])
1210 m_Gamma[t * num_states + j] = currGamma;
1211 m_csi[t * num_states + j] = i;
1214 m_Gamma[t *num_states + j] = m_Gamma[t *num_states + j] + m_b[t * num_states + j];
1228 m_MaxGamma[i] = m_Gamma[last_obs * num_states + num_states - 1];
1229 q[i][last_obs] = num_states - 1;
1235 m_MaxGamma[i] = m_Gamma[last_obs * num_states + 0];
1237 for(k = 1; k < num_states; k++)
1239 if ( m_Gamma[last_obs * num_states + k] > m_MaxGamma[i] )
1241 m_MaxGamma[i] = m_Gamma[last_obs * num_states + k];
1251 q[i][t] = m_csi[(t+1) * num_states + q[i][t+1] ];
1287 CvMatr32f superB = icvCreateMatrix_32f(hmm->num_states, obs_info->obs_y );
1290 int*** q = (int***)cvAlloc( hmm->num_states * sizeof(int**) );
1293 for (i = 0; i < hmm->num_states; i++)
1304 for (i = 0; i < hmm->num_states; i++)
1313 icvViterbiSegmentation( ehmm->num_states, obs_info->obs_x,
1318 superB[j * hmm->num_states + i] = max_gamma * inv_obs_x;
1324 icvViterbiSegmentation( hmm->num_states, obs_info->obs_y,
1350 for (i = 0; i < hmm->num_states; i++)
1381 for(i = 0; i < hmm->num_states; i++ )
1383 total+= hmm->u.ehmm[i].num_states;