Skip to content

Commit

Permalink
Merge pull request #3328 from SunBlack/prefix_cout_cerr_endl_with_std…
Browse files Browse the repository at this point in the history
…_io-visualization

Use std::cout/std::cerr/std::endl instead of just cout/cerr/endl [io-visualization]
  • Loading branch information
taketwo authored Sep 10, 2019
2 parents 39bc1c2 + 203729a commit 000a762
Show file tree
Hide file tree
Showing 47 changed files with 311 additions and 311 deletions.
22 changes: 11 additions & 11 deletions io/tools/openni_pcd_recorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ PCDBuffer<PointT>::getFront ()
break;
{
std::lock_guard<std::mutex> io_lock (io_mutex);
//cerr << "No data in buffer_ yet or buffer is empty." << endl;
//std::cerr << "No data in buffer_ yet or buffer is empty." << std::endl;
}
buff_empty_.wait (buff_lock);
}
Expand All @@ -200,7 +200,7 @@ do \
++count; \
if (now - last >= 1.0) \
{ \
cerr << "Average framerate("<< _WHAT_ << "): " << double(count)/double(now - last) << " Hz. Queue size: " << buff.getSize () << "\n"; \
std::cerr << "Average framerate("<< _WHAT_ << "): " << double(count)/double(now - last) << " Hz. Queue size: " << buff.getSize () << "\n"; \
count = 0; \
last = now; \
} \
Expand Down Expand Up @@ -401,20 +401,20 @@ main (int argc, char** argv)
{
pcl::OpenNIGrabber grabber (argv[2]);
openni_wrapper::OpenNIDevice::Ptr device = grabber.getDevice ();
cout << "Supported depth modes for device: " << device->getVendorName () << " , " << device->getProductName () << endl;
std::cout << "Supported depth modes for device: " << device->getVendorName () << " , " << device->getProductName () << std::endl;
std::vector<std::pair<int, XnMapOutputMode > > modes = grabber.getAvailableDepthModes ();
for (std::vector<std::pair<int, XnMapOutputMode > >::const_iterator it = modes.begin (); it != modes.end (); ++it)
{
cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << endl;
std::cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << std::endl;
}

if (device->hasImageStream ())
{
cout << endl << "Supported image modes for device: " << device->getVendorName () << " , " << device->getProductName () << endl;
std::cout << std::endl << "Supported image modes for device: " << device->getVendorName () << " , " << device->getProductName () << std::endl;
modes = grabber.getAvailableImageModes ();
for (std::vector<std::pair<int, XnMapOutputMode > >::const_iterator it = modes.begin (); it != modes.end (); ++it)
{
cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << endl;
std::cout << it->first << " = " << it->second.nXRes << " x " << it->second.nYRes << " @ " << it->second.nFPS << std::endl;
}
}
}
Expand All @@ -425,15 +425,15 @@ main (int argc, char** argv)
{
for (unsigned deviceIdx = 0; deviceIdx < driver.getNumberDevices (); ++deviceIdx)
{
cout << "Device: " << deviceIdx + 1 << ", vendor: " << driver.getVendorName (deviceIdx) << ", product: " << driver.getProductName (deviceIdx)
<< ", connected: " << driver.getBus(deviceIdx) << " @ " << driver.getAddress (deviceIdx) << ", serial number: \'" << driver.getSerialNumber (deviceIdx) << "\'" << endl;
std::cout << "Device: " << deviceIdx + 1 << ", vendor: " << driver.getVendorName (deviceIdx) << ", product: " << driver.getProductName (deviceIdx)
<< ", connected: " << driver.getBus(deviceIdx) << " @ " << driver.getAddress (deviceIdx) << ", serial number: \'" << driver.getSerialNumber (deviceIdx) << "\'" << std::endl;
}

}
else
cout << "No devices connected." << endl;
std::cout << "No devices connected." << std::endl;

cout <<"Virtual Devices available: ONI player" << endl;
std::cout <<"Virtual Devices available: ONI player" << std::endl;
}
return 0;
}
Expand All @@ -442,7 +442,7 @@ main (int argc, char** argv)
{
openni_wrapper::OpenNIDriver& driver = openni_wrapper::OpenNIDriver::getInstance ();
if (driver.getNumberDevices () > 0)
cout << "Device Id not set, using first device." << endl;
std::cout << "Device Id not set, using first device." << std::endl;
}

