Collected data comparison

I have real time data from IR camera. I collect 3d positional data from camera.
what I want to ask is that for each 250 miliseconds I want to check the positional data. If changes smaller than my threshold do something(Not important).
IF not continue. Could you please help me ?
Do I need a vector to keep p. data. If so, how can I compare the data?
Thanks

Don't use a vector, use a deque. (It has better memory characteristics for large data.)

If you load all your data into the deque, just use a loop through it all:

1
2
#include <algorithm>
#include <deque> 
1
2
3
4
5
6
my_position3d_object p = my_data[ 0 ];
for (size_t n = 1; n < my_data.size(); n++)
  {
  if (difference_between( p, my_data[ n ] ) < whatever)
    do_something( not_important );
  }

Hope this helps.
Sorry, I am not an expert programmer. Can you please open up the data types that you already defined.

I defined my_data as an deque<double>my_data

here difference_between function
1
2
3
4
5
double difference_between(CVector markerPos,deque<double>pos_data)
{
double diff = markerPos.x - pos_data[]; //my be not true.
return diff;
}


and
1
2
3
4
5
6
7
8
9
10
void f()
{
  my_position3d_object p = my_data[ 0 ];  //Here my_position3d_object  seems like CVector but did not understand equality.
  my_data.push_back(markerPos.x);
  for (size_t n = 1; n < my_data.size(); n++)
  {
   if (difference_between( p, my_data[ n ] ) < whatever)
    do_something( not_important );
  }
}


Last edited on
Topic archived. No new replies allowed.