mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 06:03:15 +08:00
fixed build issue (MSVC2010, x64)
This commit is contained in:
parent
a811a08d0d
commit
26d348a5b7
@ -519,9 +519,9 @@ int build_knearest_classifier( char* data_filename, int K )
|
||||
CvKNearest knearest(&train_data, train_resp);
|
||||
|
||||
CvMat* nearests = cvCreateMat( (nsamples_all - ntrain_samples), K, CV_32FC1);
|
||||
float _sample[var_count * (nsamples_all - ntrain_samples)];
|
||||
float* _sample = new float[var_count * (nsamples_all - ntrain_samples)];
|
||||
CvMat sample = cvMat( nsamples_all - ntrain_samples, 16, CV_32FC1, _sample );
|
||||
float true_results[nsamples_all - ntrain_samples];
|
||||
float* true_results = new float[nsamples_all - ntrain_samples];
|
||||
for (int j = ntrain_samples; j < nsamples_all; j++)
|
||||
{
|
||||
float *s = data->data.fl + j * var_count;
|
||||
@ -550,6 +550,8 @@ int build_knearest_classifier( char* data_filename, int K )
|
||||
printf("true_resp = %f%%\tavg accuracy = %f%%\n", (float)true_resp / (nsamples_all - ntrain_samples) * 100,
|
||||
(float)accuracy / (nsamples_all - ntrain_samples) / K * 100);
|
||||
|
||||
delete[] true_results;
|
||||
delete[] _sample;
|
||||
cvReleaseMat( &train_resp );
|
||||
cvReleaseMat( &nearests );
|
||||
cvReleaseMat( &result );
|
||||
@ -593,9 +595,9 @@ int build_nbayes_classifier( char* data_filename )
|
||||
train_resp->data.fl[i] = responses->data.fl[i];
|
||||
CvNormalBayesClassifier nbayes(&train_data, train_resp);
|
||||
|
||||
float _sample[var_count * (nsamples_all - ntrain_samples)];
|
||||
float* _sample = new float[var_count * (nsamples_all - ntrain_samples)];
|
||||
CvMat sample = cvMat( nsamples_all - ntrain_samples, 16, CV_32FC1, _sample );
|
||||
float true_results[nsamples_all - ntrain_samples];
|
||||
float* true_results = new float[nsamples_all - ntrain_samples];
|
||||
for (int j = ntrain_samples; j < nsamples_all; j++)
|
||||
{
|
||||
float *s = data->data.fl + j * var_count;
|
||||
@ -618,6 +620,8 @@ int build_nbayes_classifier( char* data_filename )
|
||||
|
||||
printf("true_resp = %f%%\n", (float)true_resp / (nsamples_all - ntrain_samples) * 100);
|
||||
|
||||
delete[] true_results;
|
||||
delete[] _sample;
|
||||
cvReleaseMat( &train_resp );
|
||||
cvReleaseMat( &result );
|
||||
cvReleaseMat( &data );
|
||||
|
Loading…
Reference in New Issue
Block a user