bool just_xyz = find_switch (argc, argv, "-xyz");
Expand Down
18 changes: 9 additions & 9 deletions outofcore/include/pcl/outofcore/impl/octree_base_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ namespace pcl
double c = planes[(i*4)+2];
double d = planes[(i*4)+3];

//cout << i << ": " << a << "x + " << b << "y + " << c << "z + " << d << endl;
//std::cout << i << ": " << a << "x + " << b << "y + " << c << "z + " << d << std::endl;

Eigen::Vector3d normal(a, b, c);

Expand Down Expand Up @@ -1099,8 +1099,8 @@ namespace pcl
// Eigen::Vector3d n_vertex; //neg vertex
// get_np_vertices(normal, p_vertex, n_vertex, min_bb, max_bb);
//
// cout << "n_vertex: " << n_vertex.x () << ", " << n_vertex.y () << ", " << n_vertex.z () << endl;
// cout << "p_vertex: " << p_vertex.x () << ", " << p_vertex.y () << ", " << p_vertex.z () << endl;
// std::cout << "n_vertex: " << n_vertex.x () << ", " << n_vertex.y () << ", " << n_vertex.z () << std::endl;
// std::cout << "p_vertex: " << p_vertex.x () << ", " << p_vertex.y () << ", " << p_vertex.z () << std::endl;

// is the positive vertex outside?
// if (pl[i].distance(b.getVertexP(pl[i].normal)) < 0)
Expand Down Expand Up @@ -1128,14 +1128,14 @@ namespace pcl

// This should be the same as above
// double m = (a * n_vertex.x ()) + (b * n_vertex.y ()) + (c * n_vertex.z ());
// cout << "m = " << m << endl;
// std::cout << "m = " << m << std::endl;
// if (m > -d)
// {
// result = OUTSIDE;
// }
//
// double n = (a * p_vertex.x ()) + (b * p_vertex.y ()) + (c * p_vertex.z ());
// cout << "n = " << n << endl;
// std::cout << "n = " << n << std::endl;
// if (n > -d)
// {
// result = INTERSECT;
Expand All @@ -1150,13 +1150,13 @@ namespace pcl

// switch(result){
// case OUTSIDE:
// //cout << this->depth_ << " [OUTSIDE]: " << node_metadata_->getPCDFilename() << endl;
// //std::cout << this->depth_ << " [OUTSIDE]: " << node_metadata_->getPCDFilename() << std::endl;
// return;
// case INTERSECT:
// //cout << this->depth_ << " [INTERSECT]: " << node_metadata_->getPCDFilename() << endl;
// //std::cout << this->depth_ << " [INTERSECT]: " << node_metadata_->getPCDFilename() << std::endl;
// break;
// case INSIDE:
// //cout << this->depth_ << " [INSIDE]: " << node_metadata_->getPCDFilename() << endl;
// //std::cout << this->depth_ << " [INSIDE]: " << node_metadata_->getPCDFilename() << std::endl;
// break;
// }

Expand Down Expand Up @@ -1223,7 +1223,7 @@ namespace pcl
double c = planes[(i*4)+2];
double d = planes[(i*4)+3];

//cout << i << ": " << a << "x + " << b << "y + " << c << "z + " << d << endl;
//std::cout << i << ": " << a << "x + " << b << "y + " << c << "z + " << d << std::endl;

Eigen::Vector3d normal(a, b, c);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class OutofcoreCloud : public Object
value = 100;

lod_pixel_threshold_ += value;
std::cout << "Increasing lod pixel threshold: " << lod_pixel_threshold_ << endl;
std::cout << "Increasing lod pixel threshold: " << lod_pixel_threshold_ << std::endl;
}

void
Expand All @@ -252,7 +252,7 @@ class OutofcoreCloud : public Object

if (lod_pixel_threshold_ < 100)
lod_pixel_threshold_ = 100;
std::cout << "Decreasing lod pixel threshold: " << lod_pixel_threshold_ << endl;
std::cout << "Decreasing lod pixel threshold: " << lod_pixel_threshold_ << std::endl;
}

