mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 11:10:21 +08:00
made the samples compile on Windows
This commit is contained in:
parent
9ca45daba3
commit
9702b5ef8a
@ -583,7 +583,7 @@ protected:
|
||||
class CV_EXPORTS DOTDetector
|
||||
{
|
||||
public:
|
||||
struct TrainParams
|
||||
struct CV_EXPORTS TrainParams
|
||||
{
|
||||
enum { BIN_COUNT = 7 };
|
||||
static double BIN_RANGE() { return 180.0 / BIN_COUNT; }
|
||||
@ -608,7 +608,7 @@ public:
|
||||
float minRatio;
|
||||
};
|
||||
|
||||
struct DetectParams
|
||||
struct CV_EXPORTS DetectParams
|
||||
{
|
||||
DetectParams();
|
||||
DetectParams( float minRatio, int minRegionSize, int maxRegionSize, int regionSizeStep,
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "opencv2/ml/ml.hpp"
|
||||
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
/*
|
||||
|
||||
*/
|
||||
@ -667,9 +668,9 @@ int build_svm_classifier( char* data_filename )
|
||||
svm.train(&train_data, train_resp, 0, 0, param);
|
||||
|
||||
// classification
|
||||
float _sample[var_count * (nsamples_all - ntrain_samples)];
|
||||
CvMat sample = cvMat( nsamples_all - ntrain_samples, 16, CV_32FC1, _sample );
|
||||
float true_results[nsamples_all - ntrain_samples];
|
||||
std::vector<float> _sample(var_count * (nsamples_all - ntrain_samples));
|
||||
CvMat sample = cvMat( nsamples_all - ntrain_samples, 16, CV_32FC1, &_sample[0] );
|
||||
std::vector<float> true_results(nsamples_all - ntrain_samples);
|
||||
for (int j = ntrain_samples; j < nsamples_all; j++)
|
||||
{
|
||||
float *s = data->data.fl + j * var_count;
|
||||
@ -683,7 +684,7 @@ int build_svm_classifier( char* data_filename )
|
||||
CvMat *result = cvCreateMat(1, nsamples_all - ntrain_samples, CV_32FC1);
|
||||
|
||||
printf("Classification (may take a few minutes)...\n");
|
||||
(int)svm.predict(&sample, result);
|
||||
svm.predict(&sample, result);
|
||||
|
||||
int true_resp = 0;
|
||||
for (int i = 0; i < nsamples_all - ntrain_samples; i++)
|
||||
|
Loading…
Reference in New Issue
Block a user