Fixed number of warnings. Fixed mingw64 build.
This commit is contained in:
@@ -32,23 +32,20 @@ static void help()
|
||||
// define whether to use approximate nearest-neighbor search
|
||||
#define USE_FLANN
|
||||
|
||||
|
||||
IplImage* image = 0;
|
||||
|
||||
#ifdef USE_FLANN
|
||||
static void
|
||||
flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
const CvSeq*, const CvSeq* imageDescriptors, vector<int>& ptpairs )
|
||||
{
|
||||
int length = (int)(objectDescriptors->elem_size/sizeof(float));
|
||||
int length = (int)(objectDescriptors->elem_size/sizeof(float));
|
||||
|
||||
cv::Mat m_object(objectDescriptors->total, length, CV_32F);
|
||||
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
|
||||
cv::Mat m_image(imageDescriptors->total, length, CV_32F);
|
||||
|
||||
|
||||
// copy descriptors
|
||||
// copy descriptors
|
||||
CvSeqReader obj_reader;
|
||||
float* obj_ptr = m_object.ptr<float>(0);
|
||||
float* obj_ptr = m_object.ptr<float>(0);
|
||||
cvStartReadSeq( objectDescriptors, &obj_reader );
|
||||
for(int i = 0; i < objectDescriptors->total; i++ )
|
||||
{
|
||||
@@ -58,7 +55,7 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
obj_ptr += length;
|
||||
}
|
||||
CvSeqReader img_reader;
|
||||
float* img_ptr = m_image.ptr<float>(0);
|
||||
float* img_ptr = m_image.ptr<float>(0);
|
||||
cvStartReadSeq( imageDescriptors, &img_reader );
|
||||
for(int i = 0; i < imageDescriptors->total; i++ )
|
||||
{
|
||||
@@ -77,10 +74,10 @@ flannFindPairs( const CvSeq*, const CvSeq* objectDescriptors,
|
||||
int* indices_ptr = m_indices.ptr<int>(0);
|
||||
float* dists_ptr = m_dists.ptr<float>(0);
|
||||
for (int i=0;i<m_indices.rows;++i) {
|
||||
if (dists_ptr[2*i]<0.6*dists_ptr[2*i+1]) {
|
||||
ptpairs.push_back(i);
|
||||
ptpairs.push_back(indices_ptr[2*i]);
|
||||
}
|
||||
if (dists_ptr[2*i]<0.6*dists_ptr[2*i+1]) {
|
||||
ptpairs.push_back(i);
|
||||
ptpairs.push_back(indices_ptr[2*i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -234,7 +231,7 @@ int main(int argc, char** argv)
|
||||
cvNamedWindow("Object", 1);
|
||||
cvNamedWindow("Object Correspond", 1);
|
||||
|
||||
static CvScalar colors[] =
|
||||
static CvScalar colors[] =
|
||||
{
|
||||
{{0,0,255}},
|
||||
{{0,128,255}},
|
||||
|
||||
@@ -179,7 +179,7 @@ static const char* var_desc[] =
|
||||
};
|
||||
|
||||
|
||||
static void print_variable_importance( CvDTree* dtree, const char** var_desc )
|
||||
static void print_variable_importance( CvDTree* dtree )
|
||||
{
|
||||
const CvMat* var_importance = dtree->get_var_importance();
|
||||
int i;
|
||||
@@ -201,21 +201,16 @@ static void print_variable_importance( CvDTree* dtree, const char** var_desc )
|
||||
for( i = 0; i < var_importance->cols*var_importance->rows; i++ )
|
||||
{
|
||||
double val = var_importance->data.db[i];
|
||||
if( var_desc )
|
||||
{
|
||||
char buf[100];
|
||||
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
|
||||
strncpy( buf, var_desc[i], len );
|
||||
buf[len] = '\0';
|
||||
printf( "%s", buf );
|
||||
}
|
||||
else
|
||||
printf( "var #%d", i );
|
||||
char buf[100];
|
||||
int len = (int)(strchr( var_desc[i], '(' ) - var_desc[i] - 1);
|
||||
strncpy( buf, var_desc[i], len );
|
||||
buf[len] = '\0';
|
||||
printf( "%s", buf );
|
||||
printf( ": %g%%\n", val*100. );
|
||||
}
|
||||
}
|
||||
|
||||
static void interactive_classification( CvDTree* dtree, const char** var_desc )
|
||||
static void interactive_classification( CvDTree* dtree )
|
||||
{
|
||||
char input[1000];
|
||||
const CvDTreeNode* root;
|
||||
@@ -319,8 +314,8 @@ int main( int argc, char** argv )
|
||||
cvReleaseMat( &missing );
|
||||
cvReleaseMat( &responses );
|
||||
|
||||
print_variable_importance( dtree, var_desc );
|
||||
interactive_classification( dtree, var_desc );
|
||||
print_variable_importance( dtree );
|
||||
interactive_classification( dtree );
|
||||
delete dtree;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user