void
Expand Down
2 changes: 1 addition & 1 deletion outofcore/src/visualization/outofcore_cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ OutofcoreCloud::render (vtkRenderer* renderer)

// for (int i=0; i < node->getDepth(); i++)
// std::cout << " ";
// std::cout << coverage << "-" << pcd_file << endl;//" : " << (coverage > (size[0] * size[1])) << endl;
// std::cout << coverage << "-" << pcd_file << std::endl;//" : " << (coverage > (size[0] * size[1])) << std::endl;

std::string pcd_file = node->getPCDFilename ().string ();

Expand Down
4 changes: 2 additions & 2 deletions outofcore/tools/outofcore_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class KeyboardCallback : public vtkCommand
std::string key (interactor->GetKeySym ());
bool shift_down = interactor->GetShiftKey();

cout << "Key Pressed: " << key << endl;
std::cout << "Key Pressed: " << key << std::endl;

Scene *scene = Scene::instance ();
OutofcoreCloud *cloud = static_cast<OutofcoreCloud*> (scene->getObjectByName ("my_octree"));
Expand Down Expand Up @@ -225,7 +225,7 @@ renderEndCallback(vtkObject* vtkNotUsed(caller), unsigned long int vtkNotUsed(ev
int
outofcoreViewer (boost::filesystem::path tree_root, int depth, bool display_octree=true, unsigned int gpu_cache_size=512)
{
cout << boost::filesystem::absolute (tree_root) << endl;
std::cout << boost::filesystem::absolute (tree_root) << std::endl;

// Create top level scene
Scene *scene = Scene::instance ();
Expand Down
18 changes: 9 additions & 9 deletions people/apps/main_ground_based_people_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ enum { COLS = 640, ROWS = 480 };

int print_help()
{
cout << "*******************************************************" << std::endl;
cout << "Ground based people detection app options:" << std::endl;
cout << " --help <show_this_help>" << std::endl;
cout << " --svm <path_to_svm_file>" << std::endl;
cout << " --conf <minimum_HOG_confidence (default = -1.5)>" << std::endl;
cout << " --min_h <minimum_person_height (default = 1.3)>" << std::endl;
cout << " --max_h <maximum_person_height (default = 2.3)>" << std::endl;
cout << " --sample <sampling_factor (default = 1)>" << std::endl;
cout << "*******************************************************" << std::endl;
std::cout << "*******************************************************" << std::endl;
std::cout << "Ground based people detection app options:" << std::endl;
std::cout << " --help <show_this_help>" << std::endl;
std::cout << " --svm <path_to_svm_file>" << std::endl;
std::cout << " --conf <minimum_HOG_confidence (default = -1.5)>" << std::endl;
std::cout << " --min_h <minimum_person_height (default = 1.3)>" << std::endl;
std::cout << " --max_h <maximum_person_height (default = 2.3)>" << std::endl;
std::cout << " --sample <sampling_factor (default = 1)>" << std::endl;
std::cout << "*******************************************************" << std::endl;
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions recognition/src/ransac_based/obj_rec_ransac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pcl::recognition::ObjRecRANSAC::sampleOrientedPointPairs (int num_iterations, co
if ( !num_full_leaves )
{
#ifdef OBJ_REC_RANSAC_VERBOSE
cout << "done [" << num_of_opps << " opps].\n";
std::cout << "done [" << num_of_opps << " opps].\n";
#endif
return;
}
Expand Down Expand Up @@ -229,7 +229,7 @@ pcl::recognition::ObjRecRANSAC::sampleOrientedPointPairs (int num_iterations, co
}

#ifdef OBJ_REC_RANSAC_VERBOSE
cout << "done [" << num_of_opps << " opps].\n";
std::cout << "done [" << num_of_opps << " opps].\n";
#endif
}

Expand Down
12 changes: 6 additions & 6 deletions simulation/src/range_likelihood.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,22 @@ display_tic_toc (vector<double> &tic_toc,const string &fun_name)

double percent_tic_toc_last = 0;
double dtime = tic_toc[tic_toc_size-1] - tic_toc[0];
cout << "fraction_" << fun_name << ",";
std::cout << "fraction_" << fun_name << ",";
for (size_t i = 0; i < tic_toc_size; i++)
{
double percent_tic_toc = (tic_toc[i] - tic_toc[0])/(tic_toc[tic_toc_size-1] - tic_toc[0]);
cout << percent_tic_toc - percent_tic_toc_last << ", ";
std::cout << percent_tic_toc - percent_tic_toc_last << ", ";
percent_tic_toc_last = percent_tic_toc;
}
cout << "\ntime_" << fun_name << ",";
std::cout << "\ntime_" << fun_name << ",";
double time_tic_toc_last = 0;
for (size_t i = 0; i < tic_toc_size; i++)
{
double percent_tic_toc = (tic_toc[i] - tic_toc[0])/(tic_toc[tic_toc_size-1] - tic_toc[0]);
cout << percent_tic_toc*dtime - time_tic_toc_last << ", ";
std::cout << percent_tic_toc*dtime - time_tic_toc_last << ", ";
time_tic_toc_last = percent_tic_toc*dtime;
}
cout << "\ntotal_time_" << fun_name << " " << dtime << "\n";
std::cout << "\ntotal_time_" << fun_name << " " << dtime << "\n";
}

pcl::simulation::RangeLikelihood::RangeLikelihood (int rows, int cols, int row_height, int col_width, Scene::Ptr scene) :
Expand Down Expand Up @@ -810,7 +810,7 @@ pcl::simulation::RangeLikelihood::addNoise ()
{
depth_buffer_[i] = std::ceil (depth_buffer_[i]*bins)/bins;
}
cout << "in add noise\n";
std::cout << "in add noise\n";
}

void
Expand Down
8 changes: 4 additions & 4 deletions simulation/tools/sim_terminal_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void write_sim_output(const string &fname_root){
pcl::PCDWriter writer;
//writer.write ( string (fname_root + ".pcd"), *pc_out, false); /// ASCII
writer.writeBinary ( string (fname_root + ".pcd") , *pc_out);
//cout << "finished writing file\n";
//std::cout << "finished writing file\n";
}else{
std::cout << pc_out->points.size() << " points in cloud, not written\n";
}
Expand Down Expand Up @@ -202,10 +202,10 @@ main (int argc, char** argv)
simexample->doSim(poses[i]);

write_sim_output(ss.str());
cout << (getTime() -tic) << " sec\n";
std::cout << (getTime() -tic) << " sec\n";
}
cout << poses.size() << " poses simulated in " << (getTime() -tic_main) << "seconds\n";
cout << (poses.size()/ (getTime() -tic_main) ) << "Hz on average\n";
std::cout << poses.size() << " poses simulated in " << (getTime() -tic_main) << "seconds\n";
std::cout << (poses.size()/ (getTime() -tic_main) ) << "Hz on average\n";

return 0;
}
8 changes: 4 additions & 4 deletions simulation/tools/sim_test_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ void display ()

