summaryrefslogtreecommitdiff
path: root/offsetProject/src/imageStore.h
diff options
context:
space:
mode:
Diffstat (limited to 'offsetProject/src/imageStore.h')
-rw-r--r--offsetProject/src/imageStore.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/offsetProject/src/imageStore.h b/offsetProject/src/imageStore.h
index 2f8ccbb..58ef560 100644
--- a/offsetProject/src/imageStore.h
+++ b/offsetProject/src/imageStore.h
@@ -123,11 +123,12 @@ class imageStore : public ofThread{
Matrix<float> query(test,1,3);
Matrix<int> indices(new int[1], query.rows, 1);
Matrix<float> dists(new float[1], query.rows, 1);
- index->knnSearch(query, indices, dists, 1,SearchParams(20));
+ index->knnSearch(query, indices, dists, 1,SearchParams(10));
im=*imageptrs[*indices[0]];
//int i=rand()%imageptrs.size();
//im=images[imageptrs[i]];
//cerr<<"returning image "<<i<<endl;
+ delete[] test;
unlock();
}
return im;
@@ -136,14 +137,18 @@ class imageStore : public ofThread{
ofImage& get_image(float* data){
ofImage& im=images.begin()->second;
if( lock() ){
+ int* it=new int[1];
+ float* ft=new float[1];
Matrix<float> query(data,1,FLANN_MATRIX_SIZE*FLANN_MATRIX_SIZE*3);
- Matrix<int> indices(new int[1], query.rows, 1);
- Matrix<float> dists(new float[1], query.rows, 1);
- index->knnSearch(query, indices, dists, 1,SearchParams(4));
+ Matrix<int> indices(it, query.rows, 1);
+ Matrix<float> dists(ft, query.rows, 1);
+ index->knnSearch(query, indices, dists, 1,SearchParams(10));
im=*imageptrs[*indices[0]];
//int i=rand()%imageptrs.size();
//im=images[imageptrs[i]];
//cerr<<"returning image "<<i<<endl;
+ delete[] it;
+ delete[] ft;
unlock();
}
return im;