summaryrefslogtreecommitdiff
path: root/offsetProject/src/imageStore.h
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-03-14 15:14:37 +0000
committerTim Redfern <tim@eclectronics.org>2014-03-14 15:14:37 +0000
commit2438e0a034d7ef50c8d7837ea415ca6a95a94fc0 (patch)
treea46dedd57b752163d0a0ca87dca657b3127ed2fd /offsetProject/src/imageStore.h
parentbcf4c0ac5428a1c3f331d66cf0c4a301d1f7a45f (diff)
publish version
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;