superquadric-model
Public Member Functions | Data Fields | Protected Attributes
SuperqComputation Class Reference

This class provides a thread for computing in real time the superquadric, filtering the point cloud and the superquadric. More...

#include <superqComputation.h>

Inherits Thread.

Public Member Functions

 SuperqComputation (yarp::os::Mutex &mutex_shared, int _rate, bool _filter_points, bool _filter_superq, bool _fixed_window, std::deque< yarp::sig::Vector > &_points, std::string _tag_file, double _threshold_median, const yarp::os::Property &filters_points_par, yarp::sig::Vector &_x, yarp::sig::Vector &_x_filtered, const yarp::os::Property &filters_superq_par, const yarp::os::Property &optimizer_par, const std::string &_homeContextPath, bool _save_points, yarp::os::ResourceFinder *rf)
 
void setPointsFilterPar (const yarp::os::Property &newOptions, bool first_time)
 Set options for filtering the point cloud. More...
 
void setSuperqFilterPar (const yarp::os::Property &newOptions, bool first_time)
 Set options for filtering the superquadric. More...
 
void setIpoptPar (const yarp::os::Property &newOptions, bool first_time)
 Set options for the optimization problem solved by Ipopt. More...
 
yarp::os::Property getPointsFilterPar ()
 Get options used for filtering the point cloud. More...
 
yarp::os::Property getSuperqFilterPar ()
 Get options used for filtering the superquadric. More...
 
yarp::os::Property getIpoptPar ()
 Get options used for solving the optimization problem with Ipopt. More...
 
void setPar (const std::string &par_name, const std::string &value)
 Set a parameter equal to a value. More...
 
virtual bool threadInit ()
 Init function of Thread class.
 
virtual void run ()
 Run function of Thread class.
 
virtual void threadRelease ()
 Release function of Thread class.
 
void savePoints (const std::string &namefile, const yarp::sig::Vector &colors)
 Save point cloud used for reconstructing the superquadric. More...
 
bool readPointCloud ()
 Read the object point cloud from txt for offline tests.
 
void filter ()
 Filter the received point cloud.
 
bool computeSuperq ()
 Compute the superquadric modeling the object. More...
 
void filterSuperq ()
 Filter the superquadri with the median filter.
 
void resetMedianFilter ()
 Reset median filter.
 
int adaptWindComputation ()
 Compute window size according to the object velocity.
 
bool configFilterSuperq ()
 Configure superquadric filter.
 
bool config3Dpoints ()
 Configure point cloud filter.
 
yarp::sig::Vector getSolution (bool filtered_or_not)
 Return the computed superquadric. More...
 
void sendPoints (const std::deque< yarp::sig::Vector > &p)
 Get the point cloud for computing the superquadric. More...
 
void getPoints3D ()
 Get the point cloud for computing the superquadric.
 
double getTime ()
 Return the computation time for estimating the superquadric. More...
 

Data Fields

int std_median_order
 median order width
 
int max_median_order
 max median order width
 
yarp::sig::Vector & x
 Object superquadric.
 
yarp::sig::Vector & x_filtered
 Filtered object superquadric.
 
std::deque< yarp::sig::Vector > & points
 Object point cloud.
 
std::deque< cv::Point > blob_points
 Object 2D blob.
 

Protected Attributes

int count
 Count variable.
 
bool save_points
 Boolean variable for enabling point cloud saving.
 
std::string tag_file
 Tag name of files for saving 3D points.
 
std::string homeContextPath
 Path where code context is located.
 
yarp::os::ConstString pointCloudFileName
 Pointcloud name file in case the module runs offline.
 
std::vector< cv::Point > contour
 OpenCV variable for blob extraction.
 
yarp::os::BufferedPort< yarp::os::Bottle > pointPort
 Port for receiving point cloud.
 
double radius
 Radius for spatial density filter.
 
int nnThreshold
 Density threshold for spatial density filter.
 
int numVertices
 
int median_order
 Median filder order.
 