pcl::PCDWriter writer;
writer.write ("simulated_range_image.pcd", *pc_out, false);
cout << "finished writing file\n";
std::cout << "finished writing file\n";

// pcl::visualization::CloudViewer viewer ("Simple Cloud Viewer");
// viewer.showCloud (pc_out);
Expand All @@ -420,7 +420,7 @@ void display ()
// viewer.reset();


cout << "done\n";
std::cout << "done\n";
// Problem: vtk and opengl don't seem to play very well together
// vtk seems to misbehave after a little while and won't keep the window on the screen

Expand All @@ -430,7 +430,7 @@ void display ()

// method2: eventually starts ignoring cin and pops up on screen and closes almost
// immediately
// cout << "enter 1 to cont\n";
// std::cout << "enter 1 to cont\n";
// cin >> pause;
// viewer.wasStopped ();

Expand Down Expand Up @@ -569,7 +569,7 @@ initialize (int, char** argv)
camera_->setPitch(0.20944); // not sure why this is here:
//camera_->set(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);

cout << "About to read: " << argv[1] << endl;
std::cout << "About to read: " << argv[1] << std::endl;
load_PolygonMesh_model (argv[1]);

paused_ = false;
Expand Down
16 changes: 8 additions & 8 deletions simulation/tools/sim_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ void simulate_callback (const pcl::visualization::KeyboardEvent &event,
std::cout << "n cams not 1 exiting\n"; // for now in case ...
return;
}
// cout << "n cams: " << cams.size() << "\n";
// std::cout << "n cams: " << cams.size() << "\n";
pcl::visualization::Camera cam = cams[0];


