00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #include "lidar_segmentation.h"
00034 #include "clustering.h"
00035 #include "groundtruth.h"
00036 #include "visualization_rviz.h"
00037
00038
00039 ros::Publisher markers_pub;
00040 int scan_header;
00041
00042 bool correctClusterId (PointPtr p, int cluster_id)
00043 {
00044 return (p->cluster_id==cluster_id);
00045 }
00046
00047 void filterPoints(vector<PointPtr>& points_in , vector<PointPtr>& points_out, double min_range, double max_range)
00048 {
00049 points_out.clear();
00050
00051 for(uint i=0;i<points_in.size();i++)
00052 {
00053 PointPtr p = points_in[i];
00054
00055 if(p->range < min_range || p->range > max_range || isnan(p->range) || p->cluster_id == 0)
00056 {
00057 continue;
00058 }else
00059 {
00060 points_out.push_back(p);
00061 }
00062 }
00063
00064
00065
00066
00067
00068
00069 return;
00070 }
00071
00072 void removeInvalidPoints(vector<PointPtr>& laser_points, vector<ClusterPtr> clusters, uint min_points )
00073 {
00074
00075 for(uint i=0;i<clusters.size();i++)
00076 {
00077 if(clusters[i]->support_points.size()<=min_points)
00078 {
00079 int cluster_id = clusters[i]->id;
00080
00081 laser_points.erase(std::remove_if(laser_points.begin(),laser_points.end(), boost::bind(correctClusterId,_1,cluster_id)), laser_points.end());
00082 }
00083 }
00084 }
00085
00086
00094 void dataFromFileHandler(vector<PointPtr>& groundtruth_points , int iteration)
00095 {
00096 int write_results = 0.0;
00097 int write_results_no_small_clusters = 0.0;
00098
00099 cout << "Scan number: " << iteration << endl;
00100
00101 vector<PointPtr> groundtruth_points_filtered;
00102
00103
00104 filterPoints(groundtruth_points,groundtruth_points_filtered,0.01,50.);
00105
00106
00107 vector<PointPtr> groundtruth_points_filtered_sorted = groundtruth_points_filtered;
00108 sort(groundtruth_points_filtered_sorted.begin(),groundtruth_points_filtered_sorted.end(),comparePoints);
00109
00110
00111
00112
00113 vector<ClusterPtr> clusters_GT;
00114 convertPointsToCluster(groundtruth_points_filtered_sorted, clusters_GT);
00115
00116 uint minimum_points = 3;
00117 vector<PointPtr> groundtruth_small_points_removed = groundtruth_points_filtered;
00118 removeInvalidPoints(groundtruth_small_points_removed, clusters_GT, minimum_points);
00119
00120
00121
00122
00123 if(write_results >= 1.0)
00124 {
00125 writeResults_GT(iteration , groundtruth_points_filtered_sorted , 1);
00126 writeResults_GT(iteration , groundtruth_points_filtered_sorted , 2);
00127
00128 writeResults_paths(groundtruth_points_filtered, 1, 0.5 , 0.135, 21 , iteration, 1);
00129 writeResults_paths(groundtruth_points_filtered, 1, 0.5 , 0.135, 21 , iteration, 2);
00130
00131 writeResults_paths(groundtruth_points_filtered, 2, 0.55 , 0.021, 21 , iteration, 1);
00132 writeResults_paths(groundtruth_points_filtered, 2, 0.55 , 0.021, 21 , iteration, 2);
00133
00134 writeResults_paths(groundtruth_points_filtered, 3, 0.5 , 0.125, 21 , iteration, 1);
00135 writeResults_paths(groundtruth_points_filtered, 3, 0.5 , 0.125, 21 , iteration, 2);
00136
00137 writeResults_paths(groundtruth_points_filtered, 4, 4.0 , 0.9, 21 , iteration, 1);
00138 writeResults_paths(groundtruth_points_filtered, 4, 4.0 , 0.9, 21 , iteration, 2);
00139
00140 writeResults_paths(groundtruth_points_filtered, 5, 0.5 , 0.125, 21 , iteration, 1);
00141 writeResults_paths(groundtruth_points_filtered, 5, 0.5 , 0.125, 21 , iteration, 2);
00142
00143 writeResults_paths(groundtruth_points_filtered, 6, 0.5 , 0.125, 21 , iteration, 1);
00144 writeResults_paths(groundtruth_points_filtered, 6, 0.5 , 0.125, 21 , iteration, 2);
00145
00146 writeResults_paths(groundtruth_points_filtered, 7, 5.0 , 1.75, 21 , iteration, 1);
00147 writeResults_paths(groundtruth_points_filtered, 7, 5.0 , 1.75, 21 , iteration, 2);
00148 }
00149
00150
00151
00152
00153 if( write_results_no_small_clusters >= 1.0 )
00154 {
00155
00156
00157 vector<PointPtr> groundtruth_small_points_removed_sorted = groundtruth_small_points_removed;
00158 sort(groundtruth_small_points_removed_sorted.begin(),groundtruth_small_points_removed_sorted.end(),comparePoints);
00159
00160 writeResults_GT(iteration , groundtruth_small_points_removed_sorted, 1);
00161 writeResults_GT(iteration , groundtruth_small_points_removed_sorted, 2);
00162
00163 writeResults_paths(groundtruth_small_points_removed, 1, 0.5 , 0.135, 21 , iteration, 1);
00164 writeResults_paths(groundtruth_small_points_removed, 1, 0.5 , 0.135, 21 , iteration, 2);
00165
00166 writeResults_paths(groundtruth_small_points_removed, 2, 0.55 , 0.021, 21 , iteration, 1);
00167 writeResults_paths(groundtruth_small_points_removed, 2, 0.55 , 0.021, 21 , iteration, 2);
00168
00169 writeResults_paths(groundtruth_small_points_removed, 3, 0.5 , 0.125, 21 , iteration, 1);
00170 writeResults_paths(groundtruth_small_points_removed, 3, 0.5 , 0.125, 21 , iteration, 2);
00171
00172 writeResults_paths(groundtruth_small_points_removed, 4, 4.0 , 0.9, 21 , iteration, 1);
00173 writeResults_paths(groundtruth_small_points_removed, 4, 4.0 , 0.9, 21 , iteration, 2);
00174
00175 writeResults_paths(groundtruth_small_points_removed, 5, 0.5 , 0.125, 21 , iteration, 1);
00176 writeResults_paths(groundtruth_small_points_removed, 5, 0.5 , 0.125, 21 , iteration, 2);
00177
00178 writeResults_paths(groundtruth_small_points_removed, 6, 0.5 , 0.125, 21 , iteration, 1);
00179 writeResults_paths(groundtruth_small_points_removed, 6, 0.5 , 0.125, 21 , iteration, 2);
00180
00181 writeResults_paths(groundtruth_small_points_removed, 7, 5.0 , 1.75, 21 , iteration, 1);
00182 writeResults_paths(groundtruth_small_points_removed, 7, 5.0 , 1.75, 21 , iteration, 2);
00183 }
00184
00185
00186
00187
00188 vector<ClusterPtr> clusters;
00189 double threshold = 2;
00190 simpleClustering(groundtruth_points_filtered ,threshold , clusters);
00191
00192 vector<ClusterPtr> clusters_Premebida;
00193 double threshold_cosine = 0.70;
00194 premebidaClustering(groundtruth_points_filtered ,threshold_cosine , clusters_Premebida);
00195
00196 vector<ClusterPtr> clusters_Dietmayer;
00197 double C0 = 1.5;
00198 dietmayerClustering(groundtruth_points_filtered , C0, clusters_Dietmayer);
00199
00200 vector<ClusterPtr> clusters_Santos;
00201 double Beta = deg2rad(30.0);
00202 santosClustering(groundtruth_points_filtered, C0 , Beta , clusters_Santos);
00203
00204 vector<ClusterPtr> clusters_ABD;
00205 double lambda = deg2rad(10.0);
00206 abdClustering(groundtruth_points_filtered ,lambda, clusters_ABD);
00207
00208 vector<ClusterPtr> clusters_nn;
00209 double threshold_nn = 1.5;
00210 nnClustering( groundtruth_points_filtered, threshold_nn , clusters_nn);
00211
00212
00213 visualization_msgs::MarkerArray targets_markers;
00214 targets_markers.markers = createTargetMarkers( clusters , clusters_Premebida , clusters_Dietmayer, clusters_Santos ,clusters_ABD, clusters_nn, clusters_GT );
00215 markers_pub.publish(targets_markers);
00216
00217
00218 cout<<"done all"<<endl;
00219
00220 }
00221
00222 int writeResults_GT(uint iteration , vector<PointPtr>& points , int id_result)
00223 {
00224 vector<ClusterPtr> clusters_c;
00225 convertPointsToCluster(points, clusters_c);
00226
00227 if(iteration<414)
00228 {
00229 stringstream ss;
00230 if(id_result == 1)
00231 ss << "src/NO_boundaries/gt/gt_p1.txt";
00232 else
00233 ss << "src/NO_centers/gt/gt_p1.txt";
00234
00235 ofstream fpc(ss.str().c_str(), ios::app);
00236
00237 if (!fpc.is_open())
00238 {
00239 cout << "Couldn't open fpc file" << endl;
00240 return 1;
00241 }
00242
00243 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00244
00245 if(id_result == 1)
00246 {
00247 for (uint k = 0; k < clusters_c.size(); ++k)
00248 {
00249 ClusterPtr cluster = clusters_c[k];
00250 double final_pos = (cluster->support_points.size() -1);
00251 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00252 }
00253 }else
00254 {
00255 for (uint k = 0; k < clusters_c.size(); ++k)
00256 {
00257 ClusterPtr cluster = clusters_c[k];
00258 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00259 }
00260 }
00261
00262 fpc.close();
00263
00264 }
00265
00266 if(iteration >= 414 && iteration <= 521)
00267 {
00268 stringstream ss;
00269 if(id_result == 1)
00270 ss << "src/NO_boundaries/gt/gt_p2.txt";
00271 else
00272 ss << "src/NO_centers/gt/gt_p2.txt";
00273
00274 ofstream fpc(ss.str().c_str(), ios::app);
00275
00276 if (!fpc.is_open())
00277 {
00278 cout << "Couldn't open fpc file" << endl;
00279 return 1;
00280 }
00281
00282 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00283
00284 if(id_result == 1)
00285 {
00286 for (uint k = 0; k < clusters_c.size(); ++k)
00287 {
00288 ClusterPtr cluster = clusters_c[k];
00289 double final_pos = (cluster->support_points.size() -1);
00290 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00291 }
00292 }else
00293 {
00294 for (uint k = 0; k < clusters_c.size(); ++k)
00295 {
00296 ClusterPtr cluster = clusters_c[k];
00297 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00298 }
00299 }
00300
00301 fpc.close();
00302
00303 }
00304
00305 if(iteration >= 776)
00306 {
00307 stringstream ss;
00308 if(id_result == 1)
00309 ss << "src/NO_boundaries/gt/gt_p3.txt";
00310 else
00311 ss << "src/NO_centers/gt/gt_p3.txt";
00312
00313 ofstream fpc(ss.str().c_str(), ios::app);
00314
00315 if (!fpc.is_open())
00316 {
00317 cout << "Couldn't open fpc file" << endl;
00318 return 1;
00319 }
00320
00321 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00322
00323 if(id_result == 1)
00324 {
00325 for (uint k = 0; k < clusters_c.size(); ++k)
00326 {
00327 ClusterPtr cluster = clusters_c[k];
00328 double final_pos = (cluster->support_points.size() -1);
00329 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00330 }
00331 }else
00332 {
00333 for (uint k = 0; k < clusters_c.size(); ++k)
00334 {
00335 ClusterPtr cluster = clusters_c[k];
00336 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00337 }
00338 }
00339
00340 fpc.close();
00341
00342 }
00343
00344 return 0;
00345
00346 }
00347
00348
00349 int writeResults_paths(vector<PointPtr>& points, int algorithm_id, double initial_value, double increment, int number_of_iterations , uint iteration, int id_result)
00350 {
00351 string path = ros::package::getPath("roslib");
00352
00353
00354
00355 switch (algorithm_id) {
00356 case 1:
00357
00358 for(int i = 0 ; i< number_of_iterations ; i++)
00359 {
00360 vector<ClusterPtr> clusters_c;
00361
00362 double td = initial_value + (i * increment);
00363 simpleClustering(points, td , clusters_c);
00364
00365 if(iteration<414)
00366 {
00367 stringstream ss;
00368 if(id_result == 1)
00369 ss << "src/NO_boundaries/ss/path1/ss_p1_" << i << ".txt";
00370 else
00371 ss << "src/NO_centers/ss/path1/ss_p1_" << i << ".txt";
00372
00373 ofstream fpc(ss.str().c_str(), ios::app);
00374
00375 if (!fpc.is_open())
00376 {
00377 cout << "Couldn't open fpc" << i << " file" << endl;
00378 return 1;
00379 }
00380
00381 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00382
00383 if(id_result == 1)
00384 {
00385 for (uint k = 0; k < clusters_c.size(); ++k)
00386 {
00387 ClusterPtr cluster = clusters_c[k];
00388 double final_pos = (cluster->support_points.size() -1);
00389 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00390 }
00391 }else
00392 {
00393 for (uint k = 0; k < clusters_c.size(); ++k)
00394 {
00395 ClusterPtr cluster = clusters_c[k];
00396 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00397 }
00398 }
00399
00400 fpc.close();
00401
00402 }
00403
00404 if(iteration >= 414 && iteration <= 521)
00405 {
00406 stringstream ss;
00407 if(id_result == 1)
00408 ss << "src/NO_boundaries/ss/path2/ss_p2_" << i << ".txt";
00409 else
00410 ss << "src/NO_centers/ss/path2/ss_p2_" << i << ".txt";
00411
00412 ofstream fpc(ss.str().c_str(), ios::app);
00413
00414 if (!fpc.is_open())
00415 {
00416 cout << "Couldn't open fpc" << i << " file" << endl;
00417 return 1;
00418 }
00419
00420 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00421
00422 if(id_result == 1)
00423 {
00424 for (uint k = 0; k < clusters_c.size(); ++k)
00425 {
00426 ClusterPtr cluster = clusters_c[k];
00427 double final_pos = (cluster->support_points.size() -1);
00428 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00429 }
00430 }else
00431 {
00432 for (uint k = 0; k < clusters_c.size(); ++k)
00433 {
00434 ClusterPtr cluster = clusters_c[k];
00435 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00436 }
00437 }
00438
00439 fpc.close();
00440
00441 }
00442
00443 if(iteration >= 776)
00444 {
00445 stringstream ss;
00446 if(id_result == 1)
00447 ss << "src/NO_boundaries/ss/path3/ss_p3_" << i << ".txt";
00448 else
00449 ss << "src/NO_centers/ss/path3/ss_p3_" << i << ".txt";
00450
00451 ofstream fpc(ss.str().c_str(), ios::app);
00452
00453 if (!fpc.is_open())
00454 {
00455 cout << "Couldn't open fpc" << i << " file" << endl;
00456 return 1;
00457 }
00458
00459 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00460
00461 if(id_result == 1)
00462 {
00463 for (uint k = 0; k < clusters_c.size(); ++k)
00464 {
00465 ClusterPtr cluster = clusters_c[k];
00466 double final_pos = (cluster->support_points.size() -1);
00467 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00468 }
00469 }else
00470 {
00471 for (uint k = 0; k < clusters_c.size(); ++k)
00472 {
00473 ClusterPtr cluster = clusters_c[k];
00474 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00475 }
00476 }
00477
00478 fpc.close();
00479
00480 }
00481
00482 }
00483
00484 break;
00485
00486 case 2:
00487
00488 for(int i = 0 ; i< number_of_iterations ; i++)
00489 {
00490 vector<ClusterPtr> clusters_c;
00491 double td = initial_value + (i * increment);
00492 premebidaClustering(points, td, clusters_c );
00493
00494 if(iteration<414)
00495 {
00496 stringstream ss;
00497 if(id_result == 1)
00498 ss << "src/NO_boundaries/ms_p1_" << i << ".txt";
00499 else
00500 ss << "src/NO_centers/ms_p1_" << i << ".txt";
00501
00502 ofstream fpc(ss.str().c_str(), ios::app);
00503
00504 if (!fpc.is_open())
00505 {
00506 cout << "Couldn't open fpc" << i << " file" << endl;
00507 return 1;
00508 }
00509
00510 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00511
00512 if(id_result == 1)
00513 {
00514 for (uint k = 0; k < clusters_c.size(); ++k)
00515 {
00516 ClusterPtr cluster = clusters_c[k];
00517 double final_pos = (cluster->support_points.size() -1);
00518 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00519 }
00520 }else
00521 {
00522 for (uint k = 0; k < clusters_c.size(); ++k)
00523 {
00524 ClusterPtr cluster = clusters_c[k];
00525 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00526 }
00527 }
00528
00529 fpc.close();
00530
00531 }
00532
00533 if(iteration >= 414 && iteration <= 521)
00534 {
00535 stringstream ss;
00536 if(id_result == 1)
00537 ss << "src/NO_boundaries/ms_p2_" << i << ".txt";
00538 else
00539 ss << "src/NO_centers/ms_p2_" << i << ".txt";
00540
00541 ofstream fpc(ss.str().c_str(), ios::app);
00542
00543 if (!fpc.is_open())
00544 {
00545 cout << "Couldn't open fpc" << i << " file" << endl;
00546 return 1;
00547 }
00548
00549 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00550
00551 if(id_result == 1)
00552 {
00553 for (uint k = 0; k < clusters_c.size(); ++k)
00554 {
00555 ClusterPtr cluster = clusters_c[k];
00556 double final_pos = (cluster->support_points.size() -1);
00557 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00558 }
00559 }else
00560 {
00561 for (uint k = 0; k < clusters_c.size(); ++k)
00562 {
00563 ClusterPtr cluster = clusters_c[k];
00564 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00565 }
00566 }
00567
00568 fpc.close();
00569
00570 }
00571
00572 if(iteration >= 776)
00573 {
00574 stringstream ss;
00575 if(id_result == 1)
00576 ss << "src/NO_boundaries/ms_p3_" << i << ".txt";
00577 else
00578 ss << "src/NO_centers/ms_p3_" << i << ".txt";
00579
00580 ofstream fpc(ss.str().c_str(), ios::app);
00581
00582 if (!fpc.is_open())
00583 {
00584 cout << "Couldn't open fpc" << i << " file" << endl;
00585 return 1;
00586 }
00587
00588 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00589
00590 if(id_result == 1)
00591 {
00592 for (uint k = 0; k < clusters_c.size(); ++k)
00593 {
00594 ClusterPtr cluster = clusters_c[k];
00595 double final_pos = (cluster->support_points.size() -1);
00596 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00597 }
00598 }else
00599 {
00600 for (uint k = 0; k < clusters_c.size(); ++k)
00601 {
00602 ClusterPtr cluster = clusters_c[k];
00603 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00604 }
00605 }
00606
00607 fpc.close();
00608
00609 }
00610
00611 }
00612
00613 break;
00614
00615 case 3:
00616
00617 for(int i = 0 ; i< number_of_iterations ; i++)
00618 {
00619 vector<ClusterPtr> clusters_c;
00620
00621 double td = initial_value + (i * increment);
00622 dietmayerClustering( points, td , clusters_c );
00623
00624 if(iteration<414)
00625 {
00626 stringstream ss;
00627 if(id_result == 1)
00628 ss << "src/ultimate_boundaries/ds/path1/ds_p1_" << i << ".txt";
00629 else
00630 ss << "src/ultimate_centers/ds/path1/ds_p1_" << i << ".txt";
00631
00632 ofstream fpc(ss.str().c_str(), ios::app);
00633
00634 if (!fpc.is_open())
00635 {
00636 cout << "Couldn't open fpc" << i << " file" << endl;
00637 return 1;
00638 }
00639
00640 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00641
00642 if(id_result == 1)
00643 {
00644 for (uint k = 0; k < clusters_c.size(); ++k)
00645 {
00646 ClusterPtr cluster = clusters_c[k];
00647 double final_pos = (cluster->support_points.size() -1);
00648 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00649 }
00650 }else
00651 {
00652 for (uint k = 0; k < clusters_c.size(); ++k)
00653 {
00654 ClusterPtr cluster = clusters_c[k];
00655 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00656 }
00657 }
00658
00659 fpc.close();
00660
00661 }
00662
00663 if(iteration >= 414 && iteration <= 521)
00664 {
00665 stringstream ss;
00666 if(id_result == 1)
00667 ss << "src/ultimate_boundaries/ds/path2/ds_p2_" << i << ".txt";
00668 else
00669 ss << "src/ultimate_centers/ds/path2/ds_p2_" << i << ".txt";
00670
00671 ofstream fpc(ss.str().c_str(), ios::app);
00672
00673 if (!fpc.is_open())
00674 {
00675 cout << "Couldn't open fpc" << i << " file" << endl;
00676 return 1;
00677 }
00678
00679 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00680
00681 if(id_result == 1)
00682 {
00683 for (uint k = 0; k < clusters_c.size(); ++k)
00684 {
00685 ClusterPtr cluster = clusters_c[k];
00686 double final_pos = (cluster->support_points.size() -1);
00687 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00688 }
00689 }else
00690 {
00691 for (uint k = 0; k < clusters_c.size(); ++k)
00692 {
00693 ClusterPtr cluster = clusters_c[k];
00694 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00695 }
00696 }
00697
00698 fpc.close();
00699
00700 }
00701
00702 if(iteration >= 776)
00703 {
00704 stringstream ss;
00705 if(id_result == 1)
00706 ss << "src/ultimate_boundaries/ds/path3/ds_p3_" << i << ".txt";
00707 else
00708 ss << "src/ultimate_centers/ds/path3/ds_p3_" << i << ".txt";
00709
00710 ofstream fpc(ss.str().c_str(), ios::app);
00711
00712 if (!fpc.is_open())
00713 {
00714 cout << "Couldn't open fpc" << i << " file" << endl;
00715 return 1;
00716 }
00717
00718 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00719
00720 if(id_result == 1)
00721 {
00722 for (uint k = 0; k < clusters_c.size(); ++k)
00723 {
00724 ClusterPtr cluster = clusters_c[k];
00725 double final_pos = (cluster->support_points.size() -1);
00726 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00727 }
00728 }else
00729 {
00730 for (uint k = 0; k < clusters_c.size(); ++k)
00731 {
00732 ClusterPtr cluster = clusters_c[k];
00733 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00734 }
00735 }
00736
00737 fpc.close();
00738
00739 }
00740
00741 }
00742
00743 break;
00744
00745 case 4:
00746
00747 for(int i = 0 ; i< number_of_iterations ; i++)
00748 {
00749 vector<ClusterPtr> clusters_c;
00750 double td = deg2rad( initial_value + (i * increment) );
00751 abdClustering( points, td, clusters_c );
00752
00753 if(iteration<414)
00754 {
00755 stringstream ss;
00756 if(id_result == 1)
00757 ss << "src/NO_boundaries/abd/path1/abd_p1_" << i << ".txt";
00758 else
00759 ss << "src/NO_centers/abd/path1/abd_p1_" << i << ".txt";
00760
00761 ofstream fpc(ss.str().c_str(), ios::app);
00762
00763 if (!fpc.is_open())
00764 {
00765 cout << "Couldn't open fpc" << i << " file" << endl;
00766 return 1;
00767 }
00768
00769 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00770
00771 if(id_result == 1)
00772 {
00773 for (uint k = 0; k < clusters_c.size(); ++k)
00774 {
00775 ClusterPtr cluster = clusters_c[k];
00776 double final_pos = (cluster->support_points.size() -1);
00777 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00778 }
00779 }else
00780 {
00781 for (uint k = 0; k < clusters_c.size(); ++k)
00782 {
00783 ClusterPtr cluster = clusters_c[k];
00784 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00785 }
00786 }
00787
00788 fpc.close();
00789
00790 }
00791
00792 if(iteration >= 414 && iteration <= 521)
00793 {
00794 stringstream ss;
00795 if(id_result == 1)
00796 ss << "src/NO_boundaries/abd/path2/abd_p2_" << i << ".txt";
00797 else
00798 ss << "src/NO_centers/abd/path2/abd_p2_" << i << ".txt";
00799
00800 ofstream fpc(ss.str().c_str(), ios::app);
00801
00802 if (!fpc.is_open())
00803 {
00804 cout << "Couldn't open fpc" << i << " file" << endl;
00805 return 1;
00806 }
00807
00808 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00809
00810 if(id_result == 1)
00811 {
00812 for (uint k = 0; k < clusters_c.size(); ++k)
00813 {
00814 ClusterPtr cluster = clusters_c[k];
00815 double final_pos = (cluster->support_points.size() -1);
00816 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00817 }
00818 }else
00819 {
00820 for (uint k = 0; k < clusters_c.size(); ++k)
00821 {
00822 ClusterPtr cluster = clusters_c[k];
00823 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00824 }
00825 }
00826
00827 fpc.close();
00828
00829 }
00830
00831 if(iteration >= 776)
00832 {
00833 stringstream ss;
00834 if(id_result == 1)
00835 ss << "src/NO_boundaries/abd/path3/abd_p3_" << i << ".txt";
00836 else
00837 ss << "src/NO_centers/abd/path3/abd_p3_" << i << ".txt";
00838
00839 ofstream fpc(ss.str().c_str(), ios::app);
00840
00841 if (!fpc.is_open())
00842 {
00843 cout << "Couldn't open fpc" << i << " file" << endl;
00844 return 1;
00845 }
00846
00847 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00848
00849 if(id_result == 1)
00850 {
00851 for (uint k = 0; k < clusters_c.size(); ++k)
00852 {
00853 ClusterPtr cluster = clusters_c[k];
00854 double final_pos = (cluster->support_points.size() -1);
00855 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00856 }
00857 }else
00858 {
00859 for (uint k = 0; k < clusters_c.size(); ++k)
00860 {
00861 ClusterPtr cluster = clusters_c[k];
00862 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00863 }
00864 }
00865
00866 fpc.close();
00867
00868 }
00869
00870 }
00871
00872 break;
00873
00874 case 5:
00875
00876 for(int i = 0 ; i< number_of_iterations ; i++)
00877 {
00878 vector<ClusterPtr> clusters_c;
00879 double td = initial_value + (i * increment);
00880 nnClustering(points , td, clusters_c );
00881
00882 if(iteration<414)
00883 {
00884 stringstream ss;
00885 if(id_result == 1)
00886 ss << "src/ultimate_boundaries/snn/path1/snn_p1_" << i << ".txt";
00887 else
00888 ss << "src/ultimate_centers/snn/path1/snn_p1_" << i << ".txt";
00889
00890 ofstream fpc(ss.str().c_str(), ios::app);
00891
00892 if (!fpc.is_open())
00893 {
00894 cout << "Couldn't open fpc" << i << " file" << endl;
00895 return 1;
00896 }
00897
00898 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00899
00900 if(id_result == 1)
00901 {
00902 for (uint k = 0; k < clusters_c.size(); ++k)
00903 {
00904 ClusterPtr cluster = clusters_c[k];
00905 double final_pos = (cluster->support_points.size() -1);
00906 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00907 }
00908 }else
00909 {
00910 for (uint k = 0; k < clusters_c.size(); ++k)
00911 {
00912 ClusterPtr cluster = clusters_c[k];
00913 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00914 }
00915 }
00916
00917 fpc.close();
00918
00919 }
00920
00921 if(iteration >= 414 && iteration <= 521)
00922 {
00923 stringstream ss;
00924 if(id_result == 1)
00925 ss << "src/ultimate_boundaries/snn/path2/snn_p2_" << i << ".txt";
00926 else
00927 ss << "src/ultimate_centers/snn/path2/snn_p2_" << i << ".txt";
00928
00929 ofstream fpc(ss.str().c_str(), ios::app);
00930
00931 if (!fpc.is_open())
00932 {
00933 cout << "Couldn't open fpc" << i << " file" << endl;
00934 return 1;
00935 }
00936
00937 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00938
00939 if(id_result == 1)
00940 {
00941 for (uint k = 0; k < clusters_c.size(); ++k)
00942 {
00943 ClusterPtr cluster = clusters_c[k];
00944 double final_pos = (cluster->support_points.size() -1);
00945 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00946 }
00947 }else
00948 {
00949 for (uint k = 0; k < clusters_c.size(); ++k)
00950 {
00951 ClusterPtr cluster = clusters_c[k];
00952 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00953 }
00954 }
00955
00956 fpc.close();
00957
00958 }
00959
00960 if(iteration >= 776)
00961 {
00962 stringstream ss;
00963 if(id_result == 1)
00964 ss << "src/ultimate_boundaries/snn/path3/snn_p3_" << i << ".txt";
00965 else
00966 ss << "src/ultimate_centers/snn/path3/snn_p3_" << i << ".txt";
00967
00968 ofstream fpc(ss.str().c_str(), ios::app);
00969
00970 if (!fpc.is_open())
00971 {
00972 cout << "Couldn't open fpc" << i << " file" << endl;
00973 return 1;
00974 }
00975
00976 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
00977
00978 if(id_result == 1)
00979 {
00980 for (uint k = 0; k < clusters_c.size(); ++k)
00981 {
00982 ClusterPtr cluster = clusters_c[k];
00983 double final_pos = (cluster->support_points.size() -1);
00984 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
00985 }
00986 }else
00987 {
00988 for (uint k = 0; k < clusters_c.size(); ++k)
00989 {
00990 ClusterPtr cluster = clusters_c[k];
00991 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
00992 }
00993 }
00994
00995 fpc.close();
00996
00997 }
00998
00999 }
01000
01001 break;
01002
01003 case 6:
01004
01005 for(int i = 0 ; i< number_of_iterations ; i++)
01006 {
01007 vector<ClusterPtr> clusters_c;
01008 double beta = deg2rad(15.0);
01009 double td = initial_value + (i * increment);
01010
01011 santosClustering( points , td , beta , clusters_c );
01012
01013 if(iteration<414)
01014 {
01015 stringstream ss;
01016 if(id_result == 1)
01017 ss << "src/ultimate_boundaries/sa_c/path1/sa_c_p1_" << i << ".txt";
01018 else
01019 ss << "src/ultimate_centers/sa_c/path1/sa_c_p1_" << i << ".txt";
01020
01021 ofstream fpc(ss.str().c_str(), ios::app);
01022
01023 if (!fpc.is_open())
01024 {
01025 cout << "Couldn't open fpc" << i << " file" << endl;
01026 return 1;
01027 }
01028
01029 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01030
01031 if(id_result == 1)
01032 {
01033 for (uint k = 0; k < clusters_c.size(); ++k)
01034 {
01035 ClusterPtr cluster = clusters_c[k];
01036 double final_pos = (cluster->support_points.size() -1);
01037 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01038 }
01039 }else
01040 {
01041 for (uint k = 0; k < clusters_c.size(); ++k)
01042 {
01043 ClusterPtr cluster = clusters_c[k];
01044 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01045 }
01046 }
01047
01048 fpc.close();
01049
01050 }
01051
01052 if(iteration >= 414 && iteration <= 521)
01053 {
01054 stringstream ss;
01055 if(id_result == 1)
01056 ss << "src/ultimate_boundaries/sa_c/path2/sa_c_p2_" << i << ".txt";
01057 else
01058 ss << "src/ultimate_centers/sa_c/path2/sa_c_p2_" << i << ".txt";
01059
01060 ofstream fpc(ss.str().c_str(), ios::app);
01061
01062 if (!fpc.is_open())
01063 {
01064 cout << "Couldn't open fpc" << i << " file" << endl;
01065 return 1;
01066 }
01067
01068 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01069
01070 if(id_result == 1)
01071 {
01072 for (uint k = 0; k < clusters_c.size(); ++k)
01073 {
01074 ClusterPtr cluster = clusters_c[k];
01075 double final_pos = (cluster->support_points.size() -1);
01076 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01077 }
01078 }else
01079 {
01080 for (uint k = 0; k < clusters_c.size(); ++k)
01081 {
01082 ClusterPtr cluster = clusters_c[k];
01083 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01084 }
01085 }
01086
01087 fpc.close();
01088
01089 }
01090
01091 if(iteration >= 776)
01092 {
01093 stringstream ss;
01094 if(id_result == 1)
01095 ss << "src/ultimate_boundaries/sa_c/path3/sa_c_p3_" << i << ".txt";
01096 else
01097 ss << "src/ultimate_centers/sa_c/path3/sa_c_p3_" << i << ".txt";
01098
01099 ofstream fpc(ss.str().c_str(), ios::app);
01100
01101 if (!fpc.is_open())
01102 {
01103 cout << "Couldn't open fpc" << i << " file" << endl;
01104 return 1;
01105 }
01106
01107 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01108
01109 if(id_result == 1)
01110 {
01111 for (uint k = 0; k < clusters_c.size(); ++k)
01112 {
01113 ClusterPtr cluster = clusters_c[k];
01114 double final_pos = (cluster->support_points.size() -1);
01115 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01116 }
01117 }else
01118 {
01119 for (uint k = 0; k < clusters_c.size(); ++k)
01120 {
01121 ClusterPtr cluster = clusters_c[k];
01122 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01123 }
01124 }
01125
01126 fpc.close();
01127
01128 }
01129
01130 }
01131
01132 break;
01133
01134 case 7:
01135
01136 for(int i = 0 ; i< number_of_iterations ; i++)
01137 {
01138 vector<ClusterPtr> clusters_c;
01139 double C0 = 1.0;
01140 double td = deg2rad( initial_value + (i * increment) );
01141 santosClustering(points , C0, td , clusters_c );
01142
01143 if(iteration<414)
01144 {
01145 stringstream ss;
01146 if(id_result == 1)
01147 ss << "src/NO_boundaries/sa_b/path1/sa_b_p1_" << i << ".txt";
01148 else
01149 ss << "src/NO_centers/sa_b/path1/sa_b_p1_" << i << ".txt";
01150
01151 ofstream fpc(ss.str().c_str(), ios::app);
01152
01153 if (!fpc.is_open())
01154 {
01155 cout << "Couldn't open fpc" << i << " file" << endl;
01156 return 1;
01157 }
01158
01159 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01160
01161 if(id_result == 1)
01162 {
01163 for (uint k = 0; k < clusters_c.size(); ++k)
01164 {
01165 ClusterPtr cluster = clusters_c[k];
01166 double final_pos = (cluster->support_points.size() -1);
01167 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01168 }
01169 }else
01170 {
01171 for (uint k = 0; k < clusters_c.size(); ++k)
01172 {
01173 ClusterPtr cluster = clusters_c[k];
01174 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01175 }
01176 }
01177
01178 fpc.close();
01179
01180 }
01181
01182 if(iteration >= 414 && iteration <= 521)
01183 {
01184 stringstream ss;
01185 if(id_result == 1)
01186 ss << "src/NO_boundaries/sa_b/path2/sa_b_p2_" << i << ".txt";
01187 else
01188 ss << "src/NO_centers/sa_b/path2/sa_b_p2_" << i << ".txt";
01189
01190 ofstream fpc(ss.str().c_str(), ios::app);
01191
01192 if (!fpc.is_open())
01193 {
01194 cout << "Couldn't open fpc" << i << " file" << endl;
01195 return 1;
01196 }
01197
01198 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01199
01200 if(id_result == 1)
01201 {
01202 for (uint k = 0; k < clusters_c.size(); ++k)
01203 {
01204 ClusterPtr cluster = clusters_c[k];
01205 double final_pos = (cluster->support_points.size() -1);
01206 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01207 }
01208 }else
01209 {
01210 for (uint k = 0; k < clusters_c.size(); ++k)
01211 {
01212 ClusterPtr cluster = clusters_c[k];
01213 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01214 }
01215 }
01216
01217 fpc.close();
01218
01219 }
01220
01221 if(iteration >= 776)
01222 {
01223 stringstream ss;
01224 if(id_result == 1)
01225 ss << "src/NO_boundaries/sa_b/path3/sa_b_p3_" << i << ".txt";
01226 else
01227 ss << "src/NO_centers/sa_b/path3/sa_b_p3_" << i << ".txt";
01228
01229 ofstream fpc(ss.str().c_str(), ios::app);
01230
01231 if (!fpc.is_open())
01232 {
01233 cout << "Couldn't open fpc" << i << " file" << endl;
01234 return 1;
01235 }
01236
01237 fpc<<"Inf "<< clusters_c.size() <<" "<< iteration << endl;
01238
01239 if(id_result == 1)
01240 {
01241 for (uint k = 0; k < clusters_c.size(); ++k)
01242 {
01243 ClusterPtr cluster = clusters_c[k];
01244 double final_pos = (cluster->support_points.size() -1);
01245 fpc<< fixed << setprecision(4) << cluster->support_points[0]->x <<" "<< cluster->support_points[0]->y <<" "<< cluster->support_points[final_pos]->x <<" "<< cluster->support_points[final_pos]->y <<" "<< cluster->support_points.size()<< endl;
01246 }
01247 }else
01248 {
01249 for (uint k = 0; k < clusters_c.size(); ++k)
01250 {
01251 ClusterPtr cluster = clusters_c[k];
01252 fpc<< fixed << setprecision(4) << cluster->central_point->x <<" "<< cluster->central_point->y <<" "<< cluster->support_points.size()<< endl;
01253 }
01254 }
01255
01256 fpc.close();
01257
01258 }
01259
01260 }
01261
01262 break;
01263
01264
01265 }
01266
01267 return 0;
01268
01269 }
01270
01271
01272 int createPointsFromFile( vector<PointPtr>& points , C_DataFromFilePtr data_gt )
01273 {
01274
01275 double theta;
01276 double r;
01277
01278 for(uint j = 0; j < data_gt->x_valuesf.size() ; j++ )
01279 {
01280 theta = atan2(data_gt->y_valuesf[j],data_gt->x_valuesf[j]);
01281 r = sqrt(data_gt->y_valuesf[j]*data_gt->y_valuesf[j] + data_gt->x_valuesf[j]*data_gt->x_valuesf[j]);
01282
01283 PointPtr p(new Point);
01284
01285 p->x=data_gt->x_valuesf[j];
01286 p->y=data_gt->y_valuesf[j];
01287 p->theta=theta;
01288 p->range=r;
01289 p->label = j;
01290 p->iteration = j+1;
01291 p->cluster_id = data_gt->labels[j];
01292
01293 points.push_back(p);
01294 }
01295
01296 return 0;
01297 }
01298
01299
01300 int main(int argc, char **argv)
01301 {
01302 ros::init(argc, argv, "lidar_segmentation");
01303 ros::NodeHandle n;
01304
01305 markers_pub = n.advertise<visualization_msgs::MarkerArray>( "/markers", 1000 );
01306
01307
01308 int values_per_scan = 541;
01309 vector<C_DataFromFilePtr> data_gts;
01310
01311 readDataFile( data_gts ,values_per_scan);
01312 ros::Rate loop_rate(1);
01313
01314
01315
01316 for(uint it = 0; it < data_gts.size() ; it++)
01317 {
01318 vector<PointPtr> points;
01319
01320 createPointsFromFile(points, data_gts[it] );
01321 scan_header = data_gts[it]->iteration;
01322
01323 dataFromFileHandler(points , scan_header);
01324
01325 ros::spinOnce();
01326 loop_rate.sleep();
01327 }
01328
01329 return 0;
01330 }