int min_median_order
 Minimum median filder order allowed.
 
int new_median_order
 New median filder order estimated.
 
bool filter_points
 Boolean variable for enabling point cloud filtering.
 
bool fixed_window
 Boolean variable for enabling the use of a fixed window during the median filter.
 
bool filter_superq
 Boolean variable for enabling superquadric filtering.
 
double threshold_median
 Threshold for velocity estimation for median order.
 
double min_norm_vel
 Minimum norm of velocity for considering the object moving.
 
bool go_on
 Boolean variable for going to the next step of the state machine.
 
bool one_shot
 
double tol
 Tolerance of the optimization problem.
 
double sum
 
double max_cpu_time
 Max cpu time allowed for solving the optimization problem.
 
int acceptable_iter
 Acceptable iter of Ipopt algorithm.
 
int max_iter
 Maximum iteration allowed of Ipopt algorithm.
 
int optimizer_points
 Number of 3D points used for optimization.
 
bool bounds_automatic
 Boolean varibal for enabling automatic computation of variables bounds.
 
std::string mu_strategy
 Mu strategy of the Ipopt algorithm.
 
std::string nlp_scaling_method
 NLP scaling method of the Ipopt algorithm.
 
yarp::sig::Vector elem_x
 
double t_superq
 Time required for computing superquadric.
 
int count_file
 
std::string ob_class
 Objec class: cylinder, sphere of box.
 
yarp::os::ResourceFinder * rf
 
double t
 
double t0
 
yarp::os::Mutex mutex
 
yarp::os::Mutex & mutex_shared
 
iCub::ctrl::MedianFilter * mFilter
 Median filter for discarding wrong superquadrics.
 
iCub::ctrl::AWPolyEstimator * PolyEst
 Time Polyestimator for estimating object velocity.
 
yarp::os::Property filter_points_par
 Parameters of point cloud filter.
 
yarp::os::Property filter_superq_par
 Parameters of superquadric filter.
 
yarp::os::Property ipopt_par
 Parameters of the Ipopt optimization problem.
 

Detailed Description

This class provides a thread for computing in real time the superquadric, filtering the point cloud and the superquadric.

The optimization problem for estimating the superquadric is solved with Ipopt software package.

Definition at line 48 of file superqComputation.h.

Member Function Documentation

◆ computeSuperq()

bool SuperqComputation::computeSuperq ( )

Compute the superquadric modeling the object.

Returns
true/false on success/failure

Definition at line 742 of file superqComputation.cpp.

References acceptable_iter, bounds_automatic, SuperQuadric_NLP::init(), max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, ob_class, optimizer_points, points, savePoints(), tag_file, tol, and x.

Referenced by run().

