+void CriKeyPoint::update_parameter(CriKeyPoint *prev, CriKeyPoint *src)
+{
+ if( prev->e != src->e ) e = src->e;
+ if( prev->x != src->x ) x = src->x;
+ if( prev->y != src->y ) y = src->y;
+ if( prev->t != src->t ) t = src->t;
+}
+
+void CriKey::update_parameter(CriKeyConfig &prev_config, CriKeyConfig &src_config,
+ KeyFrame *keyframe)
+{
+ CriKeyConfig dst_config;
+ dst_config.read_data(keyframe);
+ if( !EQUIV(prev_config.threshold, src_config.threshold) )
+ dst_config.threshold = src_config.threshold;
+ if( prev_config.draw_mode != src_config.draw_mode )
+ dst_config.draw_mode = src_config.draw_mode;
+ int src_points = src_config.points.size();
+ int dst_points = dst_config.points.size();
+ int prev_points = prev_config.points.size();
+ int npoints = bmin(prev_points, bmin(src_points, dst_points));
+ for( int i=0; i<npoints; ++i ) {
+ CriKeyPoint *src_point = src_config.points[i];
+ int tag = src_point->tag, k = prev_points;
+ while( --k >= 0 && tag != prev_config.points[k]->tag );
+ if( k < 0 ) continue;
+ CriKeyPoint *prev_point = prev_config.points[k];
+ k = dst_points;
+ while( --k >= 0 && tag != dst_config.points[k]->tag );
+ if( k < 0 ) continue;
+ CriKeyPoint *dst_point = dst_config.points[k];
+ dst_point->update_parameter(prev_point, src_point);
+ }
+ dst_config.save_data(keyframe);