Expand All @@ -351,9 +351,9 @@ void simulate_callback (const pcl::visualization::KeyboardEvent &event,
m =pose.rotation();
//All axies use right hand rule. x=red axis, y=green axis, z=blue axis z direction is point into the screen. z \ \ \ -----------> x | | | | | | y

cout << pose(0,0) << " " << pose(0,1) << " " << pose(0,2) << " " << pose(0,3) << " x0\n";
cout << pose(1,0) << " " << pose(1,1) << " " << pose(1,2) << " " << pose(1,3) << " x1\n";
cout << pose(2,0) << " " << pose(2,1) << " " << pose(2,2) << " " << pose(2,3)<< "x2\n";
std::cout << pose(0,0) << " " << pose(0,1) << " " << pose(0,2) << " " << pose(0,3) << " x0\n";
std::cout << pose(1,0) << " " << pose(1,1) << " " << pose(1,2) << " " << pose(1,3) << " x1\n";
std::cout << pose(2,0) << " " << pose(2,1) << " " << pose(2,2) << " " << pose(2,3)<< "x2\n";

double yaw,pitch, roll;
wRo_to_euler(m,yaw,pitch,roll);
Expand All @@ -362,9 +362,9 @@ void simulate_callback (const pcl::visualization::KeyboardEvent &event,

// matrix->GetElement(1,0);

cout << m(0,0) << " " << m(0,1) << " " << m(0,2) << " " << " x0\n";
cout << m(1,0) << " " << m(1,1) << " " << m(1,2) << " " << " x1\n";
cout << m(2,0) << " " << m(2,1) << " " << m(2,2) << " "<< "x2\n\n";
std::cout << m(0,0) << " " << m(0,1) << " " << m(0,2) << " " << " x0\n";
std::cout << m(1,0) << " " << m(1,1) << " " << m(1,2) << " " << " x1\n";
std::cout << m(2,0) << " " << m(2,1) << " " << m(2,2) << " "<< "x2\n\n";

Eigen::Quaternionf rf;
rf = Eigen::Quaternionf(m);
Expand Down Expand Up @@ -395,7 +395,7 @@ void simulate_callback (const pcl::visualization::KeyboardEvent &event,
ss2.precision(20);
ss2 << "simulated_pcl_" << tic << ".pcd";
capture(init_pose);
cout << (getTime() -tic) << " sec\n";
std::cout << (getTime() -tic) << " sec\n";
}
}

Expand Down
2 changes: 1 addition & 1 deletion simulation/tools/simulation_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ pcl::simulation::SimExample::write_depth_image_uint(const float* depth_buffer, s
if (z_new>65535) z_new = 65535;

if ( z_new < 18000){
cout << z_new << " " << d << " " << x << "\n";
std::cout << z_new << " " << d << " " << x << "\n";
}

depth_img[i] = z_new;
Expand Down
2 changes: 1 addition & 1 deletion test/features/test_ii_normals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ TEST(PCL, IntegralImage1D)
{
for(unsigned xIdx = 0; xIdx < width - window_width; ++xIdx)
{
//cout << xIdx << " : " << yIdx << " - " << window_width << " x " << window_height << " :: " << integral_image1.getFirstOrderSum (xIdx, yIdx, window_width, window_height) * 2 << endl;
//std::cout << xIdx << " : " << yIdx << " - " << window_width << " x " << window_height << " :: " << integral_image1.getFirstOrderSum (xIdx, yIdx, window_width, window_height) * 2 << std::endl;
EXPECT_EQ (window_height * window_width * (window_width + 2 * xIdx - 1), integral_image1.getFirstOrderSum (xIdx, yIdx, window_width, window_height) * 2);
EXPECT_EQ (window_height * window_width * (window_width + 2 * xIdx - 1), integral_image2.getFirstOrderSum (xIdx, yIdx, window_width, window_height) * 2);
EXPECT_EQ (window_height * window_width, integral_image1.getFiniteElementsCount (xIdx, yIdx, window_width, window_height));
Expand Down
Loading

0 comments on commit 000a762

Please sign in to comment.