743 {
744  Vector colors(3,0.0);
745  colors[1]=255;
746 
747  savePoints("/3Dpoints-"+tag_file, colors);
748 
749  Ipopt::SmartPtr<Ipopt::IpoptApplication> app=new Ipopt::IpoptApplication;
750  app->Options()->SetNumericValue("tol",tol);
751  app->Options()->SetIntegerValue("acceptable_iter",acceptable_iter);
752  app->Options()->SetStringValue("mu_strategy",mu_strategy);
753  app->Options()->SetIntegerValue("max_iter",max_iter);
754  app->Options()->SetNumericValue("max_cpu_time",max_cpu_time);
755  app->Options()->SetStringValue("nlp_scaling_method",nlp_scaling_method);
756  app->Options()->SetStringValue("hessian_approximation","limited-memory");
757  app->Options()->SetIntegerValue("print_level",0);
758  app->Initialize();
759 
760  Ipopt::SmartPtr<SuperQuadric_NLP> superQ_nlp= new SuperQuadric_NLP;
761 
762  superQ_nlp->init();
763  superQ_nlp->configure(this->rf,bounds_automatic, ob_class);
764 
765  superQ_nlp->setPoints(points, optimizer_points);
766 
767  double t0_superq=Time::now();
768 
769  yDebug()<<"[SuperqComputation]: Start IPOPT ";
770 
771  Ipopt::ApplicationReturnStatus status=app->OptimizeTNLP(GetRawPtr(superQ_nlp));
772 
773  yDebug()<<"[SuperqComputation]: Finish IPOPT ";
774 
775  double t_s=Time::now()-t0_superq;
776 
777  if (status==Ipopt::Solve_Succeeded)
778  {
779  x=superQ_nlp->get_result();
780  yInfo("[SuperqComputation]: Solution of the optimization problem: %s", x.toString(3,3).c_str());
781  yInfo("[SuperqComputation]: Execution time : %f", t_s);
782  return true;
783  }
784  else if(status==Ipopt::Maximum_CpuTime_Exceeded)
785  {
786  x=superQ_nlp->get_result();
787  yWarning("[SuperqComputation]: Solution after maximum time exceeded: %s", x.toString(3,3).c_str());
788  return true;
789  }
790  else
791  {
792  x.resize(11,0.0);
793  return false;
794  }
795 }
bool bounds_automatic
Boolean varibal for enabling automatic computation of variables bounds.
double max_cpu_time
Max cpu time allowed for solving the optimization problem.
std::string tag_file
Tag name of files for saving 3D points.
double tol
Tolerance of the optimization problem.
std::string mu_strategy
Mu strategy of the Ipopt algorithm.
std::deque< yarp::sig::Vector > & points
Object point cloud.
int max_iter
Maximum iteration allowed of Ipopt algorithm.
void savePoints(const std::string &namefile, const yarp::sig::Vector &colors)
Save point cloud used for reconstructing the superquadric.
std::string ob_class
Objec class: cylinder, sphere of box.
int optimizer_points
Number of 3D points used for optimization.
This class solves the optimization problem with the Ipopt software package and returns the estiamted ...
Definition: superquadric.h:36
std::string nlp_scaling_method
NLP scaling method of the Ipopt algorithm.
void init()
Init function.
int acceptable_iter
Acceptable iter of Ipopt algorithm.
yarp::sig::Vector & x
Object superquadric.

◆ getIpoptPar()

Property SuperqComputation::getIpoptPar ( )

Get options used for solving the optimization problem with Ipopt.

Returns
a property with the options on ipopt / /*

Definition at line 418 of file superqComputation.cpp.

References acceptable_iter, max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, optimizer_points, and tol.

419 {
420  LockGuard lg(mutex);
421 
422  Property advOptions;
423  advOptions.put("optimizer_points",optimizer_points);
424  advOptions.put("max_cpu_time",max_cpu_time);
425  advOptions.put("tol",tol);
426  advOptions.put("max_iter",max_iter);
427  advOptions.put("acceptable_iter",acceptable_iter);
428  advOptions.put("IPOPT_mu_strategy",mu_strategy);
429  advOptions.put("IPOPT_nlp_scaling_method",nlp_scaling_method);
430  return advOptions;
431 }
double max_cpu_time
Max cpu time allowed for solving the optimization problem.
double tol
Tolerance of the optimization problem.
std::string mu_strategy
Mu strategy of the Ipopt algorithm.
int max_iter
Maximum iteration allowed of Ipopt algorithm.
int optimizer_points
Number of 3D points used for optimization.
std::string nlp_scaling_method
NLP scaling method of the Ipopt algorithm.
int acceptable_iter
Acceptable iter of Ipopt algorithm.

◆ getPointsFilterPar()

Property SuperqComputation::getPointsFilterPar ( )

Get options used for filtering the point cloud.

Returns
a property with the options on the points filtering

Definition at line 120 of file superqComputation.cpp.

References nnThreshold, and radius.

121 {
122  LockGuard lg(mutex);
123 
124  Property advOptions;
125  advOptions.put("filter_radius",radius);
126  advOptions.put("filter_nnThreshold",nnThreshold);
127  return advOptions;
128 }
double radius
Radius for spatial density filter.
int nnThreshold
Density threshold for spatial density filter.

◆ getSolution()

Vector SuperqComputation::getSolution ( bool  filtered_or_not)

Return the computed superquadric.

Parameters
filtered_or_notcan be "on" or "off"
Returns
the estimated superquadric filtered or not

Definition at line 867 of file superqComputation.cpp.

References x, and x_filtered.

868 {
869  LockGuard lg(mutex);
870 
871  if (filtered_superq==false)
872  return x;
873  else
874  return x_filtered;
875 }
yarp::sig::Vector & x_filtered
Filtered object superquadric.
yarp::sig::Vector & x
Object superquadric.

◆ getSuperqFilterPar()

Property SuperqComputation::getSuperqFilterPar ( )

Get options used for filtering the superquadric.

Returns
a property with the options on superquadric filtering / /*

Definition at line 259 of file superqComputation.cpp.

References fixed_window, max_median_order, min_median_order, min_norm_vel, std_median_order, and threshold_median.

260 {
261  LockGuard lg(mutex);
262 
263  Property advOptions;
264  if (fixed_window)
265  advOptions.put("fixed_window","on");
266  else
267  advOptions.put("fixed_window","off");
268  advOptions.put("median_order",std_median_order);
269  advOptions.put("min_median_order",min_median_order);
270  advOptions.put("max_median_order",max_median_order);
271  advOptions.put("threshold_median",threshold_median);
272  advOptions.put("min_norm_vel",min_norm_vel);
273  return advOptions;
274 }
double min_norm_vel
Minimum norm of velocity for considering the object moving.
int max_median_order
max median order width
int std_median_order
median order width
int min_median_order
Minimum median filder order allowed.
bool fixed_window
Boolean variable for enabling the use of a fixed window during the median filter. ...
double threshold_median
Threshold for velocity estimation for median order.

◆ getTime()

double SuperqComputation::getTime ( )

Return the computation time for estimating the superquadric.

Returns
the period value

Definition at line 451 of file superqComputation.cpp.

References t_superq.

452 {
453  LockGuard lg(mutex);
454  return t_superq;
455 }
double t_superq
Time required for computing superquadric.

◆ savePoints()

void SuperqComputation::savePoints ( const std::string &  namefile,
const yarp::sig::Vector &  colors 
)

Save point cloud used for reconstructing the superquadric.

Parameters
namefileis the name of the file where to save the superquadric
colorsis a Vector with the color to be used for saving the point cloud

Definition at line 622 of file superqComputation.cpp.

References homeContextPath, points, and save_points.

Referenced by computeSuperq(), and filter().

623 {
624  if (save_points)
625  {
626  ofstream fout;
627  stringstream ss;
628  ss<<count_file;
629  string count_file_str=ss.str();
630  fout.open((homeContextPath+namefile+count_file_str+".off").c_str());
631 
632  if (fout.is_open())
633  {
634  fout<<"COFF"<<endl;
635  fout<<points.size()<<" 0 0"<<endl;
636  fout<<endl;
637  for (size_t i=0; i<points.size(); i++)
638  {
639  int r=points[i][3];
640  int g=points[i][4];
641  int b=points[i][5];
642  fout<<points[i].subVector(0,2).toString(3,3)<<" "<<r<<" "<<g<<" "<<b<<endl;
643  }
644 
645  fout<<endl;
646  }
647  else
648  yError()<<"[SuperqComputation]: Some problems in opening output file!";
649 
650  fout.close();
651 
652  count_file++;
653  }
654 }
bool save_points
Boolean variable for enabling point cloud saving.
std::deque< yarp::sig::Vector > & points
Object point cloud.
std::string homeContextPath
Path where code context is located.

◆ sendPoints()

void SuperqComputation::sendPoints ( const std::deque< yarp::sig::Vector > &  p)

Get the point cloud for computing the superquadric.

Parameters
pis the object point cloud

Definition at line 878 of file superqComputation.cpp.

References points.

879 {
880  LockGuard lg(mutex);
881 
882  points.clear();
883 
884  for (int i=0; i<p.size(); i++)
885  {
886  points.push_back(p[i]);
887  }
888 }
std::deque< yarp::sig::Vector > & points
Object point cloud.

◆ setIpoptPar()

void SuperqComputation::setIpoptPar ( const yarp::os::Property &  newOptions,
bool  first_time 
)

Set options for the optimization problem solved by Ipopt.

Parameters
newOptionsis a Property with the new options to set
first_timetakes into account if the options have already been set or not

Definition at line 277 of file superqComputation.cpp.

References acceptable_iter, max_cpu_time, max_iter, mu_strategy, nlp_scaling_method, optimizer_points, points, and tol.

Referenced by threadInit().

278 {
279  LockGuard lg(mutex);
280 
281  int points=newOptions.find("optimizer_points").asInt();
282  if (newOptions.find("optimizer_points").isNull() && (first_time==true))
283  {
284  optimizer_points=50;
285  }
286  else if (!newOptions.find("optimizer_points").isNull())
287  {
288  if ((points>=10) && (points<=300))
289  {
291  }
292  else if (points<10)
293  {
294  optimizer_points=10;
295  }
296  else if (points>300)
297  {
298  optimizer_points=300;
299  }
300  }
301 
302  double maxCpuTime=newOptions.find("max_cpu_time").asDouble();
303  if (newOptions.find("max_cpu_time").isNull() && (first_time==true))
304  {
305  max_cpu_time=5.0;
306  }
307  else if (!newOptions.find("max_cpu_time").isNull())
308  {
309  if ((maxCpuTime>=0.01) && (maxCpuTime<=10.0))
310  {
311  max_cpu_time=maxCpuTime;
312  }
313  else if (maxCpuTime<0.01)
314  {
315  max_cpu_time=0.01;
316  }
317  else if (maxCpuTime>10.0)
318  {
319  max_cpu_time=10.0;
320  }
321  }
322 
323  double tolValue=newOptions.find("tol").asDouble();
324  if (newOptions.find("tol").isNull() && (first_time==true))
325  {
326  tol=1e-5;
327  }
328  else if (!newOptions.find("tol").isNull())
329  {
330  if ((tolValue>1e-8) && (tolValue<=0.01))
331  {
332  tol=tolValue;
333  }
334  else if (tolValue<1e-8)
335  {
336  tol=1e-8;
337  }
338  else if (tolValue>0.01)
339  {
340  tol=0.01;
341  }
342  }
343 
344  int accIter=newOptions.find("acceptable_iter").asInt();
345  if (newOptions.find("acceptable_iter").isNull() && (first_time==true))
346  {
347  acceptable_iter=0;
348  }
349  else if (!newOptions.find("acceptable_iter").isNull())
350  {
351  if ((accIter>=0 )&& (accIter<=10))
352  {
353  acceptable_iter=accIter;
354  }
355  else if (accIter<0)
356  {
357  acceptable_iter=0;
358  }
359  else if (accIter>10)
360  {
361  acceptable_iter=10;
362  }
363  }
364 
365  int maxIter=newOptions.find("max_iter").asInt();
366  if (newOptions.find("max_iter").isNull() && (first_time==true))
367  {
368  max_iter=100;
369  }
370  else if (!newOptions.find("max_iter").isNull())
371  {
372  if ((maxIter>1))
373  {
374  max_iter=maxIter;
375  }
376  else
377  {
378  max_iter=100;
379  }
380  }
381 
382  string mu_str=newOptions.find("mu_strategy").asString();
383  if (newOptions.find("mu_strategy").isNull() && (first_time==true))
384  {
385  mu_strategy="monotone";
386  }
387  else if (!newOptions.find("mu_strategy").isNull())
388  {
389  if ((mu_str=="adaptive") || (mu_str=="monotone"))
390  {
391  mu_strategy=mu_str;
392  }
393  else
394  {
395  mu_strategy="monotone";
396  }
397  }
398 
399  string nlp=newOptions.find("nlp_scaling_method").asString();
400  if (newOptions.find("nlp_scaling_method").isNull() && (first_time==true))
401  {
402  nlp_scaling_method="gradient-based";
403  }
404  else if (!newOptions.find("nlp_scaling_method").isNull())
405  {
406  if ((nlp=="none") || (nlp=="gradient-based"))
407  {
408  nlp_scaling_method=nlp;
409  }
410  else
411  {
412  nlp_scaling_method="gradient-based";
413  }
414  }
415 }
double max_cpu_time
Max cpu time allowed for solving the optimization problem.
double tol
Tolerance of the optimization problem.
std::string mu_strategy
Mu strategy of the Ipopt algorithm.
std::deque< yarp::sig::Vector > & points
Object point cloud.
int max_iter
Maximum iteration allowed of Ipopt algorithm.
int optimizer_points
Number of 3D points used for optimization.
std::string nlp_scaling_method
NLP scaling method of the Ipopt algorithm.
int acceptable_iter
Acceptable iter of Ipopt algorithm.

◆ setPar()

void SuperqComputation::setPar ( const std::string &  par_name,
const std::string &  value 
)

Set a parameter equal to a value.

Parameters
par_nameis the name of the variable we want to change
valueis the new balue

Definition at line 434 of file superqComputation.cpp.

References filter_points, filter_superq, ob_class, save_points, and tag_file.

435 {
436  if (par_name=="tag_file")
437  tag_file=value;
438  else if (par_name=="filter_points")
439  filter_points=(value=="on");
440  else if (par_name=="filter_superq")
441  filter_superq=(value=="on");
442  else if (par_name=="save_points")
443  save_points=(value=="on");
444  else if (par_name=="one_shot")
445  one_shot=(value=="on");
446  else if (par_name=="object_class")
447  ob_class=value;
448 }
bool filter_points
Boolean variable for enabling point cloud filtering.
std::string tag_file
Tag name of files for saving 3D points.
bool filter_superq
Boolean variable for enabling superquadric filtering.
bool save_points
Boolean variable for enabling point cloud saving.
std::string ob_class
Objec class: cylinder, sphere of box.

◆ setPointsFilterPar()

void SuperqComputation::setPointsFilterPar ( const yarp::os::Property &  newOptions,
bool  first_time 
)

Set options for filtering the point cloud.

Parameters
newOptionsis a Property with the new options to set
first_timetakes into account if the options have already been set or not

Definition at line 76 of file superqComputation.cpp.

References nnThreshold, and radius.

Referenced by threadInit().

77 {
78  LockGuard lg(mutex);
79 
80  double radiusValue=newOptions.find("filter_radius").asDouble();
81  if (newOptions.find("filter_radius").isNull() && (first_time==true))
82  {
83  radius=0.01;
84  }
85  else if (!newOptions.find("filter_radius").isNull())
86  {
87  if ((radiusValue>0.0000001) && (radiusValue<0.01))
88  {
89  radius=radiusValue;
90  }
91  else if ((radiusValue>=0.01))
92  {
93  radius=0.01;
94  }
95  else if ((radiusValue<=0.0000001))
96  {
97  radius=0.0000001;
98  }
99  }
100 
101  int nnThreValue=newOptions.find("filter_nnThreshold").asInt();
102  if (newOptions.find("filter_nnThreshold").isNull() && (first_time==true))
103  {
104  nnThreshold=100;
105  }
106  else if (!newOptions.find("filter_nnThreshold").isNull())
107  {
108  if ((nnThreValue>0) && (nnThreValue<100))
109  {
110  nnThreshold=nnThreValue;
111  }
112  else
113  {
114  nnThreshold=100;
115  }
116  }
117 }
double radius
Radius for spatial density filter.
int nnThreshold
Density threshold for spatial density filter.

◆ setSuperqFilterPar()

void SuperqComputation::setSuperqFilterPar ( const yarp::os::Property &  newOptions,
bool  first_time 
)

Set options for filtering the superquadric.

Parameters
newOptionsis a Property with the new options to set
first_timetakes into account if the options have already been set or not

Definition at line 131 of file superqComputation.cpp.

References fixed_window, max_median_order, min_median_order, min_norm_vel, std_median_order, and threshold_median.

Referenced by threadInit().

132 {
133  LockGuard lg(mutex);
134 
135  int mOrderValue=newOptions.find("median_order").asInt();
136  if (newOptions.find("median_order").isNull() && (first_time==true))
137  {
139  }
140  else if (!newOptions.find("median_order").isNull())
141  {
142  if((mOrderValue>=1) && (mOrderValue<=50))
143  {
144  std_median_order=mOrderValue;
145  }
146  else if (mOrderValue<1)
147  {
149  }
150  else if (mOrderValue>50)
151  {
152  std_median_order=50;
153  }
154  }
155 
156  mOrderValue=newOptions.find("min_median_order").asInt();
157  if (newOptions.find("min_median_order").isNull() && (first_time==true))
158  {
160  }
161  else if (!newOptions.find("min_median_order").isNull())
162  {
163  if ((mOrderValue>=1) && (mOrderValue<=50))
164  {
165  min_median_order=mOrderValue;
166  }
167  else if (mOrderValue<1)
168  {
170  }
171  else if (mOrderValue>50)
172  {
173  min_median_order=50;
174  }
175  }
176 
177  mOrderValue=newOptions.find("max_median_order").asInt();
178  if (newOptions.find("max_median_order").isNull() && (first_time==true))
179  {
180  max_median_order=30;
181  }
182  else if (!newOptions.find("max_median_order").isNull())
183  {
184  if ((mOrderValue>=1) && (mOrderValue<=50) && (mOrderValue>=min_median_order))
185  {
186  max_median_order=mOrderValue;
187  }
188  else if ((mOrderValue<1) || (mOrderValue<min_median_order))
189  {
191  }
192  else if (mOrderValue>50)
193  {
194  max_median_order=50;
195  }
196  }
197 
198  double threValue=newOptions.find("threshold_median").asDouble();
199  if (newOptions.find("threhsold_median").isNull() && (first_time==true))
200  {
201  threshold_median=0.1;
202  }
203  else if (!newOptions.find("threhsold_median").isNull())
204  {
205  if ((threValue>0.005) && (threValue<=2.0))
206  {
207  threshold_median=threValue;
208  }
209  else if (threValue<0.005)
210  {
211  threshold_median=0.005;
212  }
213  else if (threValue>2.0)
214  {
215  threshold_median=2.0;
216  }
217  }
218 
219  double minNormVel=newOptions.find("min_norm_vel").asDouble();
220  if (newOptions.find("min_norm_vel").isNull() && (first_time==true))
221  {
222  min_norm_vel=0.01;
223  }
224  else if (!newOptions.find("min_norm_vel").isNull())
225  {
226  if ((minNormVel>0.005) && (minNormVel<=0.1))
227  {
228  min_norm_vel=minNormVel;
229  }
230  else if (minNormVel<0.005)
231  {
232  min_norm_vel=0.005;
233  }
234  else if (minNormVel>0.1)
235  {
236  min_norm_vel=0.1;
237  }
238  }
239 
240  string par=newOptions.find("fixed_window").asString();
241  if (newOptions.find("fixed_window").isNull() && (first_time==true))
242  {
243  fixed_window=false;
244  }
245  else if (!newOptions.find("fixed_window").isNull())
246  {
247  if ((par=="on") || (par=="off"))
248  {
249  fixed_window=(par=="on");
250  }
251  else
252  {
253  fixed_window=false;
254  }
255  }
256 }
double min_norm_vel
Minimum norm of velocity for considering the object moving.
int max_median_order
max median order width
int std_median_order
median order width
int min_median_order
Minimum median filder order allowed.
bool fixed_window
Boolean variable for enabling the use of a fixed window during the median filter. ...
double threshold_median
Threshold for velocity estimation for median order.

The documentation for this class was generated from the following files: