diff --git a/doc/demo_overview.md b/doc/demo_overview.md index cfc07fa8..58c88631 100644 --- a/doc/demo_overview.md +++ b/doc/demo_overview.md @@ -134,7 +134,7 @@ We enumerate some of the most important flags, check the `Flags Detailed Descrip Each flag is divided into flag name, default value, and description. 1. Debugging/Other -- DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones."); +- DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any opLog() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones."); - DEFINE_bool(disable_multi_thread, false, "It would slightly reduce the frame rate in order to highly reduce the lag. Mainly useful for 1) Cases where it is needed a low latency (e.g., webcam in real-time scenarios with low-range GPU devices); and 2) Debugging OpenPose when it is crashing to locate the error."); - DEFINE_int32(profile_speed, 1000, "If PROFILER_ENABLED was set in CMake or Makefile.config files, OpenPose will show some runtime statistics at this frame number."); diff --git a/doc/library_how_to_develop.md b/doc/library_how_to_develop.md index 625b243a..f8301e53 100644 --- a/doc/library_how_to_develop.md +++ b/doc/library_how_to_develop.md @@ -66,8 +66,8 @@ This is the faster method to debug a segmentation fault problem. Usual scenario: 2. Go to `openpose/utilities/errorAndLog.hpp` and modify `dLog`: 1. Comment `#ifndef NDEBUG` and its else and endif. 2. Call OpenPose with `--logging_level 0 --disable_multi_thread`. - 3. At this point you have an idea of in which file class the segmentation fault is coming from. Now you can further isolate the error by iteratively adding the following line all over the code until you find the exact position of the segmentation fault: `log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);` - 4. After you have found the segmentation fault, remember to remove all the extra `log()` calls that you temporarily added. + 3. At this point you have an idea of in which file class the segmentation fault is coming from. Now you can further isolate the error by iteratively adding the following line all over the code until you find the exact position of the segmentation fault: `opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);` + 4. After you have found the segmentation fault, remember to remove all the extra `opLog()` calls that you temporarily added. diff --git a/doc/release_notes.md b/doc/release_notes.md index 426496b4..8acbad11 100644 --- a/doc/release_notes.md +++ b/doc/release_notes.md @@ -391,6 +391,7 @@ OpenPose Library - Release Notes 4. In all `*.cpp` files, their include of their analog `*.hpp` file has been moved to the first line of those `*.cpp` files to slightly speed up compiling time. 2. Functions or parameters renamed: 1. All headers moved into `openpose_private` and all 3rd-party library calls in headers. + 2. Renamed `dLog()` as `opLogIfDebug()`, `log()` as `opLog()`, `check()` as `checkBool()`, and also renamed all the `checkX()` functions in `include/openpose/utilities/check.hpp`. This avoids compiling crashes when exporting OpenPose to other projects which contain other 3rd-party libraries that define functions with the same popular names with `#define`. 3. Main bugs fixed: 1. Removed many Visual Studio (Windows) warnings. 4. Changes/additions that affect the compatibility with the OpenPose Unity Plugin: diff --git a/examples/calibration/calibration.cpp b/examples/calibration/calibration.cpp index 2f70bba3..004a6cbd 100644 --- a/examples/calibration/calibration.cpp +++ b/examples/calibration/calibration.cpp @@ -38,12 +38,13 @@ int openPoseDemo() { try { - op::log("Starting OpenPose calibration toolbox...", op::Priority::High); + op::opLog("Starting OpenPose calibration toolbox...", op::Priority::High); const auto opTimer = op::getTimerInit(); // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Common parameters @@ -54,7 +55,7 @@ int openPoseDemo() // Calibration - Intrinsics if (FLAGS_mode == 1) { - op::log("Running calibration (intrinsic parameters)...", op::Priority::High); + op::opLog("Running calibration (intrinsic parameters)...", op::Priority::High); // Parameters // const auto flags = 0; // 5 parameters const auto flags = cv::CALIB_RATIONAL_MODEL; // 8 parameters @@ -67,25 +68,25 @@ int openPoseDemo() gridInnerCorners, gridSqureSizeMm, flags, op::formatAsDirectory(FLAGS_camera_parameter_folder), calibrationImageDir, FLAGS_camera_serial_number, saveImagesWithCorners); - op::log("Intrinsic calibration completed!", op::Priority::High); + op::opLog("Intrinsic calibration completed!", op::Priority::High); } // Calibration - Extrinsics else if (FLAGS_mode == 2) { - op::log("Running calibration (extrinsic parameters)...", op::Priority::High); + op::opLog("Running calibration (extrinsic parameters)...", op::Priority::High); // Run calibration op::estimateAndSaveExtrinsics( FLAGS_camera_parameter_folder, calibrationImageDir, gridInnerCorners, gridSqureSizeMm, FLAGS_cam0, FLAGS_cam1, FLAGS_omit_distortion, FLAGS_combine_cam0_extrinsics); // Logging - op::log("Extrinsic calibration completed!", op::Priority::High); + op::opLog("Extrinsic calibration completed!", op::Priority::High); } // Calibration - Extrinsics - Bundle Adjustment (BA) else if (FLAGS_mode == 3) { - op::log("Running calibration (bundle adjustment over extrinsic parameters)...", op::Priority::High); + op::opLog("Running calibration (bundle adjustment over extrinsic parameters)...", op::Priority::High); // Sanity check if (!FLAGS_omit_distortion) op::error("This mode assumes that the images are already undistorted (add flag `--omit_distortion`.", @@ -97,20 +98,20 @@ int openPoseDemo() FLAGS_camera_parameter_folder, calibrationImageDir, gridInnerCorners, gridSqureSizeMm, FLAGS_number_cameras, FLAGS_omit_distortion, saveImagesWithCorners); // Logging - op::log("Extrinsic calibration (bundle adjustment) completed!", op::Priority::High); + op::opLog("Extrinsic calibration (bundle adjustment) completed!", op::Priority::High); } // // Calibration - Extrinsics Refinement with Visual SFM // else if (FLAGS_mode == 4) // { - // op::log("Running calibration (intrinsic parameters)...", op::Priority::High); + // op::opLog("Running calibration (intrinsic parameters)...", op::Priority::High); // // Obtain & save intrinsics // const auto saveImagesWithCorners = false; // // const auto saveImagesWithCorners = true; // // Run camera calibration code // op::estimateAndSaveSiftFile( // gridInnerCorners, calibrationImageDir, FLAGS_number_cameras, saveImagesWithCorners); - // op::log("Intrinsic calibration completed!", op::Priority::High); + // op::opLog("Intrinsic calibration completed!", op::Priority::High); // } else diff --git a/examples/openpose/openpose.cpp b/examples/openpose/openpose.cpp index cea81677..c4453c01 100755 --- a/examples/openpose/openpose.cpp +++ b/examples/openpose/openpose.cpp @@ -19,8 +19,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -46,8 +47,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -119,16 +121,16 @@ int openPoseDemo() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configure OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time diff --git a/examples/tests/clTest.cpp b/examples/tests/clTest.cpp index 2104a4f7..87f69524 100644 --- a/examples/tests/clTest.cpp +++ b/examples/tests/clTest.cpp @@ -203,7 +203,7 @@ int clTest() // cv::imshow("gpuImg", gpuImg); // cv::imshow("cpuImg", cpuImg); - // op::log("Done"); + // op::opLog("Done"); // cv::waitKey(0); return 0; diff --git a/examples/tests/handFromJsonTest.cpp b/examples/tests/handFromJsonTest.cpp index 172671b8..3adb14d6 100644 --- a/examples/tests/handFromJsonTest.cpp +++ b/examples/tests/handFromJsonTest.cpp @@ -30,12 +30,13 @@ int handFromJsonTest() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto timerBegin = std::chrono::high_resolution_clock::now(); // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Applying user defined configuration - GFlags to program variables @@ -45,7 +46,7 @@ int handFromJsonTest() const auto producerSharedPtr = op::createProducer(op::ProducerType::ImageDirectory, FLAGS_image_dir); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::WrapperHandFromJsonTest opWrapper; // Pose configuration (use WrapperStructPose{} for default and recommended configuration) op::WrapperStructPose wrapperStructPose{ @@ -62,7 +63,7 @@ int handFromJsonTest() FLAGS_write_json, op::flagsToDisplayMode(FLAGS_display, false)); // Start processing - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time @@ -71,7 +72,7 @@ int handFromJsonTest() std::chrono::duration_cast(now-timerBegin).count()* 1e-9); const auto message = "OpenPose demo successfully finished. Total time: " + std::to_string(totalTimeSec) + " seconds."; - op::log(message, op::Priority::High); + op::opLog(message, op::Priority::High); return 0; } diff --git a/examples/tests/resizeTest.cpp b/examples/tests/resizeTest.cpp index e50b839c..d6fc76b8 100644 --- a/examples/tests/resizeTest.cpp +++ b/examples/tests/resizeTest.cpp @@ -92,7 +92,7 @@ cv::imshow("gpuImg", gpuImg); cv::imshow("cpuImg", cpuImg); - op::log("Done"); + op::opLog("Done"); cv::waitKey(0); return 0; diff --git a/examples/tests/wrapperHandFromJsonTest.hpp b/examples/tests/wrapperHandFromJsonTest.hpp index d58d2d40..476c68d5 100644 --- a/examples/tests/wrapperHandFromJsonTest.hpp +++ b/examples/tests/wrapperHandFromJsonTest.hpp @@ -129,7 +129,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Shortcut typedef std::shared_ptr TDatumsPtr; @@ -160,7 +160,7 @@ namespace op // Reset initial GPU to 0 (we want them all) gpuNumberStart = 0; // Logging message - log("Auto-detecting GPUs... Detected " + std::to_string(gpuNumber) + " GPU(s), using them all.", Priority::High); + opLog("Auto-detecting GPUs... Detected " + std::to_string(gpuNumber) + " GPU(s), using them all.", Priority::High); } // Proper format @@ -168,8 +168,9 @@ namespace op // Common parameters const auto finalOutputSize = wrapperStructPose.outputSize; - const Point producerSize{(int)producerSharedPtr->get(CV_CAP_PROP_FRAME_WIDTH), - (int)producerSharedPtr->get(CV_CAP_PROP_FRAME_HEIGHT)}; + const Point producerSize{ + (int)producerSharedPtr->get(getCvCapPropFrameWidth()), + (int)producerSharedPtr->get(getCvCapPropFrameHeight())}; if (finalOutputSize.x == -1 || finalOutputSize.y == -1) { const auto message = "Output resolution cannot be (-1 x -1) unless producerSharedPtr is also set."; @@ -267,7 +268,7 @@ namespace op ); spWGui = {std::make_shared>(gui)}; } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -363,7 +364,7 @@ namespace op // Thread Y+1, queues Q+1 -> Q+2 if (spWGui != nullptr) mThreadManager.add(threadId++, spWGui, queueIn++, queueOut++); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/examples/tutorial_add_module/1_custom_post_processing.cpp b/examples/tutorial_add_module/1_custom_post_processing.cpp index fae1d14b..5233a9ef 100644 --- a/examples/tutorial_add_module/1_custom_post_processing.cpp +++ b/examples/tutorial_add_module/1_custom_post_processing.cpp @@ -37,8 +37,9 @@ void configureWrapper(op::WrapperT& opWrapperT) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -64,8 +65,9 @@ void configureWrapper(op::WrapperT& opWrapperT) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -147,15 +149,15 @@ int tutorialAddModule1() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configure OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::WrapperT opWrapperT; configureWrapper(opWrapperT); - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); // Start, run & stop threads - it blocks this thread until all others have finished opWrapperT.exec(); diff --git a/examples/tutorial_add_module/wUserPostProcessing.hpp b/examples/tutorial_add_module/wUserPostProcessing.hpp index bdb3ca42..33c219fa 100644 --- a/examples/tutorial_add_module/wUserPostProcessing.hpp +++ b/examples/tutorial_add_module/wUserPostProcessing.hpp @@ -52,7 +52,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); for (auto& datum : *tDatums) @@ -66,7 +66,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/examples/tutorial_api_cpp/01_body_from_image_default.cpp b/examples/tutorial_api_cpp/01_body_from_image_default.cpp index 52ff6f3e..22f5fc97 100644 --- a/examples/tutorial_api_cpp/01_body_from_image_default.cpp +++ b/examples/tutorial_api_cpp/01_body_from_image_default.cpp @@ -33,7 +33,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -49,33 +49,33 @@ void printKeypoints(const std::shared_ptr if (datumsPtr != nullptr && !datumsPtr->empty()) { // Alternative 1 - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); // // Alternative 2 - // op::log(datumsPtr->at(0).poseKeypoints, op::Priority::High); + // op::opLog(datumsPtr->at(0).poseKeypoints, op::Priority::High); // // Alternative 3 // std::cout << datumsPtr->at(0).poseKeypoints << std::endl; // // Alternative 4 - Accesing each element of the keypoints - // op::log("\nKeypoints:", op::Priority::High); + // op::opLog("\nKeypoints:", op::Priority::High); // const auto& poseKeypoints = datumsPtr->at(0).poseKeypoints; - // op::log("Person pose keypoints:", op::Priority::High); + // op::opLog("Person pose keypoints:", op::Priority::High); // for (auto person = 0 ; person < poseKeypoints.getSize(0) ; person++) // { - // op::log("Person " + std::to_string(person) + " (x, y, score):", op::Priority::High); + // op::opLog("Person " + std::to_string(person) + " (x, y, score):", op::Priority::High); // for (auto bodyPart = 0 ; bodyPart < poseKeypoints.getSize(1) ; bodyPart++) // { // std::string valueToPrint; // for (auto xyscore = 0 ; xyscore < poseKeypoints.getSize(2) ; xyscore++) // valueToPrint += std::to_string( poseKeypoints[{person, bodyPart, xyscore}] ) + " "; - // op::log(valueToPrint, op::Priority::High); + // op::opLog(valueToPrint, op::Priority::High); // } // } - // op::log(" ", op::Priority::High); + // op::opLog(" ", op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -87,18 +87,18 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; // Set to single-thread (for sequential processing and/or debugging and/or reducing latency) if (FLAGS_disable_multi_thread) opWrapper.disableMultiThreading(); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Process and display image @@ -112,7 +112,7 @@ int tutorialApiCpp() display(datumProcessed); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Measuring total time op::printTime(opTimer, "OpenPose demo successfully finished. Total time: ", " seconds.", op::Priority::High); diff --git a/examples/tutorial_api_cpp/02_whole_body_from_image_default.cpp b/examples/tutorial_api_cpp/02_whole_body_from_image_default.cpp index 98f5e7db..8e04ae89 100644 --- a/examples/tutorial_api_cpp/02_whole_body_from_image_default.cpp +++ b/examples/tutorial_api_cpp/02_whole_body_from_image_default.cpp @@ -33,7 +33,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -48,13 +48,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -66,11 +66,11 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; // Add hand and face opWrapper.configure(op::WrapperStructFace{true}); @@ -80,7 +80,7 @@ int tutorialApiCpp() opWrapper.disableMultiThreading(); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Process and display image @@ -94,7 +94,7 @@ int tutorialApiCpp() display(datumProcessed); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Measuring total time op::printTime(opTimer, "OpenPose demo successfully finished. Total time: ", " seconds.", op::Priority::High); diff --git a/examples/tutorial_api_cpp/03_keypoints_from_image.cpp b/examples/tutorial_api_cpp/03_keypoints_from_image.cpp index 42a08365..6e2b8db7 100644 --- a/examples/tutorial_api_cpp/03_keypoints_from_image.cpp +++ b/examples/tutorial_api_cpp/03_keypoints_from_image.cpp @@ -35,7 +35,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -50,13 +50,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -71,8 +71,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -91,8 +92,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -155,16 +157,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Process and display image @@ -178,7 +180,7 @@ int tutorialApiCpp() display(datumProcessed); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Measuring total time op::printTime(opTimer, "OpenPose demo successfully finished. Total time: ", " seconds.", op::Priority::High); diff --git a/examples/tutorial_api_cpp/04_keypoints_from_images.cpp b/examples/tutorial_api_cpp/04_keypoints_from_images.cpp index a5830135..71695dd5 100644 --- a/examples/tutorial_api_cpp/04_keypoints_from_images.cpp +++ b/examples/tutorial_api_cpp/04_keypoints_from_images.cpp @@ -34,7 +34,7 @@ bool display(const std::shared_ptr>>& dat cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); const auto key = (char)cv::waitKey(1); return (key == 27); } @@ -52,13 +52,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -73,8 +73,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -93,8 +94,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -157,16 +159,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Read frames on directory @@ -186,13 +188,13 @@ int tutorialApiCpp() const auto userWantsToExit = display(datumProcessed); if (userWantsToExit) { - op::log("User pressed Esc to exit demo.", op::Priority::High); + op::opLog("User pressed Esc to exit demo.", op::Priority::High); break; } } } else - op::log("Image " + imagePath + " could not be processed.", op::Priority::High); + op::opLog("Image " + imagePath + " could not be processed.", op::Priority::High); } // Measuring total time diff --git a/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp b/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp index a42b0876..e00a47c5 100644 --- a/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp +++ b/examples/tutorial_api_cpp/05_keypoints_from_images_multi_gpu.cpp @@ -40,7 +40,7 @@ bool display(const std::shared_ptr>>& dat cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); const auto key = (char)cv::waitKey(1); return (key == 27); } @@ -58,13 +58,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -79,8 +79,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -99,8 +100,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -163,11 +165,11 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Increase maximum wrapper queue size @@ -175,7 +177,7 @@ int tutorialApiCpp() opWrapper.setDefaultMaxSizeQueues(std::numeric_limits::max()); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Read frames on directory @@ -226,13 +228,13 @@ int tutorialApiCpp() const auto userWantsToExit = display(datumProcessed); if (userWantsToExit) { - op::log("User pressed Esc to exit demo.", op::Priority::High); + op::opLog("User pressed Esc to exit demo.", op::Priority::High); break; } } } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); } } } @@ -245,7 +247,7 @@ int tutorialApiCpp() else { // Read and push all images into OpenPose wrapper - op::log("Loading images into OpenPose wrapper...", op::Priority::High); + op::opLog("Loading images into OpenPose wrapper...", op::Priority::High); for (const auto& imagePath : imagePaths) { // Faster alternative that moves imageToProcess @@ -257,7 +259,7 @@ int tutorialApiCpp() // opWrapper.waitAndPush(imageToProcess); } // Retrieve processed results from OpenPose wrapper - op::log("Retrieving results from OpenPose wrapper...", op::Priority::High); + op::opLog("Retrieving results from OpenPose wrapper...", op::Priority::High); for (auto imageId = 0u ; imageId < imagePaths.size() ; imageId++) { std::shared_ptr>> datumProcessed; @@ -270,13 +272,13 @@ int tutorialApiCpp() const auto userWantsToExit = display(datumProcessed); if (userWantsToExit) { - op::log("User pressed Esc to exit demo.", op::Priority::High); + op::opLog("User pressed Esc to exit demo.", op::Priority::High); break; } } } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); } } diff --git a/examples/tutorial_api_cpp/06_face_from_image.cpp b/examples/tutorial_api_cpp/06_face_from_image.cpp index 0683d471..a8259908 100644 --- a/examples/tutorial_api_cpp/06_face_from_image.cpp +++ b/examples/tutorial_api_cpp/06_face_from_image.cpp @@ -38,7 +38,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -53,13 +53,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -74,8 +74,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -94,8 +95,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -158,7 +160,7 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Required flags to enable heatmaps @@ -167,12 +169,12 @@ int tutorialApiCpp() FLAGS_face_detector = 2; // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Read image and face rectangle locations @@ -202,10 +204,10 @@ int tutorialApiCpp() display(datumsPtr); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Info - op::log("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" + op::opLog("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" "\t`--body 0 --face --face_detector 2`", op::Priority::High); // Measuring total time diff --git a/examples/tutorial_api_cpp/07_hand_from_image.cpp b/examples/tutorial_api_cpp/07_hand_from_image.cpp index 2029a065..74894778 100644 --- a/examples/tutorial_api_cpp/07_hand_from_image.cpp +++ b/examples/tutorial_api_cpp/07_hand_from_image.cpp @@ -38,7 +38,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -53,13 +53,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -74,8 +74,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -94,8 +95,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -158,7 +160,7 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Required flags to enable heatmaps @@ -167,12 +169,12 @@ int tutorialApiCpp() FLAGS_hand_detector = 2; // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Read image and hand rectangle locations @@ -211,10 +213,10 @@ int tutorialApiCpp() display(datumsPtr); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Info - op::log("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" + op::opLog("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" "\t`--body 0 --hand --hand_detector 2`", op::Priority::High); // Measuring total time diff --git a/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp b/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp index e1cbeab3..75acc86c 100644 --- a/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp +++ b/examples/tutorial_api_cpp/08_heatmaps_from_image.cpp @@ -60,7 +60,7 @@ bool display( cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", imageToRender); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); const auto key = (char)cv::waitKey(1); return (key == 27); } @@ -82,12 +82,12 @@ void printKeypoints(const std::shared_ptr const auto numberChannels = poseHeatMaps.getSize(0); const auto height = poseHeatMaps.getSize(1); const auto width = poseHeatMaps.getSize(2); - op::log("Body heatmaps has " + std::to_string(numberChannels) + " channels, and each channel has a" + op::opLog("Body heatmaps has " + std::to_string(numberChannels) + " channels, and each channel has a" " dimension of " + std::to_string(width) + " x " + std::to_string(height) + " pixels.", op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -102,8 +102,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -122,8 +123,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -186,7 +188,7 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Required flags to enable heatmaps @@ -196,12 +198,12 @@ int tutorialApiCpp() FLAGS_heatmaps_scale = 2; // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Process and display image @@ -220,10 +222,10 @@ int tutorialApiCpp() } } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Info - op::log("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" + op::opLog("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" "\t`--heatmaps_add_parts --heatmaps_add_bkg --heatmaps_add_PAFs`", op::Priority::High); diff --git a/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp b/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp index cfad04cf..14c7af2f 100644 --- a/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp +++ b/examples/tutorial_api_cpp/09_keypoints_from_heatmaps.cpp @@ -38,7 +38,7 @@ void display(const std::shared_ptr>>& dat cv::waitKey(0); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -53,13 +53,13 @@ void printKeypoints(const std::shared_ptr // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Body keypoints: " + datumsPtr->at(0)->poseKeypoints.toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } catch (const std::exception& e) { @@ -74,8 +74,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -94,8 +95,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -158,7 +160,7 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Image to process @@ -169,7 +171,7 @@ int tutorialApiCpp() FLAGS_body = 2; // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapper); @@ -179,7 +181,7 @@ int tutorialApiCpp() // Replace the following lines inside the try-catch block with your custom heatmap generator try { - op::log("Temporarily running another OpenPose instance to get the heatmaps...", op::Priority::High); + op::opLog("Temporarily running another OpenPose instance to get the heatmaps...", op::Priority::High); // Required flags to enable heatmaps FLAGS_heatmaps_add_parts = true; FLAGS_heatmaps_add_bkg = true; @@ -206,7 +208,7 @@ int tutorialApiCpp() } // Starting OpenPose - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // Create new datum @@ -227,10 +229,10 @@ int tutorialApiCpp() display(datumProcessed); } else - op::log("Image could not be processed.", op::Priority::High); + op::opLog("Image could not be processed.", op::Priority::High); // Info - op::log("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" + op::opLog("NOTE: In addition with the user flags, this demo has auto-selected the following flags:\n" "\t`--body 2`", op::Priority::High); // Measuring total time diff --git a/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp b/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp index cf3d4fc2..9359e96a 100644 --- a/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp +++ b/examples/tutorial_api_cpp/10_asynchronous_custom_input.cpp @@ -36,7 +36,7 @@ public: // Close program when empty frame if (mClosed || mImageFiles.size() <= mCounter) { - op::log("Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); + op::opLog("Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); // This funtion stops this worker, which will eventually stop the whole thread system once all the frames // have been processed mClosed = true; @@ -57,7 +57,7 @@ public: // If empty frame -> return nullptr if (datumPtr->cvInputData.empty()) { - op::log("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", + op::opLog("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", op::Priority::High); mClosed = true; datumsPtr = nullptr; @@ -85,8 +85,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -105,8 +106,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -172,16 +174,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::AsynchronousIn}; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // User processing @@ -195,11 +197,11 @@ int tutorialApiCpp() { auto successfullyEmplaced = opWrapper.waitAndEmplace(datumToProcess); if (!successfullyEmplaced) - op::log("Processed datum could not be emplaced.", op::Priority::High); + op::opLog("Processed datum could not be emplaced.", op::Priority::High); } } - op::log("Stopping thread(s)", op::Priority::High); + op::opLog("Stopping thread(s)", op::Priority::High); opWrapper.stop(); // Measuring total time diff --git a/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp b/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp index 1a0d53da..1e77fb63 100644 --- a/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp +++ b/examples/tutorial_api_cpp/11_asynchronous_custom_output.cpp @@ -31,7 +31,7 @@ public: cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); const auto key = (char)cv::waitKey(1); return (key == 27); } @@ -40,13 +40,13 @@ public: // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("\nKeypoints:"); + op::opLog("\nKeypoints:"); // Accesing each element of the keypoints const auto& poseKeypoints = datumsPtr->at(0)->poseKeypoints; - op::log("Person pose keypoints:"); + op::opLog("Person pose keypoints:"); for (auto person = 0 ; person < poseKeypoints.getSize(0) ; person++) { - op::log("Person " + std::to_string(person) + " (x, y, score):"); + op::opLog("Person " + std::to_string(person) + " (x, y, score):"); for (auto bodyPart = 0 ; bodyPart < poseKeypoints.getSize(1) ; bodyPart++) { std::string valueToPrint; @@ -54,39 +54,39 @@ public: { valueToPrint += std::to_string( poseKeypoints[{person, bodyPart, xyscore}] ) + " "; } - op::log(valueToPrint); + op::opLog(valueToPrint); } } - op::log(" "); + op::opLog(" "); // Alternative: just getting std::string equivalent - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); // Heatmaps const auto& poseHeatMaps = datumsPtr->at(0)->poseHeatMaps; if (!poseHeatMaps.empty()) { - op::log("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + op::opLog("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + std::to_string(poseHeatMaps.getSize(1)) + ", " + std::to_string(poseHeatMaps.getSize(2)) + "]"); const auto& faceHeatMaps = datumsPtr->at(0)->faceHeatMaps; - op::log("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + op::opLog("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + std::to_string(faceHeatMaps.getSize(1)) + ", " + std::to_string(faceHeatMaps.getSize(2)) + ", " + std::to_string(faceHeatMaps.getSize(3)) + "]"); const auto& handHeatMaps = datumsPtr->at(0)->handHeatMaps; - op::log("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + op::opLog("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + std::to_string(handHeatMaps[0].getSize(1)) + ", " + std::to_string(handHeatMaps[0].getSize(2)) + ", " + std::to_string(handHeatMaps[0].getSize(3)) + "]"); - op::log("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + op::opLog("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + std::to_string(handHeatMaps[1].getSize(1)) + ", " + std::to_string(handHeatMaps[1].getSize(2)) + ", " + std::to_string(handHeatMaps[1].getSize(3)) + "]"); } } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } }; @@ -97,8 +97,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -124,8 +125,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -194,16 +196,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper{op::ThreadManagerMode::AsynchronousOut}; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.start(); // User processing @@ -224,10 +226,10 @@ int tutorialApiCpp() break; // Something else happened else - op::log("Processed datum could not be emplaced.", op::Priority::High); + op::opLog("Processed datum could not be emplaced.", op::Priority::High); } - op::log("Stopping thread(s)", op::Priority::High); + op::opLog("Stopping thread(s)", op::Priority::High); opWrapper.stop(); // Measuring total time diff --git a/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp b/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp index cd71cd02..bb3f2582 100644 --- a/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp +++ b/examples/tutorial_api_cpp/12_asynchronous_custom_input_output_and_datum.cpp @@ -53,7 +53,7 @@ public: // Close program when empty frame if (mClosed || mImageFiles.size() <= mCounter) { - op::log("Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); + op::opLog("Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); // This funtion stops this worker, which will eventually stop the whole thread system once all the frames // have been processed mClosed = true; @@ -74,7 +74,7 @@ public: // If empty frame -> return nullptr if (datumPtr->cvInputData.empty()) { - op::log("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", + op::opLog("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", op::Priority::High); mClosed = true; datumsPtr = nullptr; @@ -113,7 +113,7 @@ public: cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat); } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); const auto key = (char)cv::waitKey(1); return (key == 27); } @@ -128,51 +128,51 @@ public: // Example: How to use the pose keypoints if (datumsPtr != nullptr && !datumsPtr->empty()) { - op::log("\nKeypoints:"); + op::opLog("\nKeypoints:"); // Accesing each element of the keypoints const auto& poseKeypoints = datumsPtr->at(0)->poseKeypoints; - op::log("Person pose keypoints:"); + op::opLog("Person pose keypoints:"); for (auto person = 0 ; person < poseKeypoints.getSize(0) ; person++) { - op::log("Person " + std::to_string(person) + " (x, y, score):"); + op::opLog("Person " + std::to_string(person) + " (x, y, score):"); for (auto bodyPart = 0 ; bodyPart < poseKeypoints.getSize(1) ; bodyPart++) { std::string valueToPrint; for (auto xyscore = 0 ; xyscore < poseKeypoints.getSize(2) ; xyscore++) valueToPrint += std::to_string( poseKeypoints[{person, bodyPart, xyscore}] ) + " "; - op::log(valueToPrint); + op::opLog(valueToPrint); } } - op::log(" "); + op::opLog(" "); // Alternative: just getting std::string equivalent - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString(), op::Priority::High); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString(), op::Priority::High); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString(), op::Priority::High); // Heatmaps const auto& poseHeatMaps = datumsPtr->at(0)->poseHeatMaps; if (!poseHeatMaps.empty()) { - op::log("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + op::opLog("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + std::to_string(poseHeatMaps.getSize(1)) + ", " + std::to_string(poseHeatMaps.getSize(2)) + "]"); const auto& faceHeatMaps = datumsPtr->at(0)->faceHeatMaps; - op::log("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + op::opLog("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + std::to_string(faceHeatMaps.getSize(1)) + ", " + std::to_string(faceHeatMaps.getSize(2)) + ", " + std::to_string(faceHeatMaps.getSize(3)) + "]"); const auto& handHeatMaps = datumsPtr->at(0)->handHeatMaps; - op::log("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + op::opLog("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + std::to_string(handHeatMaps[0].getSize(1)) + ", " + std::to_string(handHeatMaps[0].getSize(2)) + ", " + std::to_string(handHeatMaps[0].getSize(3)) + "]"); - op::log("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + op::opLog("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + std::to_string(handHeatMaps[1].getSize(1)) + ", " + std::to_string(handHeatMaps[1].getSize(2)) + ", " + std::to_string(handHeatMaps[1].getSize(3)) + "]"); } } else - op::log("Nullptr or empty datumsPtr found.", op::Priority::High); + op::opLog("Nullptr or empty datumsPtr found.", op::Priority::High); } }; @@ -183,8 +183,9 @@ void configureWrapper(op::WrapperT& opWrapperT) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -203,8 +204,9 @@ void configureWrapper(op::WrapperT& opWrapperT) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -267,16 +269,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // Configuring OpenPose - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::WrapperT opWrapperT{op::ThreadManagerMode::Asynchronous}; configureWrapper(opWrapperT); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapperT.start(); // User processing @@ -299,11 +301,11 @@ int tutorialApiCpp() userOutputClass.printKeypoints(datumProcessed); } else - op::log("Processed datum could not be emplaced.", op::Priority::High); + op::opLog("Processed datum could not be emplaced.", op::Priority::High); } } - op::log("Stopping thread(s)", op::Priority::High); + op::opLog("Stopping thread(s)", op::Priority::High); opWrapperT.stop(); // Measuring total time diff --git a/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp b/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp index 397c1593..8b1054f1 100644 --- a/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp +++ b/examples/tutorial_api_cpp/13_synchronous_custom_input.cpp @@ -39,7 +39,7 @@ public: // Close program when empty frame if (mImageFiles.size() <= mCounter) { - op::log("Last frame read and added to queue. Closing program after it is processed.", + op::opLog("Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); // This funtion stops this worker, which will eventually stop the whole thread system once all the // frames have been processed @@ -61,7 +61,7 @@ public: // If empty frame -> return nullptr if (datumPtr->cvInputData.empty()) { - op::log("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", + op::opLog("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", op::Priority::High); this->stop(); datumsPtr = nullptr; @@ -90,8 +90,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -110,8 +111,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -185,16 +187,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time diff --git a/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp b/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp index 95ec4292..1bbb753d 100644 --- a/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp +++ b/examples/tutorial_api_cpp/14_synchronous_custom_preprocessing.cpp @@ -52,8 +52,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -79,8 +80,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -159,16 +161,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time diff --git a/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp b/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp index f698076b..102a0733 100644 --- a/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp +++ b/examples/tutorial_api_cpp/15_synchronous_custom_postprocessing.cpp @@ -53,8 +53,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -80,8 +81,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -160,16 +162,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time diff --git a/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp b/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp index a4f2f50e..fb2703bc 100644 --- a/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp +++ b/examples/tutorial_api_cpp/16_synchronous_custom_output.cpp @@ -32,13 +32,13 @@ public: if (datumsPtr != nullptr && !datumsPtr->empty()) { // Show in command line the resulting pose keypoints for body, face and hands - op::log("\nKeypoints:"); + op::opLog("\nKeypoints:"); // Accesing each element of the keypoints const auto& poseKeypoints = datumsPtr->at(0)->poseKeypoints; - op::log("Person pose keypoints:"); + op::opLog("Person pose keypoints:"); for (auto person = 0 ; person < poseKeypoints.getSize(0) ; person++) { - op::log("Person " + std::to_string(person) + " (x, y, score):"); + op::opLog("Person " + std::to_string(person) + " (x, y, score):"); for (auto bodyPart = 0 ; bodyPart < poseKeypoints.getSize(1) ; bodyPart++) { std::string valueToPrint; @@ -46,32 +46,32 @@ public: { valueToPrint += std::to_string( poseKeypoints[{person, bodyPart, xyscore}] ) + " "; } - op::log(valueToPrint); + op::opLog(valueToPrint); } } - op::log(" "); + op::opLog(" "); // Alternative: just getting std::string equivalent - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString()); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString()); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString()); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString()); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString()); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString()); // Heatmaps const auto& poseHeatMaps = datumsPtr->at(0)->poseHeatMaps; if (!poseHeatMaps.empty()) { - op::log("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + op::opLog("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + std::to_string(poseHeatMaps.getSize(1)) + ", " + std::to_string(poseHeatMaps.getSize(2)) + "]"); const auto& faceHeatMaps = datumsPtr->at(0)->faceHeatMaps; - op::log("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + op::opLog("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + std::to_string(faceHeatMaps.getSize(1)) + ", " + std::to_string(faceHeatMaps.getSize(2)) + ", " + std::to_string(faceHeatMaps.getSize(3)) + "]"); const auto& handHeatMaps = datumsPtr->at(0)->handHeatMaps; - op::log("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + op::opLog("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + std::to_string(handHeatMaps[0].getSize(1)) + ", " + std::to_string(handHeatMaps[0].getSize(2)) + ", " + std::to_string(handHeatMaps[0].getSize(3)) + "]"); - op::log("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + op::opLog("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + std::to_string(handHeatMaps[1].getSize(1)) + ", " + std::to_string(handHeatMaps[1].getSize(2)) + ", " + std::to_string(handHeatMaps[1].getSize(3)) + "]"); @@ -105,8 +105,9 @@ void configureWrapper(op::Wrapper& opWrapper) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -132,8 +133,9 @@ void configureWrapper(op::Wrapper& opWrapper) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -209,16 +211,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::Wrapper opWrapper; configureWrapper(opWrapper); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapper.exec(); // Measuring total time diff --git a/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp b/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp index 0086efe6..369b82ba 100644 --- a/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp +++ b/examples/tutorial_api_cpp/17_synchronous_custom_all_and_datum.cpp @@ -58,8 +58,8 @@ public: // Close program when empty frame if (mImageFiles.size() <= mCounter) { - op::log("Last frame read and added to queue. Closing program after it is processed.", - op::Priority::High); + op::opLog( + "Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); // This funtion stops this worker, which will eventually stop the whole thread system once all the // frames have been processed this->stop(); @@ -80,7 +80,8 @@ public: // If empty frame -> return nullptr if (datumPtr->cvInputData.empty()) { - op::log("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", + op::opLog( + "Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", op::Priority::High); this->stop(); datumsPtr = nullptr; @@ -153,13 +154,13 @@ public: if (datumsPtr != nullptr && !datumsPtr->empty()) { // Show in command line the resulting pose keypoints for body, face and hands - op::log("\nKeypoints:"); + op::opLog("\nKeypoints:"); // Accesing each element of the keypoints const auto& poseKeypoints = datumsPtr->at(0)->poseKeypoints; - op::log("Person pose keypoints:"); + op::opLog("Person pose keypoints:"); for (auto person = 0 ; person < poseKeypoints.getSize(0) ; person++) { - op::log("Person " + std::to_string(person) + " (x, y, score):"); + op::opLog("Person " + std::to_string(person) + " (x, y, score):"); for (auto bodyPart = 0 ; bodyPart < poseKeypoints.getSize(1) ; bodyPart++) { std::string valueToPrint; @@ -167,32 +168,32 @@ public: { valueToPrint += std::to_string( poseKeypoints[{person, bodyPart, xyscore}] ) + " "; } - op::log(valueToPrint); + op::opLog(valueToPrint); } } - op::log(" "); + op::opLog(" "); // Alternative: just getting std::string equivalent - op::log("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString()); - op::log("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString()); - op::log("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString()); + op::opLog("Face keypoints: " + datumsPtr->at(0)->faceKeypoints.toString()); + op::opLog("Left hand keypoints: " + datumsPtr->at(0)->handKeypoints[0].toString()); + op::opLog("Right hand keypoints: " + datumsPtr->at(0)->handKeypoints[1].toString()); // Heatmaps const auto& poseHeatMaps = datumsPtr->at(0)->poseHeatMaps; if (!poseHeatMaps.empty()) { - op::log("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + op::opLog("Pose heatmaps size: [" + std::to_string(poseHeatMaps.getSize(0)) + ", " + std::to_string(poseHeatMaps.getSize(1)) + ", " + std::to_string(poseHeatMaps.getSize(2)) + "]"); const auto& faceHeatMaps = datumsPtr->at(0)->faceHeatMaps; - op::log("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + op::opLog("Face heatmaps size: [" + std::to_string(faceHeatMaps.getSize(0)) + ", " + std::to_string(faceHeatMaps.getSize(1)) + ", " + std::to_string(faceHeatMaps.getSize(2)) + ", " + std::to_string(faceHeatMaps.getSize(3)) + "]"); const auto& handHeatMaps = datumsPtr->at(0)->handHeatMaps; - op::log("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + op::opLog("Left hand heatmaps size: [" + std::to_string(handHeatMaps[0].getSize(0)) + ", " + std::to_string(handHeatMaps[0].getSize(1)) + ", " + std::to_string(handHeatMaps[0].getSize(2)) + ", " + std::to_string(handHeatMaps[0].getSize(3)) + "]"); - op::log("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + op::opLog("Right hand heatmaps size: [" + std::to_string(handHeatMaps[1].getSize(0)) + ", " + std::to_string(handHeatMaps[1].getSize(1)) + ", " + std::to_string(handHeatMaps[1].getSize(2)) + ", " + std::to_string(handHeatMaps[1].getSize(3)) + "]"); @@ -226,8 +227,9 @@ void configureWrapper(op::WrapperT& opWrapperT) // Configuring OpenPose // logging_level - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); op::Profiler::setDefaultX(FLAGS_profile_speed); @@ -246,8 +248,9 @@ void configureWrapper(op::WrapperT& opWrapperT) const auto poseModel = op::flagsToPoseModel(FLAGS_model_pose); // JSON saving if (!FLAGS_write_keypoint.empty()) - op::log("Flag `write_keypoint` is deprecated and will eventually be removed." - " Please, use `write_json` instead.", op::Priority::Max); + op::opLog( + "Flag `write_keypoint` is deprecated and will eventually be removed. Please, use `write_json`" + " instead.", op::Priority::Max); // keypointScaleMode const auto keypointScaleMode = op::flagsToScaleMode(FLAGS_keypoint_scale); // heatmaps to add @@ -328,16 +331,16 @@ int tutorialApiCpp() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // OpenPose wrapper - op::log("Configuring OpenPose...", op::Priority::High); + op::opLog("Configuring OpenPose...", op::Priority::High); op::WrapperT opWrapperT; configureWrapper(opWrapperT); // Start, run, and stop processing - exec() blocks this thread until OpenPose wrapper has finished - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); opWrapperT.exec(); // Measuring total time diff --git a/examples/tutorial_api_thread/1_thread_user_processing_function.cpp b/examples/tutorial_api_thread/1_thread_user_processing_function.cpp index 61e8e50f..ba1367b6 100644 --- a/examples/tutorial_api_thread/1_thread_user_processing_function.cpp +++ b/examples/tutorial_api_thread/1_thread_user_processing_function.cpp @@ -46,7 +46,7 @@ public: } catch (const std::exception& e) { - op::log("Some kind of unexpected error happened."); + op::opLog("Some kind of unexpected error happened."); this->stop(); op::error(e.what(), __LINE__, __FUNCTION__, __FILE__); } @@ -57,15 +57,16 @@ int openPoseTutorialThread1() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // ------------------------- INITIALIZATION ------------------------- // Step 1 - Set logging level // - 0 will output all the logging messages // - 255 will output nothing - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Step 2 - Read GFlags (user defined configuration) // cameraSize @@ -83,7 +84,7 @@ int openPoseTutorialThread1() producerType, producerString, cameraSize, FLAGS_camera_parameter_path, FLAGS_frame_undistort, FLAGS_3d_views); producerSharedPtr->setProducerFpsMode(displayProducerFpsMode); - op::log("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); + op::opLog("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Step 3 - Setting producer auto videoSeekSharedPtr = std::make_shared, std::atomic>>(); videoSeekSharedPtr->first = false; @@ -138,7 +139,7 @@ int openPoseTutorialThread1() // threadManager.add(threadId, wGui, queueIn++, queueOut++); // Thread 0, queues 2 -> 3 // ------------------------- STARTING AND STOPPING THREADING ------------------------- - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); // Two different ways of running the program on multithread environment // Option a) Using the main thread (this thread) for processing (it saves 1 thread, recommended) threadManager.exec(); @@ -152,7 +153,7 @@ int openPoseTutorialThread1() // while (threadManager.isRunning()) // std::this_thread::sleep_for(std::chrono::milliseconds{33}); // // Stop and join threads - // op::log("Stopping thread(s)", op::Priority::High); + // op::opLog("Stopping thread(s)", op::Priority::High); // threadManager.stop(); // Measuring total time diff --git a/examples/tutorial_api_thread/2_thread_user_input_processing_output_and_datum.cpp b/examples/tutorial_api_thread/2_thread_user_input_processing_output_and_datum.cpp index aac0e7fb..c7d970d1 100644 --- a/examples/tutorial_api_thread/2_thread_user_input_processing_output_and_datum.cpp +++ b/examples/tutorial_api_thread/2_thread_user_input_processing_output_and_datum.cpp @@ -23,9 +23,9 @@ // Note: This command will show you flags for other unnecessary 3rdparty files. Check only the flags for the OpenPose // executable. E.g., for `openpose.bin`, look for `Flags from examples/openpose/openpose.cpp:`. // Debugging/Other -DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while" - " 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for" - " low priority messages and 4 for important ones."); +DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any opLog() message," + " while 255 will not output any. Current OpenPose library messages are in the range 0-4:" + " 1 for low priority messages and 4 for important ones."); // Producer DEFINE_string(image_dir, "examples/media/", "Process a directory of images. Read all standard formats (jpg, png, bmp, etc.)."); // Consumer @@ -71,8 +71,8 @@ public: // Close program when empty frame if (mImageFiles.size() <= mCounter) { - op::log("Last frame read and added to queue. Closing program after it is processed.", - op::Priority::High); + op::opLog( + "Last frame read and added to queue. Closing program after it is processed.", op::Priority::High); // This funtion stops this worker, which will eventually stop the whole thread system once all the // frames have been processed this->stop(); @@ -93,7 +93,7 @@ public: // If empty frame -> return nullptr if (datumPtr->cvInputData.empty()) { - op::log("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", + op::opLog("Empty frame detected on path: " + mImageFiles.at(mCounter-1) + ". Closing program.", op::Priority::High); this->stop(); datumsPtr = nullptr; @@ -104,7 +104,7 @@ public: } catch (const std::exception& e) { - op::log("Some kind of unexpected error happened."); + op::opLog("Some kind of unexpected error happened."); this->stop(); op::error(e.what(), __LINE__, __FUNCTION__, __FILE__); return nullptr; @@ -145,7 +145,7 @@ public: } catch (const std::exception& e) { - op::log("Some kind of unexpected error happened."); + op::opLog("Some kind of unexpected error happened."); this->stop(); op::error(e.what(), __LINE__, __FUNCTION__, __FILE__); } @@ -175,7 +175,7 @@ public: } catch (const std::exception& e) { - op::log("Some kind of unexpected error happened."); + op::opLog("Some kind of unexpected error happened."); this->stop(); op::error(e.what(), __LINE__, __FUNCTION__, __FILE__); } @@ -186,15 +186,16 @@ int openPoseTutorialThread2() { try { - op::log("Starting OpenPose demo...", op::Priority::High); + op::opLog("Starting OpenPose demo...", op::Priority::High); const auto opTimer = op::getTimerInit(); // ------------------------- INITIALIZATION ------------------------- // Step 1 - Set logging level // - 0 will output all the logging messages // - 255 will output nothing - op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", - __LINE__, __FUNCTION__, __FILE__); + op::checkBool( + 0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", + __LINE__, __FUNCTION__, __FILE__); op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level); // Step 2 - Setting thread workers && manager typedef std::shared_ptr>> TypedefDatumsSP; @@ -223,7 +224,7 @@ int openPoseTutorialThread2() threadManager.add(threadId++, wUserOutput, queueIn++, queueOut++); // Thread 2, queues 2 -> 3 // ------------------------- STARTING AND STOPPING THREADING ------------------------- - op::log("Starting thread(s)...", op::Priority::High); + op::opLog("Starting thread(s)...", op::Priority::High); // Two different ways of running the program on multithread environment // Option a) Using the main thread (this thread) for processing (it saves 1 thread, recommended) threadManager.exec(); @@ -237,7 +238,7 @@ int openPoseTutorialThread2() // while (threadManager.isRunning()) // std::this_thread::sleep_for(std::chrono::milliseconds{33}); // // Stop and join threads - // op::log("Stopping thread(s)", op::Priority::High); + // op::opLog("Stopping thread(s)", op::Priority::High); // threadManager.stop(); // Measuring total time diff --git a/include/openpose/3d/wJointAngleEstimation.hpp b/include/openpose/3d/wJointAngleEstimation.hpp index 3cc60d7a..5c32a5ad 100644 --- a/include/openpose/3d/wJointAngleEstimation.hpp +++ b/include/openpose/3d/wJointAngleEstimation.hpp @@ -67,7 +67,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Input @@ -83,7 +83,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/3d/wPoseTriangulation.hpp b/include/openpose/3d/wPoseTriangulation.hpp index d72fd037..4dca916c 100644 --- a/include/openpose/3d/wPoseTriangulation.hpp +++ b/include/openpose/3d/wPoseTriangulation.hpp @@ -66,7 +66,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // 3-D triangulation and reconstruction @@ -102,7 +102,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wCvMatToOpInput.hpp b/include/openpose/core/wCvMatToOpInput.hpp index 5a317595..80d08ffc 100644 --- a/include/openpose/core/wCvMatToOpInput.hpp +++ b/include/openpose/core/wCvMatToOpInput.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // cv::Mat -> float* @@ -69,7 +69,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wCvMatToOpOutput.hpp b/include/openpose/core/wCvMatToOpOutput.hpp index ec93515b..e4d819a6 100644 --- a/include/openpose/core/wCvMatToOpOutput.hpp +++ b/include/openpose/core/wCvMatToOpOutput.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // T* to T auto& tDatumsNoPtr = *tDatums; // Profiling speed @@ -72,7 +72,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wKeepTopNPeople.hpp b/include/openpose/core/wKeepTopNPeople.hpp index 1628e821..b0dd7dd9 100644 --- a/include/openpose/core/wKeepTopNPeople.hpp +++ b/include/openpose/core/wKeepTopNPeople.hpp @@ -56,7 +56,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Rescale pose data @@ -75,7 +75,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wKeypointScaler.hpp b/include/openpose/core/wKeypointScaler.hpp index ed4676c3..74ceaa2d 100644 --- a/include/openpose/core/wKeypointScaler.hpp +++ b/include/openpose/core/wKeypointScaler.hpp @@ -56,7 +56,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Rescale pose data @@ -77,7 +77,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wOpOutputToCvMat.hpp b/include/openpose/core/wOpOutputToCvMat.hpp index 215c6bbc..ececaa82 100644 --- a/include/openpose/core/wOpOutputToCvMat.hpp +++ b/include/openpose/core/wOpOutputToCvMat.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // float* -> cv::Mat @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wScaleAndSizeExtractor.hpp b/include/openpose/core/wScaleAndSizeExtractor.hpp index 57929f01..d9640a76 100644 --- a/include/openpose/core/wScaleAndSizeExtractor.hpp +++ b/include/openpose/core/wScaleAndSizeExtractor.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // cv::Mat -> float* @@ -73,7 +73,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/core/wVerbosePrinter.hpp b/include/openpose/core/wVerbosePrinter.hpp index 84c0bae2..5109bde9 100644 --- a/include/openpose/core/wVerbosePrinter.hpp +++ b/include/openpose/core/wVerbosePrinter.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Print verbose @@ -72,7 +72,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/face/wFaceDetector.hpp b/include/openpose/face/wFaceDetector.hpp index 3a5c904b..f5da5f08 100644 --- a/include/openpose/face/wFaceDetector.hpp +++ b/include/openpose/face/wFaceDetector.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people face @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/face/wFaceDetectorOpenCV.hpp b/include/openpose/face/wFaceDetectorOpenCV.hpp index 8e53615e..098b3fec 100644 --- a/include/openpose/face/wFaceDetectorOpenCV.hpp +++ b/include/openpose/face/wFaceDetectorOpenCV.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people face @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/face/wFaceExtractorNet.hpp b/include/openpose/face/wFaceExtractorNet.hpp index ce9fb0dd..9139bd4a 100644 --- a/include/openpose/face/wFaceExtractorNet.hpp +++ b/include/openpose/face/wFaceExtractorNet.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Extract people face @@ -73,7 +73,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/face/wFaceRenderer.hpp b/include/openpose/face/wFaceRenderer.hpp index de981856..0986631c 100644 --- a/include/openpose/face/wFaceRenderer.hpp +++ b/include/openpose/face/wFaceRenderer.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people face @@ -70,7 +70,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wBvhSaver.hpp b/include/openpose/filestream/wBvhSaver.hpp index 337e96f0..16335295 100644 --- a/include/openpose/filestream/wBvhSaver.hpp +++ b/include/openpose/filestream/wBvhSaver.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Record BVH file @@ -70,7 +70,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wCocoJsonSaver.hpp b/include/openpose/filestream/wCocoJsonSaver.hpp index dd3264a9..3712dbf8 100644 --- a/include/openpose/filestream/wCocoJsonSaver.hpp +++ b/include/openpose/filestream/wCocoJsonSaver.hpp @@ -61,7 +61,7 @@ namespace op if (tDatums->size() > 1) error("Function only ready for tDatums->size() == 1", __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -73,7 +73,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wFaceSaver.hpp b/include/openpose/filestream/wFaceSaver.hpp index 6d34d3ad..d0806dd4 100644 --- a/include/openpose/filestream/wFaceSaver.hpp +++ b/include/openpose/filestream/wFaceSaver.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -75,7 +75,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wHandSaver.hpp b/include/openpose/filestream/wHandSaver.hpp index ebaea19b..0d6fb158 100644 --- a/include/openpose/filestream/wHandSaver.hpp +++ b/include/openpose/filestream/wHandSaver.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -80,7 +80,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wHeatMapSaver.hpp b/include/openpose/filestream/wHeatMapSaver.hpp index 2f4226b4..5a897a49 100644 --- a/include/openpose/filestream/wHeatMapSaver.hpp +++ b/include/openpose/filestream/wHeatMapSaver.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -75,7 +75,7 @@ namespace op Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wImageSaver.hpp b/include/openpose/filestream/wImageSaver.hpp index 9d96c918..66a42899 100644 --- a/include/openpose/filestream/wImageSaver.hpp +++ b/include/openpose/filestream/wImageSaver.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -74,7 +74,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wPeopleJsonSaver.hpp b/include/openpose/filestream/wPeopleJsonSaver.hpp index 8bf99110..b17741b8 100644 --- a/include/openpose/filestream/wPeopleJsonSaver.hpp +++ b/include/openpose/filestream/wPeopleJsonSaver.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Save body/face/hand keypoints to JSON file @@ -97,7 +97,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wPoseSaver.hpp b/include/openpose/filestream/wPoseSaver.hpp index 0edf6ef0..efeeaeb7 100644 --- a/include/openpose/filestream/wPoseSaver.hpp +++ b/include/openpose/filestream/wPoseSaver.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -75,7 +75,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wUdpSender.hpp b/include/openpose/filestream/wUdpSender.hpp index 14f0ba71..5f88c152 100644 --- a/include/openpose/filestream/wUdpSender.hpp +++ b/include/openpose/filestream/wUdpSender.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Send though UDP communication @@ -87,7 +87,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wVideoSaver.hpp b/include/openpose/filestream/wVideoSaver.hpp index fe176324..d8a43098 100644 --- a/include/openpose/filestream/wVideoSaver.hpp +++ b/include/openpose/filestream/wVideoSaver.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -72,7 +72,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/filestream/wVideoSaver3D.hpp b/include/openpose/filestream/wVideoSaver3D.hpp index 1881e8da..58d32634 100644 --- a/include/openpose/filestream/wVideoSaver3D.hpp +++ b/include/openpose/filestream/wVideoSaver3D.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // T* to T @@ -70,7 +70,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/flags.hpp b/include/openpose/flags.hpp index 54f071f8..fdc83378 100644 --- a/include/openpose/flags.hpp +++ b/include/openpose/flags.hpp @@ -16,9 +16,9 @@ // Note: This command will show you flags for other unnecessary 3rdparty files. Check only the flags for the OpenPose // executable. E.g., for `openpose.bin`, look for `Flags from examples/openpose/openpose.cpp:`. // Debugging/Other -DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while" - " 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for" - " low priority messages and 4 for important ones."); +DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any opLog() message," + " while 255 will not output any. Current OpenPose library messages are in the range 0-4:" + " 1 for low priority messages and 4 for important ones."); DEFINE_bool(disable_multi_thread, false, "It would slightly reduce the frame rate in order to highly reduce the lag. Mainly useful" " for 1) Cases where it is needed a low latency (e.g., webcam in real-time scenarios with" " low-range GPU devices); and 2) Debugging OpenPose when it is crashing to locate the" diff --git a/include/openpose/gui/wGui.hpp b/include/openpose/gui/wGui.hpp index feb9fe21..7c847cc7 100644 --- a/include/openpose/gui/wGui.hpp +++ b/include/openpose/gui/wGui.hpp @@ -67,7 +67,7 @@ namespace op if (tDatums != nullptr) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Update cvMat @@ -87,7 +87,7 @@ namespace op Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); } // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/gui/wGui3D.hpp b/include/openpose/gui/wGui3D.hpp index 83dd6335..654579ae 100644 --- a/include/openpose/gui/wGui3D.hpp +++ b/include/openpose/gui/wGui3D.hpp @@ -68,7 +68,7 @@ namespace op if (tDatums != nullptr) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Update cvMat & keypoints @@ -100,7 +100,7 @@ namespace op Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); } // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/gui/wGuiAdam.hpp b/include/openpose/gui/wGuiAdam.hpp index ab60537f..50757994 100644 --- a/include/openpose/gui/wGuiAdam.hpp +++ b/include/openpose/gui/wGuiAdam.hpp @@ -68,7 +68,7 @@ namespace op if (tDatums != nullptr) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Update cvMat & keypoints @@ -97,7 +97,7 @@ namespace op Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); } // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/gui/wGuiInfoAdder.hpp b/include/openpose/gui/wGuiInfoAdder.hpp index 7d58c8e3..f23e25e9 100644 --- a/include/openpose/gui/wGuiInfoAdder.hpp +++ b/include/openpose/gui/wGuiInfoAdder.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Add GUI components to frame @@ -72,7 +72,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandDetector.hpp b/include/openpose/hand/wHandDetector.hpp index 5000e7d1..8b6facb8 100644 --- a/include/openpose/hand/wHandDetector.hpp +++ b/include/openpose/hand/wHandDetector.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people hand @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandDetectorFromTxt.hpp b/include/openpose/hand/wHandDetectorFromTxt.hpp index fa6819ea..c77c7b8f 100644 --- a/include/openpose/hand/wHandDetectorFromTxt.hpp +++ b/include/openpose/hand/wHandDetectorFromTxt.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people hand @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandDetectorTracking.hpp b/include/openpose/hand/wHandDetectorTracking.hpp index d2a8ec61..8272f269 100644 --- a/include/openpose/hand/wHandDetectorTracking.hpp +++ b/include/openpose/hand/wHandDetectorTracking.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people hand @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandDetectorUpdate.hpp b/include/openpose/hand/wHandDetectorUpdate.hpp index 5c1ee00d..510733e3 100644 --- a/include/openpose/hand/wHandDetectorUpdate.hpp +++ b/include/openpose/hand/wHandDetectorUpdate.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Detect people hand @@ -68,7 +68,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandExtractorNet.hpp b/include/openpose/hand/wHandExtractorNet.hpp index 04350d64..e29bcb4a 100644 --- a/include/openpose/hand/wHandExtractorNet.hpp +++ b/include/openpose/hand/wHandExtractorNet.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Extract people hands @@ -76,7 +76,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/hand/wHandRenderer.hpp b/include/openpose/hand/wHandRenderer.hpp index 7e44dc5b..b9aebd91 100644 --- a/include/openpose/hand/wHandRenderer.hpp +++ b/include/openpose/hand/wHandRenderer.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people hands @@ -70,7 +70,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/pose/wPoseExtractor.hpp b/include/openpose/pose/wPoseExtractor.hpp index 6da487e7..0b1980a6 100644 --- a/include/openpose/pose/wPoseExtractor.hpp +++ b/include/openpose/pose/wPoseExtractor.hpp @@ -66,7 +66,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Extract people pose @@ -97,7 +97,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/pose/wPoseExtractorNet.hpp b/include/openpose/pose/wPoseExtractorNet.hpp index 14662fde..86830089 100644 --- a/include/openpose/pose/wPoseExtractorNet.hpp +++ b/include/openpose/pose/wPoseExtractorNet.hpp @@ -66,7 +66,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Extract people pose @@ -85,7 +85,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/pose/wPoseRenderer.hpp b/include/openpose/pose/wPoseRenderer.hpp index 18aaf490..c706b416 100644 --- a/include/openpose/pose/wPoseRenderer.hpp +++ b/include/openpose/pose/wPoseRenderer.hpp @@ -66,7 +66,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people pose @@ -78,7 +78,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/producer/wDatumProducer.hpp b/include/openpose/producer/wDatumProducer.hpp index f16871aa..d362c237 100644 --- a/include/openpose/producer/wDatumProducer.hpp +++ b/include/openpose/producer/wDatumProducer.hpp @@ -61,7 +61,7 @@ namespace op try { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Create and fill final shared pointer @@ -78,7 +78,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } // Equivalent to WQueueSplitter // Queued elements - Multiple views --> Split views into different share pointers diff --git a/include/openpose/thread/queueBase.hpp b/include/openpose/thread/queueBase.hpp index 50257185..70be9460 100644 --- a/include/openpose/thread/queueBase.hpp +++ b/include/openpose/thread/queueBase.hpp @@ -110,9 +110,9 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); stop(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -302,7 +302,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const std::lock_guard lock{mMutex}; mPopIsStopped = {true}; mPushIsStopped = {true}; @@ -321,7 +321,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const std::lock_guard lock{mMutex}; mPushers--; if (mPushers == 0) @@ -343,7 +343,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const std::lock_guard lock{mMutex}; mPoppers++; updateMaxPoppersPushers(); @@ -359,7 +359,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const std::lock_guard lock{mMutex}; mPushers++; updateMaxPoppersPushers(); diff --git a/include/openpose/thread/thread.hpp b/include/openpose/thread/thread.hpp index 7bbbd7e3..64a314be 100644 --- a/include/openpose/thread/thread.hpp +++ b/include/openpose/thread/thread.hpp @@ -90,9 +90,9 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); stopAndJoin(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -134,7 +134,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); stopAndJoin(); *spIsRunning = {true}; mThread = {std::thread{&Thread::threadFunction, this}}; @@ -164,7 +164,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); for (auto& subThread : mSubThreads) subThread->initializationOnThread(); } @@ -179,10 +179,10 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); initializationOnThread(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); while (isRunning()) { bool allSubThreadsClosed = true; @@ -191,12 +191,12 @@ namespace op if (allSubThreadsClosed) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); stop(); break; } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/include/openpose/thread/threadManager.hpp b/include/openpose/thread/threadManager.hpp index 68e3cb0b..d8e078d2 100644 --- a/include/openpose/thread/threadManager.hpp +++ b/include/openpose/thread/threadManager.hpp @@ -182,12 +182,12 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Set threads multisetToThreads(); if (!mThreads.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Start threads for (auto i = 0u; i < mThreads.size() - 1; i++) mThreads.at(i)->startInThread(); @@ -195,7 +195,7 @@ namespace op // Stop threads - It will arrive here when the exec() command has finished stop(); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -208,13 +208,13 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Set threads multisetToThreads(); // Start threads for (auto& thread : mThreads) thread->startInThread(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -227,16 +227,16 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); for (auto& tQueue : mTQueues) tQueue->stop(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); *spIsRunning = false; for (auto& thread : mThreads) thread->stopAndJoin(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); checkWorkerErrors(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/include/openpose/thread/wFpsMax.hpp b/include/openpose/thread/wFpsMax.hpp index a00dd6de..41451c2f 100644 --- a/include/openpose/thread/wFpsMax.hpp +++ b/include/openpose/thread/wFpsMax.hpp @@ -56,7 +56,7 @@ namespace op try { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // tDatums not used --> Avoid warning @@ -67,7 +67,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/include/openpose/thread/wIdGenerator.hpp b/include/openpose/thread/wIdGenerator.hpp index 63bba2bc..65d78963 100644 --- a/include/openpose/thread/wIdGenerator.hpp +++ b/include/openpose/thread/wIdGenerator.hpp @@ -59,7 +59,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Add ID @@ -75,7 +75,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/thread/wQueueAssembler.hpp b/include/openpose/thread/wQueueAssembler.hpp index cf28d86f..e0f3f9fe 100644 --- a/include/openpose/thread/wQueueAssembler.hpp +++ b/include/openpose/thread/wQueueAssembler.hpp @@ -88,7 +88,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } // Non-last view - Return nothing else diff --git a/include/openpose/thread/wQueueOrderer.hpp b/include/openpose/thread/wQueueOrderer.hpp index cb002d57..115d795e 100644 --- a/include/openpose/thread/wQueueOrderer.hpp +++ b/include/openpose/thread/wQueueOrderer.hpp @@ -144,7 +144,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/tracking/wPersonIdExtractor.hpp b/include/openpose/tracking/wPersonIdExtractor.hpp index 2079e2f7..8f97b272 100644 --- a/include/openpose/tracking/wPersonIdExtractor.hpp +++ b/include/openpose/tracking/wPersonIdExtractor.hpp @@ -58,7 +58,7 @@ namespace op if (checkNoNullNorEmpty(tDatums)) { // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Profiling speed const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__); // Render people pose @@ -69,7 +69,7 @@ namespace op Profiler::timerEnd(profilerKey); Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__); // Debugging log - dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLogIfDebug("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/include/openpose/utilities/check.hpp b/include/openpose/utilities/check.hpp index 74a0e3b0..5d773263 100644 --- a/include/openpose/utilities/check.hpp +++ b/include/openpose/utilities/check.hpp @@ -7,16 +7,18 @@ namespace op { // CHECK, CHECK_EQ, CHECK_NE, CHECK_LE, CHECK_LT, CHECK_GE, and CHECK_GT template - void check(const bool condition, const T& message = "", const int line = -1, const std::string& function = "", - const std::string& file = "") + void checkBool( + const bool condition, const T& message = "", const int line = -1, const std::string& function = "", + const std::string& file = "") { if (!condition) error("Check failed: " + tToString(message), line, function, file); } template - void checkE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA != conditionB) error("CheckE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " @@ -24,8 +26,9 @@ namespace op } template - void checkNE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkNotEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA == conditionB) error("CheckNE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " @@ -33,8 +36,9 @@ namespace op } template - void checkLE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkLessOrEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA > conditionB) error("CheckLE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " @@ -42,8 +46,9 @@ namespace op } template - void checkLT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkLessThan( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA >= conditionB) error("CheckLT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " @@ -51,8 +56,9 @@ namespace op } template - void checkGE(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkGreaterOrEqual( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA < conditionB) error("CheckGE failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " @@ -60,8 +66,9 @@ namespace op } template - void checkGT(const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, - const std::string& function = "", const std::string& file = "") + void checkGreaterThan( + const T1& conditionA, const T2& conditionB, const T& message = "", const int line = -1, + const std::string& function = "", const std::string& file = "") { if (conditionA <= conditionB) error("CheckGT failed (" + tToString(conditionA) + " vs. " + tToString(conditionB) + "): " diff --git a/include/openpose/utilities/errorAndLog.hpp b/include/openpose/utilities/errorAndLog.hpp index cd07b2db..5be8a9db 100644 --- a/include/openpose/utilities/errorAndLog.hpp +++ b/include/openpose/utilities/errorAndLog.hpp @@ -77,29 +77,29 @@ namespace op // Printing info - How to use: // It will print info if desiredPriority >= sPriorityThreshold - // log(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); - OP_API void log( + // opLog(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); + OP_API void opLog( const std::string& message, const Priority priority = Priority::Max, const int line = -1, const std::string& function = "", const std::string& file = ""); template - inline void log( + inline void opLog( const T& message, const Priority priority = Priority::Max, const int line = -1, const std::string& function = "", const std::string& file = "") { - log(tToString(message), priority, line, function, file); + opLog(tToString(message), priority, line, function, file); } // If only desired on debug mode (no computational cost at all on release mode): // It will print info if desiredPriority >= sPriorityThreshold - // dLog(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); + // opLogIfDebug(message, desiredPriority, __LINE__, __FUNCTION__, __FILE__); template - inline void dLog( + inline void opLogIfDebug( const T& message, const Priority priority = Priority::Max, const int line = -1, const std::string& function = "", const std::string& file = "") { #ifndef NDEBUG - log(message, priority, line, function, file); + opLog(message, priority, line, function, file); #else UNUSED(message); UNUSED(priority); diff --git a/include/openpose/utilities/profiler.hpp b/include/openpose/utilities/profiler.hpp index 4818f733..7220137a 100644 --- a/include/openpose/utilities/profiler.hpp +++ b/include/openpose/utilities/profiler.hpp @@ -27,7 +27,7 @@ namespace op // OP_PROFILE_INIT(REPS); // // [Some code in here] // OP_PROFILE_END(time, 1e3, REPS); // Time in msec. 1 = sec, 1e3 = msec, 1e6 = usec, 1e9 = nsec, etc. - // log("Function X took " + std::to_string(time) + " milliseconds."); + // opLog("Function X took " + std::to_string(time) + " milliseconds."); #define OP_PROFILE_INIT(REPS) \ { \ const auto timerInit = getTimerInit(); \ @@ -45,7 +45,7 @@ namespace op // OP_CUDA_PROFILE_INIT(REPS); // // [Some code with CUDA calls in here] // OP_CUDA_PROFILE_END(time, 1e3, REPS); // Time in msec. 1 = sec, 1e3 = msec, 1e6 = usec, 1e9 = nsec, etc. - // log("Function X took " + std::to_string(time) + " milliseconds."); + // opLog("Function X took " + std::to_string(time) + " milliseconds."); // Analogous to OP_PROFILE_INIT, but also waits for CUDA kernels to finish their asynchronous operations // It requires: #include #define OP_CUDA_PROFILE_INIT(REPS) \ diff --git a/include/openpose/wrapper/wrapper.hpp b/include/openpose/wrapper/wrapper.hpp index b3c6e41b..44636d62 100644 --- a/include/openpose/wrapper/wrapper.hpp +++ b/include/openpose/wrapper/wrapper.hpp @@ -416,7 +416,7 @@ namespace op mThreadManager, mMultiThreadEnabled, mThreadManagerMode, mWrapperStructPose, mWrapperStructFace, mWrapperStructHand, mWrapperStructExtra, mWrapperStructInput, mWrapperStructOutput, mWrapperStructGui, mUserWs, mUserWsOnNewThread); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); mThreadManager.exec(); } catch (const std::exception& e) @@ -434,7 +434,7 @@ namespace op mThreadManager, mMultiThreadEnabled, mThreadManagerMode, mWrapperStructPose, mWrapperStructFace, mWrapperStructHand, mWrapperStructExtra, mWrapperStructInput, mWrapperStructOutput, mWrapperStructGui, mUserWs, mUserWsOnNewThread); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); mThreadManager.start(); } catch (const std::exception& e) diff --git a/include/openpose/wrapper/wrapperAuxiliary.hpp b/include/openpose/wrapper/wrapperAuxiliary.hpp index a6e3ddc4..39547438 100644 --- a/include/openpose/wrapper/wrapperAuxiliary.hpp +++ b/include/openpose/wrapper/wrapperAuxiliary.hpp @@ -95,7 +95,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Create producer auto producerSharedPtr = createProducer( @@ -182,7 +182,7 @@ namespace op numberGpuThreads = totalGpuNumber - gpuNumberStart; // Reset initial GPU to 0 (we want them all) // Logging message - log("Auto-detecting all available GPUs... Detected " + std::to_string(totalGpuNumber) + opLog("Auto-detecting all available GPUs... Detected " + std::to_string(totalGpuNumber) + " GPU(s), using " + std::to_string(numberGpuThreads) + " of them starting at GPU " + std::to_string(gpuNumberStart) + ".", Priority::High); } @@ -334,7 +334,7 @@ namespace op cpuRenderers.emplace_back(std::make_shared>(poseCpuRenderer)); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Pose extractor(s) poseExtractorsWs.resize(poseExtractorNets.size()); @@ -399,12 +399,12 @@ namespace op // wPose.emplace_back(std::make_shared>(keepTopNPeople)); // } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Pose renderer(s) if (!poseGpuRenderers.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); for (auto i = 0u; i < poseExtractorsWs.size(); i++) { poseExtractorsWs.at(i).emplace_back(std::make_shared>( @@ -415,12 +415,12 @@ namespace op cvMatToOpOutputs.at(i)->getSharedParameters()); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Face extractor(s) if (wrapperStructFace.enable) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Face detector // OpenPose body-based face detector if (wrapperStructFace.detector == Detector::Body) @@ -438,7 +438,7 @@ namespace op // OpenCV face detector else if (wrapperStructFace.detector == Detector::OpenCV) { - log("Body keypoint detection is disabled. Hence, using OpenCV face detector (much less" + opLog("Body keypoint detection is disabled. Hence, using OpenCV face detector (much less" " accurate but faster).", Priority::High); for (auto& wPose : poseExtractorsWs) { @@ -469,12 +469,12 @@ namespace op std::make_shared>(faceExtractorNet)); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Hand extractor(s) if (wrapperStructHand.enable) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto handDetector = std::make_shared(wrapperStructPose.poseModel); for (auto gpu = 0u; gpu < poseExtractorsWs.size(); gpu++) { @@ -521,12 +521,12 @@ namespace op std::make_shared>(handDetector)); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Face renderer(s) if (renderFace) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // CPU rendering if (renderModeFace == RenderMode::Cpu) { @@ -565,12 +565,12 @@ namespace op else error("Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Hand renderer(s) if (renderHand) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // CPU rendering if (renderModeHand == RenderMode::Cpu) { @@ -609,7 +609,7 @@ namespace op else error("Unknown RenderMode.", __LINE__, __FUNCTION__, __FILE__); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Frames processor (OpenPose format -> cv::Mat format) if (addCvMatToOpOutput && !addCvMatToOpOutputInCpu) @@ -626,13 +626,13 @@ namespace op cvMatToOpOutputs.at(i)->getSharedParameters()); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // 3-D reconstruction poseTriangulationsWs.clear(); if (wrapperStructExtra.reconstruct3d) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // For all (body/face/hands): PoseTriangulations ~30 msec, 8 GPUS ~30 msec for keypoint estimation poseTriangulationsWs.resize(fastMax(1, int(poseExtractorsWs.size() / 4))); for (auto i = 0u ; i < poseTriangulationsWs.size() ; i++) @@ -643,7 +643,7 @@ namespace op poseTriangulation)}; } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Itermediate workers (e.g., OpenPose format to cv::Mat, json & frames recorder, ...) postProcessingWs.clear(); // // Person ID identification (when no multi-thread and no dependency on tracking) @@ -657,12 +657,12 @@ namespace op // Frames processor (OpenPose format -> cv::Mat format) if (addCvMatToOpOutputInCpu) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); postProcessingWs = mergeVectors(postProcessingWs, cpuRenderers); const auto opOutputToCvMat = std::make_shared(); postProcessingWs.emplace_back(std::make_shared>(opOutputToCvMat)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Re-scale pose if desired // If desired scale is not the current input if (wrapperStructPose.keypointScaleMode != ScaleMode::InputResolution @@ -678,7 +678,7 @@ namespace op postProcessingWs.emplace_back(std::make_shared>(keypointScaler)); } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // IK/Adam const auto displayAdam = wrapperStructGui.displayMode == DisplayMode::DisplayAdam @@ -688,7 +688,7 @@ namespace op #ifdef USE_3D_ADAM_MODEL if (wrapperStructExtra.ikThreads > 0) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); jointAngleEstimationsWs.resize(wrapperStructExtra.ikThreads); // Pose extractor(s) for (auto i = 0u; i < jointAngleEstimationsWs.size(); i++) @@ -698,7 +698,7 @@ namespace op jointAngleEstimation)}; } } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif // Output workers @@ -706,28 +706,28 @@ namespace op // Print verbose if (wrapperStructOutput.verbose > 0.) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto verbosePrinter = std::make_shared( wrapperStructOutput.verbose, uLongLongRound(producerSharedPtr->get(getCvCapPropFrameCount()))); outputWs.emplace_back(std::make_shared>(verbosePrinter)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Send information (e.g., to Unity) though UDP client-server communication #ifdef USE_3D_ADAM_MODEL if (!wrapperStructOutput.udpHost.empty() && !wrapperStructOutput.udpPort.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto udpSender = std::make_shared(wrapperStructOutput.udpHost, wrapperStructOutput.udpPort); outputWs.emplace_back(std::make_shared>(udpSender)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif // Write people pose data on disk (json for OpenCV >= 3, xml, yml...) if (!writeKeypointCleaned.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto keypointSaver = std::make_shared(writeKeypointCleaned, wrapperStructOutput.writeKeypointFormat); outputWs.emplace_back(std::make_shared>(keypointSaver)); @@ -736,20 +736,20 @@ namespace op if (wrapperStructHand.enable) outputWs.emplace_back(std::make_shared>(keypointSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write OpenPose output data on disk in JSON format (body/hand/face keypoints, body part locations if // enabled, etc.) if (!writeJsonCleaned.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto peopleJsonSaver = std::make_shared(writeJsonCleaned); outputWs.emplace_back(std::make_shared>(peopleJsonSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write people pose/foot/face/hand/etc. data on disk (COCO validation JSON format) if (!wrapperStructOutput.writeCocoJson.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // If humanFormat: bigger size (& maybe slower to process), but easier for user to read it const auto humanFormat = true; const auto cocoJsonSaver = std::make_shared( @@ -761,22 +761,22 @@ namespace op wrapperStructOutput.writeCocoJsonVariant); outputWs.emplace_back(std::make_shared>(cocoJsonSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write frames as desired image format on hard disk if (!writeImagesCleaned.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto imageSaver = std::make_shared(writeImagesCleaned, wrapperStructOutput.writeImagesFormat); outputWs.emplace_back(std::make_shared>(imageSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); auto originalVideoFps = 0.; if (!wrapperStructOutput.writeVideo.empty() || !wrapperStructOutput.writeVideo3D.empty() || !wrapperStructOutput.writeBvh.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (wrapperStructOutput.writeVideoFps <= 0 && (!oPProducer || producerSharedPtr->get(getCvCapPropFrameFps()) <= 0)) error("The frame rate of the frames producer is unknown. Set `--write_video_fps` to your desired" @@ -788,11 +788,11 @@ namespace op wrapperStructOutput.writeVideoFps > 0 ? wrapperStructOutput.writeVideoFps : producerSharedPtr->get(getCvCapPropFrameFps())); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write frames as *.avi video on hard disk if (!wrapperStructOutput.writeVideo.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Sanity checks if (!oPProducer) error("Video file can only be recorded inside `wrapper/wrapper.hpp` if the producer" @@ -808,28 +808,28 @@ namespace op (wrapperStructOutput.writeVideoWithAudio ? wrapperStructInput.producerString : "")); outputWs.emplace_back(std::make_shared>(videoSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Write joint angles as *.bvh file on hard disk #ifdef USE_3D_ADAM_MODEL if (!wrapperStructOutput.writeBvh.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto bvhSaver = std::make_shared( wrapperStructOutput.writeBvh, JointAngleEstimation::getTotalModel(), originalVideoFps ); outputWs.emplace_back(std::make_shared>(bvhSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif // Write heat maps as desired image format on hard disk if (!writeHeatMapsCleaned.empty()) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto heatMapSaver = std::make_shared( writeHeatMapsCleaned, wrapperStructOutput.writeHeatMapsFormat); outputWs.emplace_back(std::make_shared>(heatMapSaver)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Add frame information for GUI const bool guiEnabled = (wrapperStructGui.displayMode != DisplayMode::NoDisplay); // If this WGuiInfoAdder instance is placed before the WImageSaver or WVideoSaver, then the resulting @@ -838,17 +838,17 @@ namespace op || threadManagerMode == ThreadManagerMode::Asynchronous || threadManagerMode == ThreadManagerMode::AsynchronousOut)) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto guiInfoAdder = std::make_shared(numberGpuThreads, guiEnabled); outputWs.emplace_back(std::make_shared>(guiInfoAdder)); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Minimal graphical user interface (GUI) TWorker guiW; TWorker videoSaver3DW; if (guiEnabled) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // PoseRenderers to Renderers std::vector> renderers; if (renderModePose == RenderMode::Cpu) @@ -866,7 +866,7 @@ namespace op if (displayAdam) { #ifdef USE_3D_ADAM_MODEL - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Gui const auto gui = std::make_shared( finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), @@ -886,7 +886,7 @@ namespace op else if (wrapperStructGui.displayMode == DisplayMode::Display3D || wrapperStructGui.displayMode == DisplayMode::DisplayAll) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Gui const auto gui = std::make_shared( finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), @@ -907,7 +907,7 @@ namespace op // 2-D display else if (wrapperStructGui.displayMode == DisplayMode::Display2D) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Gui const auto gui = std::make_shared( finalOutputSizeGui, wrapperStructGui.fullScreen, threadManager.getIsRunningSharedPtr(), @@ -923,13 +923,13 @@ namespace op else error("Unknown DisplayMode.", __LINE__, __FUNCTION__, __FILE__); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Set FpsMax TWorker wFpsMax; if (wrapperStructPose.fpsMax > 0.) wFpsMax = std::make_shared>(wrapperStructPose.fpsMax); // Set wrapper as configured - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); @@ -970,7 +970,7 @@ namespace op { // If custom user Worker in its own thread if (userPreProcessingWsOnNewThread) - log("You chose to add your pre-processing function in a new thread. However, OpenPose will" + opLog("You chose to add your pre-processing function in a new thread. However, OpenPose will" " add it in the same thread than the input frame producer.", Priority::High, __LINE__, __FUNCTION__, __FILE__); workersAux = mergeVectors(workersAux, {userPreProcessingWs}); @@ -990,7 +990,7 @@ namespace op if (!userInputWs.empty() && userInputWsOnNewThread) { // Thread 0, queues 0 -> 1 - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, userInputWs, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1005,7 +1005,7 @@ namespace op && threadManagerMode != ThreadManagerMode::AsynchronousIn) error("No input selected.", __LINE__, __FUNCTION__, __FILE__); // Thread 0 or 1, queues 0 -> 1 - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, workersAux, queueIn++, queueOut++); // Increase thread threadIdPP(threadId, multiThreadEnabled); @@ -1018,7 +1018,7 @@ namespace op { for (auto& wPose : poseExtractorsWs) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wPose, queueIn, queueOut); threadIdPP(threadId, multiThreadEnabled); } @@ -1028,7 +1028,7 @@ namespace op if (poseExtractorsWs.size() > 1u) { const auto wQueueOrderer = std::make_shared>(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1036,10 +1036,10 @@ namespace op else { if (poseExtractorsWs.size() > 1) - log("Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the" + opLog("Multi-threading disabled, only 1 thread running. All GPUs have been disabled but the" " first one, which is defined by gpuNumberStart (e.g., in the OpenPose demo, it is set" " with the `--num_gpu_start` flag).", Priority::High); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, poseExtractorsWs.at(0), queueIn++, queueOut++); } } @@ -1049,7 +1049,7 @@ namespace op if (!poseTriangulationsWs.empty()) { // Assemble frames - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wQueueAssembler, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); // 3-D reconstruction @@ -1057,7 +1057,7 @@ namespace op { for (auto& wPoseTriangulations : poseTriangulationsWs) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wPoseTriangulations, queueIn, queueOut); threadIdPP(threadId, multiThreadEnabled); } @@ -1067,7 +1067,7 @@ namespace op if (poseTriangulationsWs.size() > 1u) { const auto wQueueOrderer = std::make_shared>(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1075,9 +1075,9 @@ namespace op else { if (poseTriangulationsWs.size() > 1) - log("Multi-threading disabled, only 1 thread running for 3-D triangulation.", + opLog("Multi-threading disabled, only 1 thread running for 3-D triangulation.", Priority::High); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, poseTriangulationsWs.at(0), queueIn++, queueOut++); } } @@ -1090,7 +1090,7 @@ namespace op { for (auto& wJointAngleEstimator : jointAngleEstimationsWs) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wJointAngleEstimator, queueIn, queueOut); threadIdPP(threadId, multiThreadEnabled); } @@ -1100,7 +1100,7 @@ namespace op if (jointAngleEstimationsWs.size() > 1) { const auto wQueueOrderer = std::make_shared>(); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wQueueOrderer, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1108,9 +1108,9 @@ namespace op else { if (jointAngleEstimationsWs.size() > 1) - log("Multi-threading disabled, only 1 thread running for joint angle estimation.", + opLog("Multi-threading disabled, only 1 thread running for joint angle estimation.", Priority::High); - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, jointAngleEstimationsWs.at(0), queueIn++, queueOut++); } } @@ -1120,7 +1120,7 @@ namespace op // Combining postProcessingWs and outputWs outputWs = mergeVectors(postProcessingWs, outputWs); // // If I wanna split them - // log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + // opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // threadManager.add(threadId, postProcessingWs, queueIn++, queueOut++); // threadIdPP(threadId, multiThreadEnabled); } @@ -1130,7 +1130,7 @@ namespace op // If custom user Worker in its own thread if (userPostProcessingWsOnNewThread) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, userPostProcessingWs, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1143,7 +1143,7 @@ namespace op if (!outputWs.empty()) { // Thread 4 or 5, queues 4 -> 5 - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, outputWs, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } @@ -1153,13 +1153,13 @@ namespace op { if (userOutputWsOnNewThread) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, userOutputWs, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } else { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId-1, userOutputWs, queueIn++, queueOut++); } } @@ -1167,18 +1167,18 @@ namespace op if (guiW != nullptr) { // Thread Y+1, queues Q+1 -> Q+2 - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, guiW, queueIn++, queueOut++); // Saving 3D output if (videoSaver3DW != nullptr) threadManager.add(threadId, videoSaver3DW, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Setting maximum speed if (wFpsMax != nullptr) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); threadManager.add(threadId, wFpsMax, queueIn++, queueOut++); threadIdPP(threadId, multiThreadEnabled); } diff --git a/src/openpose/3d/cameraParameterReader.cpp b/src/openpose/3d/cameraParameterReader.cpp index 183c97fc..3a9c795e 100644 --- a/src/openpose/3d/cameraParameterReader.cpp +++ b/src/openpose/3d/cameraParameterReader.cpp @@ -109,7 +109,7 @@ namespace op spImpl->mCameraIntrinsics.clear(); spImpl->mCameraExtrinsics.clear(); spImpl->mCameraExtrinsicsInitial.clear(); - // log("Camera matrices:"); + // opLog("Camera matrices:"); for (auto i = 0ull ; i < spImpl->mSerialNumbers.size() ; i++) { const auto parameterPath = cameraParameterPath + spImpl->mSerialNumbers.at(i); @@ -148,23 +148,23 @@ namespace op const cv::Mat cvCameraMatrices = OP_OP2CVCONSTMAT(spImpl->mCameraIntrinsics.back()) * OP_OP2CVCONSTMAT(spImpl->mCameraExtrinsics.back()); const Matrix opCameraMatrices = OP_CV2OPCONSTMAT(cvCameraMatrices); spImpl->mCameraMatrices.emplace_back(opCameraMatrices); - // log(cameraParameters.at(0)); + // opLog(cameraParameters.at(0)); } // Undistortion Mats spImpl->mRemoveDistortionMaps1.resize(getNumberCameras()); spImpl->mRemoveDistortionMaps2.resize(getNumberCameras()); // // spImpl->mCameraMatrices - // log("\nFull camera matrices:"); + // opLog("\nFull camera matrices:"); // for (const auto& cvMat : spImpl->mCameraMatrices) - // log(cvMat); + // opLog(cvMat); // // spImpl->mCameraIntrinsics - // log("\nCamera intrinsic parameters:"); + // opLog("\nCamera intrinsic parameters:"); // for (const auto& cvMat : spImpl->mCameraIntrinsics) - // log(cvMat); + // opLog(cvMat); // // spImpl->mCameraDistortions - // log("\nCamera distortion parameters:"); + // opLog("\nCamera distortion parameters:"); // for (const auto& cvMat : spImpl->mCameraDistortions) - // log(cvMat); + // opLog(cvMat); } catch (const std::exception& e) { @@ -360,7 +360,7 @@ namespace op // // http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistort // cv::undistort(cvMatDistorted, mCvMats[i], cvCameraIntrinsics, cvCameraDistorsions); // // In OpenCV 2.4, cv::undistort is exactly equal than cv::initUndistortRectifyMap - // (with CV_16SC2) + cv::remap (with LINEAR). I.e., log(cv::norm(cvMatMethod1-cvMatMethod2)) = 0. + // (with CV_16SC2) + cv::remap (with LINEAR). I.e., opLog(cv::norm(cvMatMethod1-cvMatMethod2)) = 0. // Option b - 15 ms / 3 images (LINEAR) or 25 ms (CUBIC) // Distorsion removal - not required and more expensive (applied to the whole image instead of // only to our interest points) diff --git a/src/openpose/3d/poseTriangulation.cpp b/src/openpose/3d/poseTriangulation.cpp index 2de3ae19..92a26478 100644 --- a/src/openpose/3d/poseTriangulation.cpp +++ b/src/openpose/3d/poseTriangulation.cpp @@ -141,14 +141,14 @@ namespace op } // Warning if (reprojectionErrorTotal > 60) - log("Unusual high re-projection error (averaged over #keypoints) of value " + opLog("Unusual high re-projection error (averaged over #keypoints) of value " + std::to_string(reprojectionErrorTotal) + " pixels, while the average for a good OpenPose" " detection from 4 cameras is about 2-3 pixels. It might be simply a wrong OpenPose" " detection. However, if this message appears very frequently, your calibration parameters" " might be wrong. Note: If you have introduced your own camera intrinsics, are they an" " upper triangular matrix (as specified in the OpenPose doc/modules/calibration_module.md" " and 3d_reconstruction_module.md)?", Priority::High); - // log("Reprojection error: " + std::to_string(reprojectionErrorTotal)); // To debug reprojection error + // opLog("Reprojection error: " + std::to_string(reprojectionErrorTotal)); // To debug reprojection error return atLeastOnePointProjected; } return false; @@ -251,7 +251,7 @@ namespace op // thread.join(); // Warning if (!keypointsReconstructed) - log("No keypoints were reconstructed on this frame. It might be simply a challenging frame." + opLog("No keypoints were reconstructed on this frame. It might be simply a challenging frame." " However, if this message appears frequently, OpenPose is facing some unknown issue," " mabe the calibration parameters are not accurate. Feel free to open a GitHub issue" " (remember to fill all the required information detailed in the GitHub issue template" diff --git a/src/openpose/3d/poseTriangulationPrivate.cpp b/src/openpose/3d/poseTriangulationPrivate.cpp index 143be38c..317efee4 100644 --- a/src/openpose/3d/poseTriangulationPrivate.cpp +++ b/src/openpose/3d/poseTriangulationPrivate.cpp @@ -20,7 +20,7 @@ namespace op imageX /= imageX.at(2,0); const auto error = std::sqrt(std::pow(imageX.at(0,0) - pointsOnEachCamera[i].x,2) + std::pow(imageX.at(1,0) - pointsOnEachCamera[i].y,2)); - // log("Error: " + std::to_string(error)); + // opLog("Error: " + std::to_string(error)); averageError += error; } return averageError / cameraMatrices.size(); @@ -102,7 +102,7 @@ namespace op residuals[0] = std::sqrt(std::pow(predicted[0] / predicted[2] - observed_x,2) + std::pow(predicted[1] / predicted[2] - observed_y,2)); - // log("Residuals:"); + // opLog("Residuals:"); // residuals[0]= pow(predicted[0] - (observed_x),2); // residuals[1]= pow(predicted[1] - (observed_y),2); diff --git a/src/openpose/calibration/cameraParameterEstimation.cpp b/src/openpose/calibration/cameraParameterEstimation.cpp index 2cdbdf71..46b7bbdc 100644 --- a/src/openpose/calibration/cameraParameterEstimation.cpp +++ b/src/openpose/calibration/cameraParameterEstimation.cpp @@ -151,7 +151,7 @@ namespace op { try { - log("\nCalibrating camera (intrinsics) with points from " + std::to_string(points2DVectors.size()) + opLog("\nCalibrating camera (intrinsics) with points from " + std::to_string(points2DVectors.size()) + " images...", Priority::High); //Find intrinsic and extrinsic camera parameters @@ -173,14 +173,14 @@ namespace op std::tie(totalAvgErr, reprojectionErrors) = calcReprojectionErrors( objects3DVectors, points2DVectors, rVecs, tVecs, intrinsics); - log("\nIntrinsics:", Priority::High); - log("Re-projection error - cv::calibrateCamera vs. calcReprojectionErrors:\t" + std::to_string(rms) + opLog("\nIntrinsics:", Priority::High); + opLog("Re-projection error - cv::calibrateCamera vs. calcReprojectionErrors:\t" + std::to_string(rms) + " vs. " + std::to_string(totalAvgErr), Priority::High); - log("Intrinsics_K:", Priority::High); - log(intrinsics.cameraMatrix, Priority::High); - log("Intrinsics_distCoeff:", Priority::High); - log(intrinsics.distortionCoefficients, Priority::High); - log(" ", Priority::High); + opLog("Intrinsics_K:", Priority::High); + opLog(intrinsics.cameraMatrix, Priority::High); + opLog("Intrinsics_distCoeff:", Priority::High); + opLog(intrinsics.distortionCoefficients, Priority::High); + opLog(" ", Priority::High); return intrinsics; } @@ -304,7 +304,7 @@ namespace op if (maxElement - minElement >= PI) { resultIsOK = {false}; - log("There are outliers in the angles.", Priority::High); + opLog("There are outliers in the angles.", Priority::High); } // If the difference between them is <= 180 degrees, then we just return the traditional average. @@ -376,7 +376,7 @@ namespace op { const auto pairAverageAngle = estimateAverageAngle(rotationVectors.at(i)); if (!pairAverageAngle.first) - log("Outlies in the result. Something went wrong when estimating the average of different" + opLog("Outlies in the result. Something went wrong when estimating the average of different" " projection matrices.", Priority::High); rotationVector.at(i,0) = {pairAverageAngle.second}; } @@ -442,7 +442,7 @@ namespace op { try { - // log("Solving 2D-3D correspondences (extrinsics)", Priority::High); + // opLog("Solving 2D-3D correspondences (extrinsics)", Priority::High); cv::Mat rVec(3, 1, cv::DataType::type); cv::Mat tVec(3, 1, cv::DataType::type); @@ -563,7 +563,7 @@ namespace op for (auto i = 0u ; i < cameraPaths.size() ; i++) { if (coutAndPlotGridCorners) - log("getExtrinsicParameters(...), iteration with: " + cameraPaths[i], Priority::High); + opLog("getExtrinsicParameters(...), iteration with: " + cameraPaths[i], Priority::High); // Loading images const cv::Mat image = cv::imread(cameraPaths[i]); if (image.empty()) @@ -639,20 +639,20 @@ namespace op { const Eigen::Vector3d tCam1WrtCam0 = MCam1ToCam0.block<3,1>(0,3) / MCam1ToCam0(3,3); const Eigen::Matrix3d RCam1WrtCam0 = MCam1ToCam0.block<3,3>(0,0); - log("M_gb:", Priority::High); - log(MGridToCam1, Priority::High); - log("M_gf:", Priority::High); - log(MGridToCam0, Priority::High); - log("M_bf:", Priority::High); - log(MCam1ToCam0, Priority::High); + opLog("M_gb:", Priority::High); + opLog(MGridToCam1, Priority::High); + opLog("M_gf:", Priority::High); + opLog(MGridToCam0, Priority::High); + opLog("M_bf:", Priority::High); + opLog(MCam1ToCam0, Priority::High); - log("########## Secondary camera position w.r.t. main camera ##########", Priority::High); - log("tCam1WrtCam0:", Priority::High); - log(tCam1WrtCam0, Priority::High); - log("RCam1WrtCam0:", Priority::High); - log(RCam1WrtCam0, Priority::High); - log("MCam0WrtCam1:", Priority::High); - log((- RCam1WrtCam0.transpose() * tCam1WrtCam0), Priority::High); + opLog("########## Secondary camera position w.r.t. main camera ##########", Priority::High); + opLog("tCam1WrtCam0:", Priority::High); + opLog(tCam1WrtCam0, Priority::High); + opLog("RCam1WrtCam0:", Priority::High); + opLog(RCam1WrtCam0, Priority::High); + opLog("MCam0WrtCam1:", Priority::High); + opLog((- RCam1WrtCam0.transpose() * tCam1WrtCam0), Priority::High); } return MCam1ToCam0; @@ -715,7 +715,7 @@ namespace op } // Couldn't write else - log("Cannot write on " + fileName, Priority::High); + opLog("Cannot write on " + fileName, Priority::High); } std::string getFileNameFromCameraIndex(const int cameraIndex) @@ -762,7 +762,7 @@ namespace op const auto& image = imageAndPath.first; if (viewIndex % std::max(1, int(numberViews/4)) == 0) - log("Camera " + std::to_string(cameraIndex) + " - Image view " + opLog("Camera " + std::to_string(cameraIndex) + " - Image view " + std::to_string(viewIndex+1) + "/" + std::to_string(numberViews), Priority::High); @@ -787,7 +787,7 @@ namespace op { points2DVector.clear(); points2DVector.resize(numberCorners, cv::Point2f{-1.f,-1.f}); - log("Camera " + std::to_string(cameraIndex) + " - Image view " + opLog("Camera " + std::to_string(cameraIndex) + " - Image view " + std::to_string(viewIndex+1) + "/" + std::to_string(numberViews) + " - Chessboard not found.", Priority::High); } @@ -863,21 +863,21 @@ namespace op try { // Point --> cv::Size - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const cv::Size gridInnerCornersCvSize{gridInnerCorners.x, gridInnerCorners.y}; // Read images in folder - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto imageAndPaths = getImageAndPaths(imageFolder); // Get 2D grid corners of each image - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); std::vector> points2DVectors; std::vector imagesWithCorners; const auto imageSize = imageAndPaths.at(0).first.size(); for (auto i = 0u ; i < imageAndPaths.size() ; i++) { - log("\nImage " + std::to_string(i+1) + "/" + std::to_string(imageAndPaths.size()), Priority::High); + opLog("\nImage " + std::to_string(i+1) + "/" + std::to_string(imageAndPaths.size()), Priority::High); const auto& image = imageAndPaths.at(i).first; // Sanity check @@ -899,7 +899,7 @@ namespace op points2DVectors.emplace_back(points2DVector); } else - log("Chessboard not found in image " + imageAndPaths.at(i).second + ".", Priority::High); + opLog("Chessboard not found in image " + imageAndPaths.at(i).second + ".", Priority::High); // Debugging (optional) - Show image (with chessboard corners if found) if (saveImagesWithCorners) @@ -918,14 +918,14 @@ namespace op error(sEmptyErrorMessage, __LINE__, __FUNCTION__, __FILE__); // Run calibration - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // objects3DVector is the same one for each image const std::vector> objects3DVectors( points2DVectors.size(), getObjects3DVector(gridInnerCornersCvSize, gridSquareSizeMm)); const auto intrinsics = calcIntrinsicParameters(imageSize, points2DVectors, objects3DVectors, flags); // Save intrinsics/results - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); Matrix opCameraMatrix = OP_CV2OPMAT(intrinsics.cameraMatrix); Matrix opDistortionCoefficients = OP_CV2OPMAT(intrinsics.distortionCoefficients); CameraParameterReader cameraParameterReader{ @@ -933,7 +933,7 @@ namespace op cameraParameterReader.writeParameters(outputParameterFolder); // Debugging (optional) - Save images with corners - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (saveImagesWithCorners) { const auto folderWhereSavingImages = imageFolder + "images_with_corners/"; @@ -973,7 +973,7 @@ namespace op { #ifdef USE_EIGEN // For debugging - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto coutResults = false; // const auto coutResults = true; const bool coutAndImshowVerbose = false; @@ -982,7 +982,7 @@ namespace op const cv::Size gridInnerCornersCvSize{gridInnerCorners.x, gridInnerCorners.y}; // Load intrinsic parameters - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); CameraParameterReader cameraParameterReader; cameraParameterReader.readParameters(parameterFolder); const auto cameraSerialNumbers = cameraParameterReader.getCameraSerialNumbers(); @@ -994,11 +994,11 @@ namespace op std::vector{realCameraDistortions.size()} : realCameraDistortions); // Only use the 2 desired ones - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); cameraIntrinsicsSubset = {cameraIntrinsicsSubset.at(index0), cameraIntrinsicsSubset.at(index1)}; cameraDistortionsSubset = {cameraDistortionsSubset.at(index0), cameraDistortionsSubset.at(index1)}; // Base extrinsics - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); cv::Mat extrinsicsCam0 = cv::Mat::eye(4, 4, realCameraDistortions.at(0).type()); bool cam0IsOrigin = true; if (combineCam0Extrinsics) @@ -1010,9 +1010,9 @@ namespace op } // Number cameras and image paths - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto numberCameras = cameraParameterReader.getNumberCameras(); - log("\nDetected " + std::to_string(numberCameras) + " cameras from your XML files on:\n" + opLog("\nDetected " + std::to_string(numberCameras) + " cameras from your XML files on:\n" + parameterFolder + "\nRemove wrong/extra XML files if this number of cameras does not" + " correspond with the number of cameras recorded in:\n" + imageFolder + "\n", Priority::High); @@ -1026,19 +1026,19 @@ namespace op __LINE__, __FUNCTION__, __FILE__); // Estimate extrinsic parameters per image - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - log("Calibrating camera " + cameraSerialNumbers.at(index1) + " with respect to camera " + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Calibrating camera " + cameraSerialNumbers.at(index1) + " with respect to camera " + cameraSerialNumbers.at(index0) + "...", Priority::High); const auto numberViews = imagePaths.size() / numberCameras; auto counterValidImages = 0u; std::vector MCam1ToCam0s; for (auto i = 0u ; i < imagePaths.size() ; i+=numberCameras) { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto pathCam0 = imagePaths[i+index0]; const auto pathCam1 = imagePaths[i+index1]; if (coutResults || i/numberCameras % int(numberViews/10) == 0) - log("It " + std::to_string(i/numberCameras+1) + "/" + std::to_string(numberViews) + ": " + opLog("It " + std::to_string(i/numberCameras+1) + "/" + std::to_string(numberViews) + ": " + getFileNameAndExtension(pathCam0) + " & " + getFileNameAndExtension(pathCam1) + "...", Priority::High); @@ -1058,21 +1058,21 @@ namespace op counterValidImages++; if (coutAndImshowVerbose) { - log("########## Extrinsic parameters extractor ##########", Priority::High); - log("R_gf", Priority::High); - log(RGridToMainCam0, Priority::High); - log("t_gf", Priority::High); - log(tGridToMainCam0, Priority::High); - log("R_gb", Priority::High); - log(RGridToMainCam1, Priority::High); - log("t_gb", Priority::High); - log(tGridToMainCam1, Priority::High); - log("\n", Priority::High); + opLog("########## Extrinsic parameters extractor ##########", Priority::High); + opLog("R_gf", Priority::High); + opLog(RGridToMainCam0, Priority::High); + opLog("t_gf", Priority::High); + opLog(tGridToMainCam0, Priority::High); + opLog("R_gb", Priority::High); + opLog(RGridToMainCam1, Priority::High); + opLog("t_gb", Priority::High); + opLog(tGridToMainCam1, Priority::High); + opLog("\n", Priority::High); } // MCam1ToCam0 - Projection matrix estimator if (coutAndImshowVerbose) - log("########## Projection Matrix from secondary camera to main camera ##########", + opLog("########## Projection Matrix from secondary camera to main camera ##########", Priority::High); MCam1ToCam0s.emplace_back( getMFromCam1ToCam0(RGridToMainCam0, tGridToMainCam0, RGridToMainCam1, tGridToMainCam1, @@ -1080,92 +1080,92 @@ namespace op if (coutResults) { if (coutAndImshowVerbose) - log("M_bg:", Priority::High); - log(MCam1ToCam0s.back(), Priority::High); - log(" ", Priority::High); + opLog("M_bg:", Priority::High); + opLog(MCam1ToCam0s.back(), Priority::High); + opLog(" ", Priority::High); } } else { if (coutResults) - log("Invalid frame (chessboard not found).", Priority::High); + opLog("Invalid frame (chessboard not found).", Priority::High); } } // Sanity check if (MCam1ToCam0s.empty()) error(sEmptyErrorMessage, __LINE__, __FUNCTION__, __FILE__); - log("Finished processing images.", Priority::High); + opLog("Finished processing images.", Priority::High); // Pseudo RANSAC calibration - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto MCam1ToCam0Noisy = getMAverage(MCam1ToCam0s); - log("Estimated initial (noisy?) projection matrix.", Priority::High); + opLog("Estimated initial (noisy?) projection matrix.", Priority::High); auto MCam1ToCam0 = getMAverage(MCam1ToCam0s, MCam1ToCam0Noisy); while ((MCam1ToCam0 - getMAverage(MCam1ToCam0s, MCam1ToCam0)).norm() > 1e-3) { if (coutResults) - log("Repeated robustness method...", Priority::High); + opLog("Repeated robustness method...", Priority::High); MCam1ToCam0 = getMAverage(MCam1ToCam0s, MCam1ToCam0); } - log("Estimated robust projection matrix.", Priority::High); - log("norm(M_robust-M_noisy): " + std::to_string((MCam1ToCam0Noisy - MCam1ToCam0).norm()), + opLog("Estimated robust projection matrix.", Priority::High); + opLog("norm(M_robust-M_noisy): " + std::to_string((MCam1ToCam0Noisy - MCam1ToCam0).norm()), Priority::High); // Show errors - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (coutAndImshowVerbose) { - log("\n-----------------------------------------------------------------------------------" + opLog("\n-----------------------------------------------------------------------------------" "-------------------\nErrors:", Priority::High); // Errors - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); for (auto i = 0u ; i < MCam1ToCam0s.size() ; i++) { - log("tCam1WrtCam0:", Priority::High); - log(MCam1ToCam0s.at(i).block<3,1>(0,3).transpose(), Priority::High); + opLog("tCam1WrtCam0:", Priority::High); + opLog(MCam1ToCam0s.at(i).block<3,1>(0,3).transpose(), Priority::High); } - log(" ", Priority::High); + opLog(" ", Priority::High); - log("tCam1WrtCam0:", Priority::High); - log(MCam1ToCam0.block<3,1>(0,3).transpose(), Priority::High); - log(" ", Priority::High); + opLog("tCam1WrtCam0:", Priority::High); + opLog(MCam1ToCam0.block<3,1>(0,3).transpose(), Priority::High); + opLog(" ", Priority::High); // Rotation matrix in degrees Rodrigues(InputArray src, OutputArray dst - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto rad2deg = 180 / PI; for (auto i = 0u ; i < MCam1ToCam0s.size() ; i++) { Eigen::Matrix3d R_secondaryToMain = MCam1ToCam0s.at(i).block<3,3>(0,0); - log("rodrigues:", Priority::High); - log((getRodriguesVector(R_secondaryToMain).t() * rad2deg), Priority::High); + opLog("rodrigues:", Priority::High); + opLog((getRodriguesVector(R_secondaryToMain).t() * rad2deg), Priority::High); } Eigen::Matrix3d R_secondaryToMain = MCam1ToCam0.block<3,3>(0,0); - log("rodrigues:", Priority::High); - log((getRodriguesVector(R_secondaryToMain).t() * rad2deg), Priority::High); + opLog("rodrigues:", Priority::High); + opLog((getRodriguesVector(R_secondaryToMain).t() * rad2deg), Priority::High); } // Show final result - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (coutResults) { - log("\n\n\n---------------------------------------------------------------------------" + opLog("\n\n\n---------------------------------------------------------------------------" "---------------------------", Priority::High); - log(std::to_string(counterValidImages) + " valid images.", Priority::High); - log("Initial (noisy?) projection matrix:", Priority::High); - log(MCam1ToCam0Noisy, Priority::High); - log("\nFinal projection matrix (mm):", Priority::High); - log(MCam1ToCam0, Priority::High); - log(" ", Priority::High); + opLog(std::to_string(counterValidImages) + " valid images.", Priority::High); + opLog("Initial (noisy?) projection matrix:", Priority::High); + opLog(MCam1ToCam0Noisy, Priority::High); + opLog("\nFinal projection matrix (mm):", Priority::High); + opLog(MCam1ToCam0, Priority::High); + opLog(" ", Priority::High); } // mm --> m - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); MCam1ToCam0.block<3,1>(0,3) *= 1e-3; // Eigen --> cv::Mat - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); cv::Mat cvMatExtrinsics; Eigen::MatrixXd eigenExtrinsics = MCam1ToCam0.block<3,4>(0,0); cv::eigen2cv(eigenExtrinsics, cvMatExtrinsics); @@ -1176,13 +1176,13 @@ namespace op cvMatExtrinsics *= extrinsicsCam0; // Final projection matrix - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - log("\nFinal projection matrix w.r.t. global origin (meters):", Priority::High); - log(cvMatExtrinsics, Priority::High); - log(" ", Priority::High); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("\nFinal projection matrix w.r.t. global origin (meters):", Priority::High); + opLog(cvMatExtrinsics, Priority::High); + opLog(" ", Priority::High); // Save result - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); CameraParameterReader cameraParameterReaderFinal{ cameraSerialNumbers.at(index1), OP_CV2OPMAT(cameraIntrinsicsSubset.at(1)), @@ -1192,7 +1192,7 @@ namespace op cameraParameterReaderFinal.writeParameters(parameterFolder); // Let the rendered image to be displayed - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (coutAndImshowVerbose) cv::waitKey(0); #else @@ -1268,7 +1268,7 @@ namespace op __LINE__, __FUNCTION__, __FILE__); // Debugging if (verbose) - log("Reprojection Error info: Max error: " + std::to_string(maxError) + ";\t in cam idx " + opLog("Reprojection Error info: Max error: " + std::to_string(maxError) + ";\t in cam idx " + std::to_string(maxCamIdx) + " with pt idx: " + std::to_string(maxPtIdx) + " & pt 2D: " + std::to_string(points2DVectorsExtrinsic[maxCamIdx][maxPtIdx].x) + "x" + std::to_string(points2DVectorsExtrinsic[maxCamIdx][maxPtIdx].y), Priority::High); @@ -1440,7 +1440,7 @@ namespace op reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, cameraExtrinsics, cameraIntrinsics); // Verbose - log("Reprojection Error (after outlier removal iteration): " + opLog("Reprojection Error (after outlier removal iteration): " + std::to_string(reprojectionError) + " pixels,\twith error threshold of " + std::to_string(errorThreshold) + " pixels.", Priority::High); } @@ -1925,7 +1925,7 @@ namespace op // Ceres verbose ceres::Solver::Summary summary; ceres::Solve(options, &problem, &summary); - log(summary.FullReport(), Priority::High); + opLog(summary.FullReport(), Priority::High); // Sanity check normCam0Identity = cv::norm( refinedExtrinsics[0] - cv::Mat::eye(3, 4, refinedExtrinsics[0].type())); @@ -1948,7 +1948,7 @@ namespace op } const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); - log("Reprojection Error (after Bundle Adjustment): " + std::to_string(reprojectionError) + opLog("Reprojection Error (after Bundle Adjustment): " + std::to_string(reprojectionError) + " pixels.", Priority::High); } catch (const std::exception& e) @@ -2019,7 +2019,7 @@ namespace op } } const double scalingFactor = 0.001f * gridSquareSizeMm * sumLength / sumSquareLength; - log("Scaling factor: " + std::to_string(scalingFactor) + ",\tMin grid length: " + opLog("Scaling factor: " + std::to_string(scalingFactor) + ",\tMin grid length: " + std::to_string(minLength) + ",\tMax grid length: " + std::to_string(maxLength), Priority::High); // Scale extrinsics: Scale the translation (and the 3D point) for (auto cameraIndex = 1; cameraIndex < numberCameras; cameraIndex++) @@ -2033,7 +2033,7 @@ namespace op // Final reprojection error const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); - log("Reprojection Error (after rescaling): " + std::to_string(reprojectionError) + " pixels.", + opLog("Reprojection Error (after rescaling): " + std::to_string(reprojectionError) + " pixels.", Priority::High); } catch (const std::exception& e) @@ -2058,21 +2058,21 @@ namespace op { const auto reprojectionError = computeReprojectionErrorInPixels( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics); - log("Reprojection Error (initial): " + std::to_string(reprojectionError), Priority::High); - log(" ", Priority::High); + opLog("Reprojection Error (initial): " + std::to_string(reprojectionError), Priority::High); + opLog(" ", Priority::High); } // Outlier removal - log("Applying outlier removal...", Priority::High); + opLog("Applying outlier removal...", Priority::High); removeOutliersReprojectionErrorIterative( points2DVectorsExtrinsic, BAValid, points3D, refinedExtrinsics, cameraIntrinsics, pixelThreshold); - log(" ", Priority::High); + opLog(" ", Priority::High); // Bundle Adjustment - log("Running bundle adjustment...", Priority::High); + opLog("Running bundle adjustment...", Priority::High); runBundleAdjustment( refinedExtrinsics, points3D, points2DVectorsExtrinsic, BAValid, cameraIntrinsics, numberCameras); - log(" ", Priority::High); + opLog(" ", Priority::High); } catch (const std::exception& e) { @@ -2119,15 +2119,15 @@ namespace op error("This mode assumes that the images are already undistorted (add flag `--omit_distortion`).", __LINE__, __FUNCTION__, __FILE__); - log("Loading images...", Priority::High); + opLog("Loading images...", Priority::High); const auto imageAndPaths = getImageAndPaths(imageFolder); - log("Images loaded.", Priority::High); + opLog("Images loaded.", Priority::High); // Point --> cv::Size const cv::Size gridInnerCornersCvSize{gridInnerCorners.x, gridInnerCorners.y}; // Load parameters (distortion, intrinsics, initial extrinsics) - log("Loading parameters...", Priority::High); + opLog("Loading parameters...", Priority::High); CameraParameterReader cameraParameterReader; cameraParameterReader.readParameters(parameterFolder); const auto opCameraExtrinsicsInitial = cameraParameterReader.getCameraExtrinsicsInitial(); @@ -2145,9 +2145,9 @@ namespace op break; } } - log("Parameters loaded.", Priority::High); + opLog("Parameters loaded.", Priority::High); // Camera extrinsics - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); auto opCameraExtrinsics = (initialEmpty ? cameraParameterReader.getCameraExtrinsics() : opCameraExtrinsicsInitial); OP_OP2CVVECTORMAT(cameraExtrinsics, opCameraExtrinsics) @@ -2161,18 +2161,18 @@ namespace op imagesAreUndistorted ? std::vector{cameraIntrinsics.size()} : cameraParameterReader.getCameraDistortions()); // Read images in folder - log("Reading images in folder...", Priority::High); + opLog("Reading images in folder...", Priority::High); const auto numberCorners = gridInnerCorners.area(); std::vector> points2DVectorsExtrinsic(numberCameras); // camera - keypoints std::vector> matchIndexes(numberCameras); // camera - indixes found if (imageAndPaths.empty()) error("imageAndPaths.empty()!.", __LINE__, __FUNCTION__, __FILE__); - log("Images read.", Priority::High); + opLog("Images read.", Priority::High); // Get 2D grid corners of each image std::vector imagesWithCorners; const auto imageSize = imageAndPaths.at(0).first.size(); const auto numberViews = (unsigned int)(imageAndPaths.size() / numberCameras); - log("Processing cameras...", Priority::High); + opLog("Processing cameras...", Priority::High); std::vector threads; for (auto cameraIndex = 0 ; cameraIndex < numberCameras ; cameraIndex++) { @@ -2224,11 +2224,11 @@ namespace op } } // ofstreamMatches.close(); - log("Number points (i.e., timestamps) fully obtained: " + opLog("Number points (i.e., timestamps) fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size()), Priority::High); - log("Number views (i.e., cameras) fully obtained: " + opLog("Number views (i.e., cameras) fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size() / numberCorners), Priority::High); - log(" ", Priority::High); + opLog(" ", Priority::High); // Sanity check for (auto i = 1 ; i < numberCameras ; i++) @@ -2254,7 +2254,7 @@ namespace op // Last note: For quick debugging, set saveVisualSFMFiles = true and check the generated FeatureMatches.txt // (note that *.sift files are actually in binary format, so quite hard to read.) - log("Estimating initial 3D points...", Priority::High); + opLog("Estimating initial 3D points...", Priority::High); // Run triangulation to obtain the initial 3D points const auto initialPoints3D = reconstruct3DPoints( points2DVectorsExtrinsic, cameraIntrinsics, cameraExtrinsics, numberCameras, imageSize); @@ -2280,7 +2280,7 @@ namespace op // Revert back to refinedExtrinsics[0] = cameraExtrinsics[0] (rather than [I,0]) // Note: Given that inv([R,t;0,1]) is another [R',t';0,1], scaling is maintained - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); cv::Mat cameraOriginInv2; cameraXAsOrigin(refinedExtrinsics, cameraOriginInv2, cameraOriginInv); // Sanity check @@ -2290,22 +2290,22 @@ namespace op + std::to_string(normCam0Identity), __LINE__, __FUNCTION__, __FILE__); // Final projection matrix - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); - log("\nFinal projection matrix w.r.t. global origin (meters):", Priority::High); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("\nFinal projection matrix w.r.t. global origin (meters):", Priority::High); for (auto cameraIndex = 0; cameraIndex < numberCameras; cameraIndex++) { - log("Camera " + std::to_string(cameraIndex) + ":", Priority::High); - log(refinedExtrinsics[cameraIndex], Priority::High); - // log("Initial camera " + std::to_string(cameraIndex) + ":", Priority::High); - // log(cameraExtrinsics[cameraIndex], Priority::High); + opLog("Camera " + std::to_string(cameraIndex) + ":", Priority::High); + opLog(refinedExtrinsics[cameraIndex], Priority::High); + // opLog("Initial camera " + std::to_string(cameraIndex) + ":", Priority::High); + // opLog(cameraExtrinsics[cameraIndex], Priority::High); const auto normDifference = cv::norm( refinedExtrinsics[cameraIndex] - cameraExtrinsics[cameraIndex]); - log("Norm difference w.r.t. original extrinsics: " + std::to_string(normDifference), + opLog("Norm difference w.r.t. original extrinsics: " + std::to_string(normDifference), Priority::High); } // Save new extrinsics - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto cameraSerialNumbers = cameraParameterReader.getCameraSerialNumbers(); const auto opRealCameraDistortions = cameraParameterReader.getCameraDistortions(); for (auto i = 0 ; i < numberCameras ; i++) @@ -2318,7 +2318,7 @@ namespace op (initialEmpty ? OP_CV2OPCONSTMAT(cameraExtrinsics.at(i)) : opCameraExtrinsicsInitial.at(i))}; cameraParameterReaderFinal.writeParameters(parameterFolder); } - log(" ", Priority::High); + opLog(" ", Priority::High); #else UNUSED(parameterFolder); UNUSED(imageFolder); @@ -2342,9 +2342,9 @@ namespace op { try { - log("Loading images...", Priority::High); + opLog("Loading images...", Priority::High); const auto imageAndPaths = getImageAndPaths(imageFolder); - log("Images loaded.", Priority::High); + opLog("Images loaded.", Priority::High); // Point --> cv::Size const cv::Size gridInnerCornersCvSize{gridInnerCorners.x, gridInnerCorners.y}; @@ -2360,7 +2360,7 @@ namespace op std::vector imagesWithCorners; const auto imageSize = imageAndPaths.at(0).first.size(); const auto numberViews = (unsigned int)(imageAndPaths.size() / numberCameras); - log("Processing cameras...", Priority::High); + opLog("Processing cameras...", Priority::High); std::vector threads; for (auto cameraIndex = 0 ; cameraIndex < numberCameras ; cameraIndex++) { @@ -2408,8 +2408,8 @@ namespace op } } ofstreamMatches.close(); - log("Number points fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size()), Priority::High); - log("Number views fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size() / numberCorners), + opLog("Number points fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size()), Priority::High); + opLog("Number views fully obtained: " + std::to_string(points2DVectorsExtrinsic[0].size() / numberCorners), Priority::High); // Sanity check for (auto i = 1 ; i < numberCameras ; i++) diff --git a/src/openpose/calibration/gridPatternFunctions.cpp b/src/openpose/calibration/gridPatternFunctions.cpp index 0dfffb6d..20731eb0 100644 --- a/src/openpose/calibration/gridPatternFunctions.cpp +++ b/src/openpose/calibration/gridPatternFunctions.cpp @@ -119,7 +119,7 @@ namespace op } if (chessboardFound && image.size().width != tempImage.size().width) { - log("Chessboard found at lower resolution (" + std::to_string(tempImage.cols) + "x" + opLog("Chessboard found at lower resolution (" + std::to_string(tempImage.cols) + "x" + std::to_string(tempImage.rows) + ").", Priority::High); for (auto& point : points2DVector) point *= (image.size().width / tempImage.size().width); @@ -330,7 +330,7 @@ namespace op { // Warning if (showWarning) - log("For maximum multi-view accuracy: The number of corners of the chessboard should be even in" + opLog("For maximum multi-view accuracy: The number of corners of the chessboard should be even in" " 1 dimension and odd in the other (e.g., 1x2, 2x1, 1x4, 3x8, 6x9, 9x6, etc.). Otherwise," " extrinsics calibration results might be affected.", Priority::High); // Old method @@ -389,13 +389,13 @@ namespace op / 4.; // Debugging if (debugging) - log("\naverageSquareSizePx: " + std::to_string(averageSquareSizePx)); + opLog("\naverageSquareSizePx: " + std::to_string(averageSquareSizePx)); // How many pixels does the outter square has? // 0.67 is a threshold to be safe const auto diagonalLength = 0.67 * std::sqrt(2) * averageSquareSizePx; // Debugging if (debugging) - log("diagonalLength: " + std::to_string(diagonalLength)); + opLog("diagonalLength: " + std::to_string(diagonalLength)); // In which direction do I have to look? // Normal vector between corners 0-1, 0-2, 1-3? @@ -405,13 +405,13 @@ namespace op // Debugging if (debugging) { - log("\npoint01Direction:"); - log(point01Direction); - log("point02Direction:"); - log(point02Direction); - log("point13Direction:"); - log(point13Direction); - log(" "); + opLog("\npoint01Direction:"); + opLog(point01Direction); + opLog("point02Direction:"); + opLog(point02Direction); + opLog("point13Direction:"); + opLog(point13Direction); + opLog(" "); } auto pointDirection = fourPointsVector; // Initialization @@ -427,10 +427,10 @@ namespace op { for (auto i = 0u ; i < fourPointsVector.size() ; i++) { - log("pointDirection[" + std::to_string(i) + "]:"); - log(pointDirection[i]); + opLog("pointDirection[" + std::to_string(i) + "]:"); + opLog(pointDirection[i]); } - log(" "); + opLog(" "); } // Get line to check whether outter grid color is black @@ -461,7 +461,7 @@ namespace op meanPxValues[i] = sum/count; // Debugging if (debugging) - log("meanPxValues[" + std::to_string(i) + "]: " + std::to_string(meanPxValues[i])); + opLog("meanPxValues[" + std::to_string(i) + "]: " + std::to_string(meanPxValues[i])); } // Get black indexes @@ -476,9 +476,9 @@ namespace op for (auto i = 0u ; i < fourPointsVector.size() ; i++) cv::line(imageToPlot, fourPointsVector[i], pointLimit[i], cv::Scalar{0,0,255}, 10); // Black indexes - log(" "); - log("blackIs0: " + std::to_string(blackIs0)); - log("blackIs1: " + std::to_string(blackIs1)); + opLog(" "); + opLog("blackIs0: " + std::to_string(blackIs0)); + opLog("blackIs1: " + std::to_string(blackIs1)); // Plotting results // Chessboard before drawGridCorners(imageToPlot, gridInnerCorners, points2DVector); @@ -494,7 +494,7 @@ namespace op blackIs1 = !blackIs1; // Debugging if (debugging) - log("Swapping 0 and 3 so 0 is black."); + opLog("Swapping 0 and 3 so 0 is black."); } // Lead is 0 or 1||2 (depending on blackIs1)? const auto outterCornerIndicesAfter = getOutterCornerIndices(points2DVector, gridInnerCorners); @@ -509,20 +509,20 @@ namespace op const auto crossProduct = fourPointsVectorAfter[0].cross(fourPointsVectorAfter[(blackIs1 ? 1 : 2)]); // Debugging if (debugging) - log("crossProduct: " + std::to_string(crossProduct)); + opLog("crossProduct: " + std::to_string(crossProduct)); const auto leadIs0 = crossProduct < 0; // Second transformation if (!leadIs0) { // Debugging if (debugging) - log("Lead is not 0."); + opLog("Lead is not 0."); // Second black is 1 if (blackIs1) { // Debugging if (debugging) - log("Lead was 1."); + opLog("Lead was 1."); invertXPositionsIndices(points2DVector, gridInnerCorners); // 1->0 } // Second black is 2 @@ -530,7 +530,7 @@ namespace op { // Debugging if (debugging) - log("Lead was 2."); + opLog("Lead was 2."); std::reverse(points2DVector.begin(), points2DVector.end()); // 2->3 invertXPositionsIndices(points2DVector, gridInnerCorners); // 3->0 } diff --git a/src/openpose/core/cvMatToOpInput.cpp b/src/openpose/core/cvMatToOpInput.cpp index 0076dcf9..bce36463 100644 --- a/src/openpose/core/cvMatToOpInput.cpp +++ b/src/openpose/core/cvMatToOpInput.cpp @@ -98,7 +98,7 @@ namespace op // cv::dnn::blobFromImage( // // frameWithNetSize, cvMat, scale, outputSize, mean); // frameWithNetSize, inputNetData[i].getCvMat(), scale, outputSize, mean); - // // log(cv::norm(cvMat - inputNetData[i].getCvMat())); // ~0.25 + // // opLog(cv::norm(cvMat - inputNetData[i].getCvMat())); // ~0.25 } // CUDA version (if #Gpus > n) else diff --git a/src/openpose/core/verbosePrinter.cpp b/src/openpose/core/verbosePrinter.cpp index 7ba59e79..cefd0116 100644 --- a/src/openpose/core/verbosePrinter.cpp +++ b/src/openpose/core/verbosePrinter.cpp @@ -44,7 +44,7 @@ namespace op plotResults = ((frameNumber+1) % uLongLongRound(mVerbose) == 0); // Plot results if (plotResults) - log("Processing frame " + std::to_string(frameNumber+1) + mNumberFramesString); + opLog("Processing frame " + std::to_string(frameNumber+1) + mNumberFramesString); } } catch (const std::exception& e) diff --git a/src/openpose/face/faceExtractorCaffe.cpp b/src/openpose/face/faceExtractorCaffe.cpp index 9112ec2d..06f482e6 100644 --- a/src/openpose/face/faceExtractorCaffe.cpp +++ b/src/openpose/face/faceExtractorCaffe.cpp @@ -148,7 +148,7 @@ namespace op { #ifdef USE_CAFFE // Logging - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Initialize Caffe net upImpl->spNetCaffe->initializationOnThread(); #ifdef USE_CUDA @@ -162,7 +162,7 @@ namespace op cudaCheck(__LINE__, __FUNCTION__, __FILE__); #endif // Logging - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif } catch (const std::exception& e) @@ -210,7 +210,7 @@ namespace op // Only consider faces with a minimum pixel area const auto minFaceSize = fastMin(faceRectangle.width, faceRectangle.height); // // Debugging -> red rectangle - // log(std::to_string(cvInputData.cols) + " " + std::to_string(cvInputData.rows)); + // opLog(std::to_string(cvInputData.cols) + " " + std::to_string(cvInputData.rows)); // cv::rectangle(cvInputDataCopy, // cv::Point{(int)faceRectangle.x, (int)faceRectangle.y}, // cv::Point{(int)faceRectangle.bottomRight().x, @@ -220,7 +220,7 @@ namespace op if (minFaceSize > 40) { // // Debugging -> green rectangle overwriting red one - // log(std::to_string(cvInputData.cols) + " " + std::to_string(cvInputData.rows)); + // opLog(std::to_string(cvInputData.cols) + " " + std::to_string(cvInputData.rows)); // cv::rectangle(cvInputDataCopy, // cv::Point{(int)faceRectangle.x, (int)faceRectangle.y}, // cv::Point{(int)faceRectangle.bottomRight().x, diff --git a/src/openpose/face/faceExtractorNet.cpp b/src/openpose/face/faceExtractorNet.cpp index 90a53499..34dd8485 100644 --- a/src/openpose/face/faceExtractorNet.cpp +++ b/src/openpose/face/faceExtractorNet.cpp @@ -19,15 +19,18 @@ namespace op && mHeatMapScaleMode != ScaleMode::UnsignedChar) error("The ScaleMode heatMapScaleMode must be ZeroToOne, PlusMinusOne or UnsignedChar.", __LINE__, __FUNCTION__, __FILE__); - checkE(netOutputSize.x, netInputSize.x, "Net input and output size must be equal.", - __LINE__, __FUNCTION__, __FILE__); - checkE(netOutputSize.y, netInputSize.y, "Net input and output size must be equal.", - __LINE__, __FUNCTION__, __FILE__); - checkE(netInputSize.x, netInputSize.y, "Net input size must be squared.", - __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netOutputSize.x, netInputSize.x, "Net input and output size must be equal.", + __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netOutputSize.y, netInputSize.y, "Net input and output size must be equal.", + __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netInputSize.x, netInputSize.y, "Net input size must be squared.", + __LINE__, __FUNCTION__, __FILE__); // Warnings if (!mHeatMapTypes.empty()) - log("Note that only the keypoint heatmaps are available with face heatmaps (no background nor PAFs).", + opLog("Note that only the keypoint heatmaps are available with face heatmaps (no background nor PAFs).", Priority::High); } catch (const std::exception& e) diff --git a/src/openpose/face/faceGpuRenderer.cpp b/src/openpose/face/faceGpuRenderer.cpp index 5ce9cc2b..9b243e20 100644 --- a/src/openpose/face/faceGpuRenderer.cpp +++ b/src/openpose/face/faceGpuRenderer.cpp @@ -58,7 +58,7 @@ namespace op { try { - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // GPU memory allocation for rendering #ifdef USE_CUDA cudaMalloc((void**)(&pGpuFace), POSE_MAX_PEOPLE * FACE_NUMBER_PARTS * 3 * sizeof(float)); @@ -66,7 +66,7 @@ namespace op cudaMalloc((void**)&pMinPtr, sizeof(float) * 2 * FACE_NUMBER_PARTS); cudaMalloc((void**)&pScalePtr, sizeof(float) * FACE_NUMBER_PARTS); #endif - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/src/openpose/filestream/fileStream.cpp b/src/openpose/filestream/fileStream.cpp index 7a2eed59..eea48e96 100644 --- a/src/openpose/filestream/fileStream.cpp +++ b/src/openpose/filestream/fileStream.cpp @@ -364,7 +364,7 @@ namespace op { cv::Mat cvMat = cv::imread(fullFilePath, openCvFlags); if (cvMat.empty()) - log("Empty image on path: " + fullFilePath + ".", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("Empty image on path: " + fullFilePath + ".", Priority::Max, __LINE__, __FUNCTION__, __FILE__); return OP_CV2OPMAT(cvMat); } catch (const std::exception& e) diff --git a/src/openpose/filestream/videoSaver.cpp b/src/openpose/filestream/videoSaver.cpp index 542153e8..a5a3ad35 100644 --- a/src/openpose/filestream/videoSaver.cpp +++ b/src/openpose/filestream/videoSaver.cpp @@ -109,7 +109,7 @@ namespace op // Images --> Video if (upImpl->mUseFfmpeg) { - log("JPG images temporarily generated in " + upImpl->mTempImageFolder + ".", op::Priority::High); + opLog("JPG images temporarily generated in " + upImpl->mTempImageFolder + ".", op::Priority::High); // FFmpeg command: Save video from images (override if video with same name exists) // Framerate works with both `-r` and `-framerate` for an image folder. Source: // https://stackoverflow.com/questions/51143100/framerate-vs-r-vs-filter-fps @@ -119,18 +119,18 @@ namespace op + " -i " + upImpl->mTempImageFolder + "/%12d_rendered.jpg" + " -c:v libx264 -pix_fmt yuv420p " + upImpl->mVideoSaverPath; - log("Creating MP4 video out of JPG images by running:\n" + imageToVideoCommand + "\n", + opLog("Creating MP4 video out of JPG images by running:\n" + imageToVideoCommand + "\n", op::Priority::High); auto codeAnswerVideo = system(imageToVideoCommand.c_str()); // Remove temporary images if (codeAnswerVideo == 0) { codeAnswerVideo = system(("rm -rf " + upImpl->mTempImageFolder).c_str()); - log("Video saved and temporary image folder removed.", op::Priority::High); + opLog("Video saved and temporary image folder removed.", op::Priority::High); } // Sanity check if (codeAnswerVideo != 0) - log("\nVideo " + upImpl->mVideoSaverPath + " could not be saved (exit code: " + opLog("\nVideo " + upImpl->mVideoSaverPath + " could not be saved (exit code: " + std::to_string(codeAnswerVideo) + "). Make sure you can manually run the following command" " (with no errors) from the terminal:\n" + imageToVideoCommand, op::Priority::High); // Video (no sound) --> Video (with sound) @@ -139,14 +139,14 @@ namespace op const auto tempOutput = upImpl->mVideoSaverPath + RANDOM_TEXT + ".mp4"; const auto audioCommand = "ffmpeg -y -i " + upImpl->mVideoSaverPath + " -i " + upImpl->mAddAudioFromThisVideo + " -codec copy -shortest " + tempOutput; - log("Adding audio to video by running:\n" + audioCommand, op::Priority::High); + opLog("Adding audio to video by running:\n" + audioCommand, op::Priority::High); auto codeAnswerAudio = system(audioCommand.c_str()); // Move temp output to real output if (codeAnswerAudio == 0) codeAnswerAudio = system(("mv " + tempOutput + " " + upImpl->mVideoSaverPath).c_str()); // Sanity check if (codeAnswerAudio != 0) - log("\nVideo " + upImpl->mVideoSaverPath + " could not be saved with audio (exit code: " + opLog("\nVideo " + upImpl->mVideoSaverPath + " could not be saved with audio (exit code: " + std::to_string(codeAnswerAudio) + "). Make sure you can manually run the following command" " (with no errors) from the terminal:\n" + audioCommand, op::Priority::High); } @@ -210,7 +210,7 @@ namespace op // FFmpeg video if (upImpl->mUseFfmpeg) { - log("Temporarily saving video frames as JPG images in: " + upImpl->mTempImageFolder, + opLog("Temporarily saving video frames as JPG images in: " + upImpl->mTempImageFolder, op::Priority::High); upImpl->upImageSaver.reset(new ImageSaver{upImpl->mTempImageFolder, "jpg"}); } diff --git a/src/openpose/gpu/opencl.cpp b/src/openpose/gpu/opencl.cpp index e0d38643..0678d501 100644 --- a/src/openpose/gpu/opencl.cpp +++ b/src/openpose/gpu/opencl.cpp @@ -155,7 +155,7 @@ namespace op upImpl->mQueue = cl::CommandQueue(upImpl->mContext, upImpl->mDevice, CL_QUEUE_PROFILING_ENABLE); deviceFound = true; - log("Made new GPU Instance: " + std::to_string(deviceId)); + opLog("Made new GPU Instance: " + std::to_string(deviceId)); break; } } @@ -186,7 +186,7 @@ namespace op upImpl->mQueue = cl::CommandQueue(upImpl->mContext, upImpl->mDevice, CL_QUEUE_PROFILING_ENABLE); deviceFound = true; - log("Made new CPU Instance: " + std::to_string(deviceId)); + opLog("Made new CPU Instance: " + std::to_string(deviceId)); break; } } @@ -219,7 +219,7 @@ namespace op upImpl->mQueue = cl::CommandQueue(upImpl->mContext, upImpl->mDevice, CL_QUEUE_PROFILING_ENABLE); deviceFound = true; - log("Made new ACC Instance: " + std::to_string(deviceId)); + opLog("Made new ACC Instance: " + std::to_string(deviceId)); break; } } @@ -240,7 +240,7 @@ namespace op #if defined(USE_OPENCL) && defined(CL_HPP_ENABLE_EXCEPTIONS) catch (cl::Error e) { - log("Error: " + std::string(e.what())); + opLog("Error: " + std::string(e.what())); } #endif catch (const std::exception& e) @@ -316,13 +316,13 @@ namespace op if (!(upImpl->mClKernels.find(key) != upImpl->mClKernels.end())) { upImpl->mClKernels[key] = cl::Kernel(program, kernelName.c_str()); - log("Kernel: " + kernelName + " Type: " + type + + " GPU: " + std::to_string(upImpl->mId) + + opLog("Kernel: " + kernelName + " Type: " + type + + " GPU: " + std::to_string(upImpl->mId) + " built successfully"); return true; } else { - log("Kernel " + kernelName + " already built"); + opLog("Kernel " + kernelName + " already built"); return false; } #else @@ -477,7 +477,7 @@ namespace op #if defined(USE_OPENCL) && defined(CL_HPP_ENABLE_EXCEPTIONS) catch (cl::Error& e) { - log("Error: " + std::string(e.what())); + opLog("Error: " + std::string(e.what())); } #endif catch (const std::exception& e) diff --git a/src/openpose/gui/gui.cpp b/src/openpose/gui/gui.cpp index 9d938cf5..3bed2760 100644 --- a/src/openpose/gui/gui.cpp +++ b/src/openpose/gui/gui.cpp @@ -114,7 +114,7 @@ namespace op faceExtractorNet->setEnabled(!faceExtractorNet->getEnabled()); // Warning if not enabled if (faceExtractorNets.empty()) - log("OpenPose must be run with face keypoint estimation enabled (`--face` flag).", + opLog("OpenPose must be run with face keypoint estimation enabled (`--face` flag).", Priority::High); } // Enable/disable hands @@ -124,7 +124,7 @@ namespace op handExtractorNet->setEnabled(!handExtractorNet->getEnabled()); // Warning if not enabled if (handExtractorNets.empty()) - log("OpenPose must be run with face keypoint estimation enabled (`--hand` flag).", + opLog("OpenPose must be run with face keypoint estimation enabled (`--hand` flag).", Priority::High); } // Enable/disable extra rendering (3D/Adam), while keeping 2D rendering diff --git a/src/openpose/gui/gui3D.cpp b/src/openpose/gui/gui3D.cpp index f5f3f242..0285464c 100644 --- a/src/openpose/gui/gui3D.cpp +++ b/src/openpose/gui/gui3D.cpp @@ -303,7 +303,7 @@ namespace op else //zoom out gGViewDistance -= 10 * gScaleForMouseMotion; if (LOG_VERBOSE_3D_RENDERER) - log("gGViewDistance: " + std::to_string(gGViewDistance)); + opLog("gGViewDistance: " + std::to_string(gGViewDistance)); } else { @@ -319,7 +319,7 @@ namespace op gCameraMode = CameraMode::CAM_ROTATE; } if (LOG_VERBOSE_3D_RENDERER) - log("Clicked: [" + std::to_string(gXClick) + "," + std::to_string(gYClick) + "]"); + opLog("Clicked: [" + std::to_string(gXClick) + "," + std::to_string(gYClick) + "]"); } glutPostRedisplay(); } @@ -354,11 +354,11 @@ namespace op glutPostRedisplay(); if (LOG_VERBOSE_3D_RENDERER) { - log("gMouseXRotateDeg = " + std::to_string(gMouseXRotateDeg)); - log("gMouseYRotateDeg = " + std::to_string(gMouseYRotateDeg)); - log("gMouseXPan = " + std::to_string(gMouseXPan)); - log("gMouseYPan = " + std::to_string(gMouseYPan)); - log("gMouseZPan = " + std::to_string(gMouseZPan)); + opLog("gMouseXRotateDeg = " + std::to_string(gMouseXRotateDeg)); + opLog("gMouseYRotateDeg = " + std::to_string(gMouseYRotateDeg)); + opLog("gMouseXPan = " + std::to_string(gMouseXPan)); + opLog("gMouseYPan = " + std::to_string(gMouseYPan)); + opLog("gMouseZPan = " + std::to_string(gMouseZPan)); } } } diff --git a/src/openpose/hand/handExtractorCaffe.cpp b/src/openpose/hand/handExtractorCaffe.cpp index c01c1364..84297047 100644 --- a/src/openpose/hand/handExtractorCaffe.cpp +++ b/src/openpose/hand/handExtractorCaffe.cpp @@ -278,7 +278,7 @@ namespace op { #ifdef USE_CAFFE // Logging - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Initialize Caffe net upImpl->spNetCaffe->initializationOnThread(); #ifdef USE_CUDA @@ -292,7 +292,7 @@ namespace op cudaCheck(__LINE__, __FUNCTION__, __FILE__); #endif // Logging - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif } catch (const std::exception& e) diff --git a/src/openpose/hand/handExtractorNet.cpp b/src/openpose/hand/handExtractorNet.cpp index 42b7294c..09bf1ecd 100644 --- a/src/openpose/hand/handExtractorNet.cpp +++ b/src/openpose/hand/handExtractorNet.cpp @@ -21,15 +21,17 @@ namespace op && mHeatMapScaleMode != ScaleMode::UnsignedChar) error("The ScaleMode heatMapScaleMode must be ZeroToOne, PlusMinusOne or UnsignedChar.", __LINE__, __FUNCTION__, __FILE__); - checkE(netOutputSize.x, netInputSize.x, "Net input and output size must be equal.", - __LINE__, __FUNCTION__, __FILE__); - checkE(netOutputSize.y, netInputSize.y, "Net input and output size must be equal.", - __LINE__, __FUNCTION__, __FILE__); - checkE(netInputSize.x, netInputSize.y, "Net input size must be squared.", - __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netOutputSize.x, netInputSize.x, "Net input and output size must be equal.", + __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netOutputSize.y, netInputSize.y, "Net input and output size must be equal.", + __LINE__, __FUNCTION__, __FILE__); + checkEqual( + netInputSize.x, netInputSize.y, "Net input size must be squared.", __LINE__, __FUNCTION__, __FILE__); // Warnings if (!mHeatMapTypes.empty()) - log("Note that only the keypoint heatmaps are available with hand heatmaps (no background nor PAFs).", + opLog("Note that only the keypoint heatmaps are available with hand heatmaps (no background nor PAFs).", Priority::High); } catch (const std::exception& e) diff --git a/src/openpose/hand/handGpuRenderer.cpp b/src/openpose/hand/handGpuRenderer.cpp index f6af6cd5..166d93a1 100644 --- a/src/openpose/hand/handGpuRenderer.cpp +++ b/src/openpose/hand/handGpuRenderer.cpp @@ -58,7 +58,7 @@ namespace op { try { - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // GPU memory allocation for rendering #ifdef USE_CUDA cudaMalloc((void**)(&pGpuHand), HAND_MAX_HANDS * HAND_NUMBER_PARTS * 3 * sizeof(float)); @@ -66,7 +66,7 @@ namespace op cudaMalloc((void**)&pMinPtr, sizeof(float) * 2 * HAND_MAX_HANDS); cudaMalloc((void**)&pScalePtr, sizeof(float) * HAND_MAX_HANDS); #endif - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/src/openpose/net/bodyPartConnectorBase.cpp b/src/openpose/net/bodyPartConnectorBase.cpp index 844687e5..52fc050e 100644 --- a/src/openpose/net/bodyPartConnectorBase.cpp +++ b/src/openpose/net/bodyPartConnectorBase.cpp @@ -874,7 +874,7 @@ namespace op true, peaksPtr); // // Debugging // if (numberPeople > 0) - // log("Found " + std::to_string(numberPeople) + " people in second iteration"); + // opLog("Found " + std::to_string(numberPeople) + " people in second iteration"); } } catch (const std::exception& e) diff --git a/src/openpose/net/bodyPartConnectorBase.cu b/src/openpose/net/bodyPartConnectorBase.cu index 7cea271c..a62ade4b 100644 --- a/src/openpose/net/bodyPartConnectorBase.cu +++ b/src/openpose/net/bodyPartConnectorBase.cu @@ -237,8 +237,8 @@ namespace op numberBodyParts, numberBodyPartPairs); // // Profiling verbose - // log(" BPC(ori)=" + std::to_string(timeNormalize1) + "ms"); - // log(" BPC(new)=" + std::to_string(timeNormalize2) + "ms"); + // opLog(" BPC(ori)=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" BPC(new)=" + std::to_string(timeNormalize2) + "ms"); // Sanity check cudaCheck(__LINE__, __FUNCTION__, __FILE__); diff --git a/src/openpose/net/maximumBase.cpp b/src/openpose/net/maximumBase.cpp index 6404ae47..ac2d07b5 100644 --- a/src/openpose/net/maximumBase.cpp +++ b/src/openpose/net/maximumBase.cpp @@ -19,15 +19,15 @@ namespace op const auto numberParts = targetSize[2]; const auto numberSubparts = targetSize[3]; - // log("sourceSize[0]: " + std::to_string(sourceSize[0])); // = 1 - // log("sourceSize[1]: " + std::to_string(sourceSize[1])); // = #body_parts+bck=22(hands) or 71(face) - // log("sourceSize[2]: " + std::to_string(sourceSize[2])); // = 368 = height - // log("sourceSize[3]: " + std::to_string(sourceSize[3])); // = 368 = width - // log("targetSize[0]: " + std::to_string(targetSize[0])); // = 1 - // log("targetSize[1]: " + std::to_string(targetSize[1])); // = 1 - // log("targetSize[2]: " + std::to_string(targetSize[2])); // = 21(hands) or 70 (face) - // log("targetSize[3]: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] - // log(" "); + // opLog("sourceSize[0]: " + std::to_string(sourceSize[0])); // = 1 + // opLog("sourceSize[1]: " + std::to_string(sourceSize[1])); // = #body_parts+bck=22(hands) or 71(face) + // opLog("sourceSize[2]: " + std::to_string(sourceSize[2])); // = 368 = height + // opLog("sourceSize[3]: " + std::to_string(sourceSize[3])); // = 368 = width + // opLog("targetSize[0]: " + std::to_string(targetSize[0])); // = 1 + // opLog("targetSize[1]: " + std::to_string(targetSize[1])); // = 1 + // opLog("targetSize[2]: " + std::to_string(targetSize[2])); // = 21(hands) or 70 (face) + // opLog("targetSize[3]: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] + // opLog(" "); for (auto n = 0; n < num; n++) { diff --git a/src/openpose/net/maximumBase.cu b/src/openpose/net/maximumBase.cu index 8e57d608..c784fdc7 100644 --- a/src/openpose/net/maximumBase.cu +++ b/src/openpose/net/maximumBase.cu @@ -73,15 +73,15 @@ namespace op const auto numberParts = targetSize[2]; const auto numberSubparts = targetSize[3]; - // log("sourceSize[0]: " + std::to_string(sourceSize[0])); // = 1 - // log("sourceSize[1]: " + std::to_string(sourceSize[1])); // = #BodyParts + bkg = 22 (hands) or 71 (face) - // log("sourceSize[2]: " + std::to_string(sourceSize[2])); // = 368 = height - // log("sourceSize[3]: " + std::to_string(sourceSize[3])); // = 368 = width - // log("targetSize[0]: " + std::to_string(targetSize[0])); // = 1 - // log("targetSize[1]: " + std::to_string(targetSize[1])); // = 1 - // log("targetSize[2]: " + std::to_string(targetSize[2])); // = 21(hands) or 70 (face) - // log("targetSize[3]: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] - // log(" "); + // opLog("sourceSize[0]: " + std::to_string(sourceSize[0])); // = 1 + // opLog("sourceSize[1]: " + std::to_string(sourceSize[1])); // = #BodyParts + bkg = 22 (hands) or 71 (face) + // opLog("sourceSize[2]: " + std::to_string(sourceSize[2])); // = 368 = height + // opLog("sourceSize[3]: " + std::to_string(sourceSize[3])); // = 368 = width + // opLog("targetSize[0]: " + std::to_string(targetSize[0])); // = 1 + // opLog("targetSize[1]: " + std::to_string(targetSize[1])); // = 1 + // opLog("targetSize[2]: " + std::to_string(targetSize[2])); // = 21(hands) or 70 (face) + // opLog("targetSize[3]: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] + // opLog(" "); for (auto n = 0; n < num; n++) { for (auto c = 0; c < channels; c++) diff --git a/src/openpose/net/nmsBase.cu b/src/openpose/net/nmsBase.cu index ad27634f..02e698f9 100644 --- a/src/openpose/net/nmsBase.cu +++ b/src/openpose/net/nmsBase.cu @@ -266,15 +266,15 @@ namespace op const dim3 numBlocks1D{getNumberCudaBlocks(imageOffset, threadsPerBlock1D.x)}; // const dim3 threadsPerBlockSort{128}; // const dim3 numBlocksSort{getNumberCudaBlocks(channels, threadsPerBlockSort.x)}; - // log("num_b: " + std::to_string(sourceSize[0])); // = 1 - // log("channel_b: " + std::to_string(sourceSize[1])); // = 57 = 18 body parts + bkg + 19x2 PAFs - // log("height_b: " + std::to_string(sourceSize[2])); // = 368 = height - // log("width_b: " + std::to_string(sourceSize[3])); // = 656 = width - // log("num_t: " + std::to_string(targetSize[0])); // = 1 - // log("channel_t: " + std::to_string(targetSize[1])); // = 18 = numberParts - // log("height_t: " + std::to_string(targetSize[2])); // = 128 = maxPeople + 1 - // log("width_t: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] - // log(""); + // opLog("num_b: " + std::to_string(sourceSize[0])); // = 1 + // opLog("channel_b: " + std::to_string(sourceSize[1])); // = 57 = 18 body parts + bkg + 19x2 PAFs + // opLog("height_b: " + std::to_string(sourceSize[2])); // = 368 = height + // opLog("width_b: " + std::to_string(sourceSize[3])); // = 656 = width + // opLog("num_t: " + std::to_string(targetSize[0])); // = 1 + // opLog("channel_t: " + std::to_string(targetSize[1])); // = 18 = numberParts + // opLog("height_t: " + std::to_string(targetSize[2])); // = 128 = maxPeople + 1 + // opLog("width_t: " + std::to_string(targetSize[3])); // = 3 = [x, y, score] + // opLog(""); // // Old code: Running 3 kernels per channel // // const auto REPS = 1; @@ -286,7 +286,7 @@ namespace op // { // for (auto c = 0; c < channels; c++) // { - // // log("channel: " + std::to_string(c)); + // // opLog("channel: " + std::to_string(c)); // const auto offsetChannel = (n * channels + c); // auto* kernelPtrOffsetted = kernelPtr + offsetChannel * imageOffset; // const auto* const sourcePtrOffsetted = sourcePtr + offsetChannel * imageOffset; @@ -338,8 +338,8 @@ namespace op // // Profiling code // OP_CUDA_PROFILE_END(timeNormalize2, 1e3, REPS); - // log(" NMS1(or)=" + std::to_string(timeNormalize1) + "ms"); - // log(" NMS2(1k)=" + std::to_string(timeNormalize2) + "ms"); + // opLog(" NMS1(or)=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" NMS2(1k)=" + std::to_string(timeNormalize2) + "ms"); // Sanity check cudaCheck(__LINE__, __FUNCTION__, __FILE__); diff --git a/src/openpose/net/nmsBaseCL.cpp b/src/openpose/net/nmsBaseCL.cpp index a5f9d4d8..39797c19 100644 --- a/src/openpose/net/nmsBaseCL.cpp +++ b/src/openpose/net/nmsBaseCL.cpp @@ -362,7 +362,7 @@ namespace op // for (auto c = 0; c < channels; c++) // { -// // log("channel: " + std::to_string(c)); +// // opLog("channel: " + std::to_string(c)); // const auto offsetChannel = (n * channels + c); // // CL Data diff --git a/src/openpose/net/resizeAndMergeBase.cu b/src/openpose/net/resizeAndMergeBase.cu index 46fff6a3..594e5193 100644 --- a/src/openpose/net/resizeAndMergeBase.cu +++ b/src/openpose/net/resizeAndMergeBase.cu @@ -365,9 +365,9 @@ namespace op // OP_CUDA_PROFILE_END(timeNormalize3, 1e3, REPS); // // Profiling code - // log(" Res(ori)=" + std::to_string(timeNormalize1) + "ms"); - // log(" Res(new)=" + std::to_string(timeNormalize2) + "ms"); - // log(" Res(new8x)=" + std::to_string(timeNormalize3) + "ms"); + // opLog(" Res(ori)=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" Res(new)=" + std::to_string(timeNormalize2) + "ms"); + // opLog(" Res(new8x)=" + std::to_string(timeNormalize3) + "ms"); } // Old inefficient multi-scale merging else @@ -514,9 +514,9 @@ namespace op // OP_CUDA_PROFILE_END(timeNormalize3, 1e3, REPS); // // Profiling code - // log(" Res(orig)=" + std::to_string(timeNormalize1) + "ms"); - // log(" Res(new4)=" + std::to_string(timeNormalize2) + "ms"); - // log(" Res(new1)=" + std::to_string(timeNormalize3) + "ms"); + // opLog(" Res(orig)=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" Res(new4)=" + std::to_string(timeNormalize2) + "ms"); + // opLog(" Res(new1)=" + std::to_string(timeNormalize3) + "ms"); } cudaCheck(__LINE__, __FUNCTION__, __FILE__); diff --git a/src/openpose/pose/poseExtractorCaffe.cpp b/src/openpose/pose/poseExtractorCaffe.cpp index d5e7c055..b0378e76 100644 --- a/src/openpose/pose/poseExtractorCaffe.cpp +++ b/src/openpose/pose/poseExtractorCaffe.cpp @@ -169,7 +169,7 @@ namespace op if (mEnableNet) { // Logging - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Initialize Caffe net addCaffeNetOnThread( spNets, spCaffeNetOutputBlobs, mPoseModel, mGpuId, @@ -188,7 +188,7 @@ namespace op cudaCheck(__LINE__, __FUNCTION__, __FILE__); #endif // Logging - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #endif } catch (const std::exception& e) @@ -332,10 +332,10 @@ namespace op spBodyPartConnectorCaffe->Forward( {spHeatMapsBlob.get(), spPeaksBlob.get()}, mPoseKeypoints, mPoseScores); // OP_CUDA_PROFILE_END(timeNormalize4, 1e3, REPS); - // log("1(caf)= " + std::to_string(timeNormalize1) + "ms"); - // log("2(res) = " + std::to_string(timeNormalize2) + " ms"); - // log("3(nms) = " + std::to_string(timeNormalize3) + " ms"); - // log("4(bpp) = " + std::to_string(timeNormalize4) + " ms"); + // opLog("1(caf)= " + std::to_string(timeNormalize1) + "ms"); + // opLog("2(res) = " + std::to_string(timeNormalize2) + " ms"); + // opLog("3(nms) = " + std::to_string(timeNormalize3) + " ms"); + // opLog("4(bpp) = " + std::to_string(timeNormalize4) + " ms"); // Re-run on each person if (TOP_DOWN_REFINEMENT) { diff --git a/src/openpose/pose/poseExtractorNet.cpp b/src/openpose/pose/poseExtractorNet.cpp index 033f38ef..83cb12c2 100644 --- a/src/openpose/pose/poseExtractorNet.cpp +++ b/src/openpose/pose/poseExtractorNet.cpp @@ -335,7 +335,7 @@ namespace op try { auto& propertyElement = mProperties.at((int)property); - log("Property " + std::to_string((int)property) + opLog("Property " + std::to_string((int)property) + " set from " + std::to_string(propertyElement) + " to " + std::to_string(value), Priority::High); propertyElement = {value}; diff --git a/src/openpose/pose/poseGpuRenderer.cpp b/src/openpose/pose/poseGpuRenderer.cpp index d65cc095..eb7e26fb 100644 --- a/src/openpose/pose/poseGpuRenderer.cpp +++ b/src/openpose/pose/poseGpuRenderer.cpp @@ -34,7 +34,7 @@ namespace op try { // Free CUDA pointers - Note that if pointers are 0 (i.e., nullptr), no operation is performed. - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); #ifdef USE_CUDA cudaCheck(__LINE__, __FUNCTION__, __FILE__); if (pGpuPose != nullptr) @@ -59,7 +59,7 @@ namespace op } cudaCheck(__LINE__, __FUNCTION__, __FILE__); #endif - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { @@ -71,7 +71,7 @@ namespace op { try { - log("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Starting initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // GPU memory allocation for rendering #ifdef USE_CUDA cudaMalloc((void**)(&pGpuPose), @@ -81,7 +81,7 @@ namespace op cudaMalloc((void**)&pScalePtr, sizeof(float) * POSE_MAX_PEOPLE); cudaCheck(__LINE__, __FUNCTION__, __FILE__); #endif - log("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("Finished initialization on thread.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/src/openpose/pose/renderPose.cu b/src/openpose/pose/renderPose.cu index 2690f101..8c569fc2 100644 --- a/src/openpose/pose/renderPose.cu +++ b/src/openpose/pose/renderPose.cu @@ -693,8 +693,8 @@ namespace op // OP_CUDA_PROFILE_END(timeNormalize1, 1e3, REPS); // // Profiling code - // log(" renderOld=" + std::to_string(timeNormalize0) + "ms"); - // log(" renderNew=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" renderOld=" + std::to_string(timeNormalize0) + "ms"); + // opLog(" renderNew=" + std::to_string(timeNormalize1) + "ms"); } else if (poseModel == PoseModel::COCO_18) renderPoseCoco<<>>( @@ -745,8 +745,8 @@ namespace op // OP_CUDA_PROFILE_END(timeNormalize2, 1e3, REPS); // // Profiling code - // log(" renderOld=" + std::to_string(timeNormalize1) + "ms"); - // log(" renderNew=" + std::to_string(timeNormalize2) + "ms"); + // opLog(" renderOld=" + std::to_string(timeNormalize1) + "ms"); + // opLog(" renderNew=" + std::to_string(timeNormalize2) + "ms"); } else if (poseModel == PoseModel::MPI_15 || poseModel == PoseModel::MPI_15_4) renderPoseMpi29Parts<<>>( diff --git a/src/openpose/producer/datumProducer.cpp b/src/openpose/producer/datumProducer.cpp index 3944703e..df05b1d8 100644 --- a/src/openpose/producer/datumProducer.cpp +++ b/src/openpose/producer/datumProducer.cpp @@ -127,7 +127,7 @@ namespace op // Grey to RGB if required if (inputDataMatrix.channels() == 1) { - log(commonMessage + " Converting grey image into BGR.", Priority::High); + opLog(commonMessage + " Converting grey image into BGR.", Priority::High); cv::Mat inputData = OP_OP2CVMAT(inputDataMatrix); cv::cvtColor(inputData, inputData, CV_GRAY2BGR); // Diferent memory size --> new cv::Mat raw ptr memory --> new Matrix diff --git a/src/openpose/producer/flirReader.cpp b/src/openpose/producer/flirReader.cpp index c1b26f5c..7edaa9d7 100644 --- a/src/openpose/producer/flirReader.cpp +++ b/src/openpose/producer/flirReader.cpp @@ -170,7 +170,7 @@ namespace op return -1.; else { - log("Unknown property.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("Unknown property.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); return -1.; } } @@ -190,11 +190,11 @@ namespace op else if (capProperty == CV_CAP_PROP_FRAME_HEIGHT) mResolution.y = {(int)value}; else if (capProperty == CV_CAP_PROP_POS_FRAMES) - log("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); else if (capProperty == CV_CAP_PROP_FRAME_COUNT || capProperty == CV_CAP_PROP_FPS) - log("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); else - log("Unknown property.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("Unknown property.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/src/openpose/producer/imageDirectoryReader.cpp b/src/openpose/producer/imageDirectoryReader.cpp index b3086282..b44550db 100644 --- a/src/openpose/producer/imageDirectoryReader.cpp +++ b/src/openpose/producer/imageDirectoryReader.cpp @@ -122,7 +122,7 @@ namespace op return -1.; else { - log("Unknown property", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("Unknown property", Priority::Max, __LINE__, __FUNCTION__, __FILE__); return -1.; } } @@ -144,9 +144,9 @@ namespace op else if (capProperty == CV_CAP_PROP_POS_FRAMES) mFrameNameCounter = fastTruncate((long long)value, 0ll, (long long)mFilePaths.size()-1); else if (capProperty == CV_CAP_PROP_FRAME_COUNT || capProperty == CV_CAP_PROP_FPS) - log("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("This property is read-only.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); else - log("Unknown property", Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog("Unknown property", Priority::Max, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) { diff --git a/src/openpose/producer/producer.cpp b/src/openpose/producer/producer.cpp index 314b688e..14052ffc 100644 --- a/src/openpose/producer/producer.cpp +++ b/src/openpose/producer/producer.cpp @@ -188,24 +188,26 @@ namespace op { try { - check(fpsMode == ProducerFpsMode::RetrievalFps || fpsMode == ProducerFpsMode::OriginalFps, - "Unknown ProducerFpsMode.", __LINE__, __FUNCTION__, __FILE__); + checkBool( + fpsMode == ProducerFpsMode::RetrievalFps || fpsMode == ProducerFpsMode::OriginalFps, + "Unknown ProducerFpsMode.", __LINE__, __FUNCTION__, __FILE__); // For webcam, ProducerFpsMode::OriginalFps == ProducerFpsMode::RetrievalFps, since the internal webcam // cache will overwrite frames after it gets full if (mType == ProducerType::Webcam) { mProducerFpsMode = {ProducerFpsMode::RetrievalFps}; if (fpsMode == ProducerFpsMode::OriginalFps) - log("The producer fps mode set to `OriginalFps` (flag `process_real_time` on the demo) is not" + opLog("The producer fps mode set to `OriginalFps` (flag `process_real_time` on the demo) is not" " necessary, it is already assumed for webcam.", Priority::Max, __LINE__, __FUNCTION__, __FILE__); } // If no webcam else { - check(fpsMode == ProducerFpsMode::RetrievalFps || get(CV_CAP_PROP_FPS) > 0, - "Selected to keep the source fps but get(CV_CAP_PROP_FPS) <= 0, i.e., the source did not set" - " its fps property.", __LINE__, __FUNCTION__, __FILE__); + checkBool( + fpsMode == ProducerFpsMode::RetrievalFps || get(CV_CAP_PROP_FPS) > 0, + "Selected to keep the source fps but get(CV_CAP_PROP_FPS) <= 0, i.e., the source did not set" + " its fps property.", __LINE__, __FUNCTION__, __FILE__); mProducerFpsMode = {fpsMode}; } reset(mNumberEmptyFrames, mTrackingFps); @@ -244,15 +246,17 @@ namespace op // Individual checks if (property == ProducerProperty::AutoRepeat) { - check(value != 1. || (mType == ProducerType::ImageDirectory || mType == ProducerType::Video), - "ProducerProperty::AutoRepeat only implemented for ProducerType::ImageDirectory and" - " Video.", __LINE__, __FUNCTION__, __FILE__); + checkBool( + value != 1. || (mType == ProducerType::ImageDirectory || mType == ProducerType::Video), + "ProducerProperty::AutoRepeat only implemented for ProducerType::ImageDirectory and" + " Video.", __LINE__, __FUNCTION__, __FILE__); } else if (property == ProducerProperty::Rotation) { - check(value == 0. || value == 90. || value == 180. || value == 270., - "ProducerProperty::Rotation only implemented for {0, 90, 180, 270} degrees.", - __LINE__, __FUNCTION__, __FILE__); + checkBool( + value == 0. || value == 90. || value == 180. || value == 270., + "ProducerProperty::Rotation only implemented for {0, 90, 180, 270} degrees.", + __LINE__, __FUNCTION__, __FILE__); } else if (property == ProducerProperty::FrameStep) { @@ -281,7 +285,7 @@ namespace op // Process wrong frames if (frame.empty()) { - log("Empty frame detected, frame number " + std::to_string((int)get(CV_CAP_PROP_POS_FRAMES)) + opLog("Empty frame detected, frame number " + std::to_string((int)get(CV_CAP_PROP_POS_FRAMES)) + " of " + std::to_string((int)get(CV_CAP_PROP_FRAME_COUNT)) + ".", Priority::Max, __LINE__, __FUNCTION__, __FILE__); mNumberEmptyFrames++; @@ -294,7 +298,7 @@ namespace op && ((frame.cols() != get(CV_CAP_PROP_FRAME_WIDTH) && get(CV_CAP_PROP_FRAME_WIDTH) > 0) || (frame.rows() != get(CV_CAP_PROP_FRAME_HEIGHT) && get(CV_CAP_PROP_FRAME_HEIGHT) > 0))) { - log("Frame size changed. Returning empty frame.\nExpected vs. received sizes: " + opLog("Frame size changed. Returning empty frame.\nExpected vs. received sizes: " + std::to_string(positiveIntRound(get(CV_CAP_PROP_FRAME_WIDTH))) + "x" + std::to_string(positiveIntRound(get(CV_CAP_PROP_FRAME_HEIGHT))) + " vs. " + std::to_string(frame.cols()) + "x" + std::to_string(frame.rows()), @@ -411,7 +415,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Directory of images if (producerType == ProducerType::ImageDirectory) @@ -453,7 +457,7 @@ namespace op undistortImage); if (webcamReader->isOpened()) { - log("Auto-detecting camera index... Detected and opened camera " + std::to_string(index) + opLog("Auto-detecting camera index... Detected and opened camera " + std::to_string(index) + ".", Priority::High); return webcamReader; } diff --git a/src/openpose/producer/spinnakerWrapper.cpp b/src/openpose/producer/spinnakerWrapper.cpp index 3771a776..fe6ba0c6 100644 --- a/src/openpose/producer/spinnakerWrapper.cpp +++ b/src/openpose/producer/spinnakerWrapper.cpp @@ -72,7 +72,7 @@ namespace op { int result = 0; - log("Printing device information for camera " + std::to_string(camNum) + "...\n", Priority::High); + opLog("Printing device information for camera " + std::to_string(camNum) + "...\n", Priority::High); Spinnaker::GenApi::FeatureList_t features; Spinnaker::GenApi::CCategoryPtr cCategoryPtr = iNodeMap.GetNode("DeviceInformation"); @@ -85,13 +85,13 @@ namespace op { Spinnaker::GenApi::CNodePtr pfeatureNode = *it; const auto cValuePtr = (Spinnaker::GenApi::CValuePtr)pfeatureNode; - log(pfeatureNode->GetName() + " : " + + opLog(pfeatureNode->GetName() + " : " + (IsReadable(cValuePtr) ? cValuePtr->ToString() : "Node not readable"), Priority::High); } } else - log("Device control information not available.", Priority::High); - log(" ", Priority::High); + opLog("Device control information not available.", Priority::High); + opLog(" ", Priority::High); return result; } @@ -135,7 +135,7 @@ namespace op ptrTriggerMode->SetIntValue(ptrTriggerModeOff->GetValue()); - // log("Trigger mode disabled...", Priority::High); + // opLog("Trigger mode disabled...", Priority::High); return result; } @@ -195,9 +195,9 @@ namespace op // std::chrono::high_resolution_clock::now()-begin3 // ).count() * 1e-6; // // Print times - // log("Time (ms) 1: " + std::to_string(durationMs1 / reps), Priority::High); - // log("Time (ms) 2: " + std::to_string(durationMs2 / reps), Priority::High); - // log("Time (ms) 3: " + std::to_string(durationMs3 / reps), Priority::High); + // opLog("Time (ms) 1: " + std::to_string(durationMs1 / reps), Priority::High); + // opLog("Time (ms) 2: " + std::to_string(durationMs2 / reps), Priority::High); + // opLog("Time (ms) 3: " + std::to_string(durationMs3 / reps), Priority::High); // Return right one // ~ 1.3 ms but pixeled @@ -249,9 +249,9 @@ namespace op try { int result = 0; - log("*** CONFIGURING TRIGGER ***", Priority::High); - log("Configuring trigger...", Priority::High); - // log("Configuring hardware trigger...", Priority::High); + opLog("*** CONFIGURING TRIGGER ***", Priority::High); + opLog("Configuring trigger...", Priority::High); + // opLog("Configuring hardware trigger...", Priority::High); // Ensure trigger mode off // *** NOTES *** // The trigger must be disabled in order to configure whether the source @@ -269,7 +269,7 @@ namespace op ptrTriggerMode->SetIntValue(ptrTriggerModeOff->GetValue()); - log("Trigger mode disabled...", Priority::High); + opLog("Trigger mode disabled...", Priority::High); // Select trigger source // *** NOTES *** @@ -288,7 +288,7 @@ namespace op // error("Unable to set trigger mode (enum entry retrieval). Aborting...", // __LINE__, __FUNCTION__, __FILE__); // ptrTriggerSource->SetIntValue(ptrTriggerSourceHardware->GetValue()); - // log("Trigger source set to hardware...", Priority::High); + // opLog("Trigger source set to hardware...", Priority::High); // Set trigger mode to sofware Spinnaker::GenApi::CEnumEntryPtr ptrTriggerSourceSoftware = ptrTriggerSource->GetEntryByName("Software"); @@ -297,7 +297,7 @@ namespace op error("Unable to set trigger mode (enum entry retrieval). Aborting...", __LINE__, __FUNCTION__, __FILE__); ptrTriggerSource->SetIntValue(ptrTriggerSourceSoftware->GetValue()); - // log("Trigger source set to source...", Priority::High); + // opLog("Trigger source set to source...", Priority::High); // Turn trigger mode on // *** LATER *** @@ -314,7 +314,7 @@ namespace op ptrTriggerMode->SetIntValue(ptrTriggerModeOn->GetValue()); - log("Trigger mode turned back on...", Priority::High); + opLog("Trigger mode turned back on...", Priority::High); return result; } @@ -413,7 +413,7 @@ namespace op // // http://docs.opencv.org/2.4/modules/imgproc/doc/geometric_transformations.html#undistort // cv::undistort(cvMatDistorted, mCvMats[i], cameraIntrinsics, cameraDistorsions); // // In OpenCV 2.4, cv::undistort is exactly equal than cv::initUndistortRectifyMap - // (with CV_16SC2) + cv::remap (with LINEAR). I.e., log(cv::norm(cvMatMethod1-cvMatMethod2)) = 0. + // (with CV_16SC2) + cv::remap (with LINEAR). I.e., opLog(cv::norm(cvMatMethod1-cvMatMethod2)) = 0. // Option b - 15 ms / 3 images (LINEAR) or 25 ms (CUBIC) // Distorsion removal - not required and more expensive (applied to the whole image instead of // only to our interest points) @@ -487,7 +487,7 @@ namespace op { if (imagePtr->IsIncomplete()) { - log("Image incomplete with image status " + std::to_string(imagePtr->GetImageStatus()) + opLog("Image incomplete with image status " + std::to_string(imagePtr->GetImageStatus()) + "...", Priority::High, __LINE__, __FUNCTION__, __FILE__); imagesExtracted = false; break; @@ -565,7 +565,7 @@ namespace op { if (imagePtr->IsIncomplete()) { - log("Image incomplete with image status " + std::to_string(imagePtr->GetImageStatus()) + opLog("Image incomplete with image status " + std::to_string(imagePtr->GetImageStatus()) + "...", Priority::High, __LINE__, __FUNCTION__, __FILE__); imagesExtracted = false; break; @@ -674,7 +674,7 @@ namespace op upImpl->mInitialized = true; // Print application build information - log(std::string{ "Application build date: " } + __DATE__ + " " + __TIME__, Priority::High); + opLog(std::string{ "Application build date: " } + __DATE__ + " " + __TIME__, Priority::High); // Retrieve singleton reference to upImpl->mSystemPtr object upImpl->mSystemPtr = Spinnaker::System::GetInstance(); @@ -684,7 +684,7 @@ namespace op const unsigned int numCameras = upImpl->mCameraList.GetSize(); - log("Number of cameras detected: " + std::to_string(numCameras), Priority::High); + opLog("Number of cameras detected: " + std::to_string(numCameras), Priority::High); // Finish if there are no cameras if (numCameras == 0) @@ -695,12 +695,12 @@ namespace op // Release upImpl->mSystemPtr upImpl->mSystemPtr->ReleaseInstance(); - // log("Not enough cameras!\nPress Enter to exit...", Priority::High); + // opLog("Not enough cameras!\nPress Enter to exit...", Priority::High); // getchar(); error("No cameras detected.", __LINE__, __FUNCTION__, __FILE__); } - log("Camera system initialized...", Priority::High); + opLog("Camera system initialized...", Priority::High); // // Retrieve transport layer nodemaps and print device information for @@ -712,7 +712,7 @@ namespace op // serial number. Rather than caching the nodemap, each nodemap is // retrieved both times as needed. // - log("\n*** DEVICE INFORMATION ***\n", Priority::High); + opLog("\n*** DEVICE INFORMATION ***\n", Priority::High); for (auto i = 0u; i < upImpl->mCameraList.GetSize(); i++) { @@ -811,7 +811,7 @@ namespace op ptrAcquisitionMode->SetIntValue(acquisitionModeContinuous); - log("Camera " + std::to_string(i) + " acquisition mode set to continuous...", Priority::High); + opLog("Camera " + std::to_string(i) + " acquisition mode set to continuous...", Priority::High); // Set camera resolution // Retrieve GenICam nodemap @@ -847,26 +847,26 @@ namespace op // Set width Spinnaker::GenApi::CIntegerPtr ptrHeight = iNodeMap.GetNode("Height"); ptrHeight->SetValue(ptrHeightMax->GetValue()); - log("Choosing maximum resolution for flir camera (" + std::to_string(ptrWidth->GetValue()) + opLog("Choosing maximum resolution for flir camera (" + std::to_string(ptrWidth->GetValue()) + " x " + std::to_string(ptrHeight->GetValue()) + ").", Priority::High); } // Begin acquiring images cameraPtr->BeginAcquisition(); - log("Camera " + std::to_string(i) + " started acquiring images...", Priority::High); + opLog("Camera " + std::to_string(i) + " started acquiring images...", Priority::High); } // Retrieve device serial number for filename - log("\nReading (and sorting by) serial numbers...", Priority::High); + opLog("\nReading (and sorting by) serial numbers...", Priority::High); const bool sorted = true; upImpl->mSerialNumbers = getSerialNumbers(upImpl->mCameraList, sorted); const auto& serialNumbers = upImpl->mSerialNumbers; for (auto i = 0u; i < serialNumbers.size(); i++) - log("Camera " + std::to_string(i) + " serial number set to " + opLog("Camera " + std::to_string(i) + " serial number set to " + serialNumbers[i] + "...", Priority::High); if (upImpl->mCameraIndex >= 0) - log("Only using camera index " + std::to_string(upImpl->mCameraIndex) + ", i.e., serial number " + opLog("Only using camera index " + std::to_string(upImpl->mCameraIndex) + ", i.e., serial number " + serialNumbers[upImpl->mCameraIndex] + "...", Priority::High); // Read camera parameters from SN @@ -897,7 +897,7 @@ namespace op upImpl->mResolution = Point{cvMats[0].cols(), cvMats[0].rows()}; const std::string numberCameras = std::to_string(upImpl->mCameraIndex < 0 ? serialNumbers.size() : 1); - log("\nRunning for " + numberCameras + " out of " + std::to_string(serialNumbers.size()) + opLog("\nRunning for " + numberCameras + " out of " + std::to_string(serialNumbers.size()) + " camera(s)...\n\n*** IMAGE ACQUISITION ***\n", Priority::High); } catch (const Spinnaker::Exception& e) @@ -1098,7 +1098,7 @@ namespace op cameraPtr->DeInit(); } - log("FLIR (Point-grey) capture completed. Releasing cameras...", Priority::High); + opLog("FLIR (Point-grey) capture completed. Releasing cameras...", Priority::High); // Clear camera list before releasing upImpl->mSystemPtr upImpl->mCameraList.Clear(); @@ -1109,7 +1109,7 @@ namespace op // Setting the class as released upImpl->mInitialized = false; - log("Cameras released! Exiting program.", Priority::High); + opLog("Cameras released! Exiting program.", Priority::High); } else { diff --git a/src/openpose/producer/videoCaptureReader.cpp b/src/openpose/producer/videoCaptureReader.cpp index 03df9397..cd42f3b7 100644 --- a/src/openpose/producer/videoCaptureReader.cpp +++ b/src/openpose/producer/videoCaptureReader.cpp @@ -167,7 +167,7 @@ namespace op if (upImpl->mVideoCapture.isOpened()) { upImpl->mVideoCapture.release(); - log("cv::VideoCapture released.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("cv::VideoCapture released.", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } } catch (const std::exception& e) diff --git a/src/openpose/producer/webcamReader.cpp b/src/openpose/producer/webcamReader.cpp index 8fbc4b27..c775d71c 100644 --- a/src/openpose/producer/webcamReader.cpp +++ b/src/openpose/producer/webcamReader.cpp @@ -34,7 +34,7 @@ namespace op + std::to_string(mResolution.y) + " could not being set. Final resolution: " + std::to_string(positiveIntRound(get(CV_CAP_PROP_FRAME_WIDTH))) + "x" + std::to_string(positiveIntRound(get(CV_CAP_PROP_FRAME_HEIGHT))) }; - log(logMessage, Priority::Max, __LINE__, __FUNCTION__, __FILE__); + opLog(logMessage, Priority::Max, __LINE__, __FUNCTION__, __FILE__); } } // Set resolution @@ -204,7 +204,7 @@ namespace op { mDisconnectedCounter++; if (mDisconnectedCounter > 1 && opMat.empty()) - log("Camera frame empty (it has occurred for the last " + std::to_string(mDisconnectedCounter) + opLog("Camera frame empty (it has occurred for the last " + std::to_string(mDisconnectedCounter) + " consecutive frames).", Priority::Max); } else @@ -246,7 +246,7 @@ namespace op try { // If unplugged - log("Webcam was unplugged, trying to reconnect it.", Priority::Max); + opLog("Webcam was unplugged, trying to reconnect it.", Priority::Max); // Sleep std::this_thread::sleep_for(std::chrono::milliseconds{1000}); // Reset camera diff --git a/src/openpose/tracking/personTracker.cpp b/src/openpose/tracking/personTracker.cpp index a5880480..26d0aa49 100644 --- a/src/openpose/tracking/personTracker.cpp +++ b/src/openpose/tracking/personTracker.cpp @@ -405,7 +405,7 @@ namespace op { try { - log("Person tracking (`tracking` flag) is in experimental phase. Please, let us know if you" + opLog("Person tracking (`tracking` flag) is in experimental phase. Please, let us know if you" " find any bug on this alpha version.", op::Priority::High); } catch (const std::exception& e) diff --git a/src/openpose/unity/unityBinding.cpp b/src/openpose/unity/unityBinding.cpp index 0896d1d1..99746967 100644 --- a/src/openpose/unity/unityBinding.cpp +++ b/src/openpose/unity/unityBinding.cpp @@ -19,7 +19,7 @@ namespace op bool sUnityOutputEnabled = true; bool sImageOutput = false; - enum class OutputType : uchar + enum class OutputType : unsigned char { None, DatumsInfo, @@ -417,7 +417,7 @@ namespace op try { // Starting - log("Starting OpenPose..."); + opLog("Starting OpenPose..."); // OpenPose wrapper auto spWrapper = std::make_shared(); @@ -446,7 +446,7 @@ namespace op spWrapper->exec(); // Ending - log("OpenPose finished"); + opLog("OpenPose finished"); } catch (const std::exception& e) { @@ -476,7 +476,7 @@ namespace op { if (ptrUserOutput != nullptr) { - log("Stopping..."); + opLog("Stopping..."); ptrUserOutput->stop(); } } diff --git a/src/openpose/utilities/errorAndLog.cpp b/src/openpose/utilities/errorAndLog.cpp index 899c308b..9a498b06 100644 --- a/src/openpose/utilities/errorAndLog.cpp +++ b/src/openpose/utilities/errorAndLog.cpp @@ -48,7 +48,7 @@ namespace op #endif } - void log(const std::string& message) { DebugInUnity(message, 0); } + void opLog(const std::string& message) { DebugInUnity(message, 0); } void logWarning(const std::string& message) { DebugInUnity(message, 1); } void logError(const std::string& message) { DebugInUnity(message, -1); } } @@ -295,8 +295,9 @@ namespace op errorAux(3, message, line, function, file); } - void log(const std::string& message, const Priority priority, const int line, const std::string& function, - const std::string& file) + void opLog( + const std::string& message, const Priority priority, const int line, const std::string& function, + const std::string& file) { if (priority >= ConfigureLog::getPriorityThreshold()) { @@ -312,7 +313,7 @@ namespace op // Unity log #ifdef USE_UNITY_SUPPORT - UnityDebugger::log(infoMessage); + UnityDebugger::opLog(infoMessage); #endif } } diff --git a/src/openpose/utilities/flagsToOpenPose.cpp b/src/openpose/utilities/flagsToOpenPose.cpp index dc94e166..839615b9 100644 --- a/src/openpose/utilities/flagsToOpenPose.cpp +++ b/src/openpose/utilities/flagsToOpenPose.cpp @@ -8,7 +8,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (poseModeInt >= 0 && poseModeInt < (int)PoseMode::Size) return (PoseMode)poseModeInt; else @@ -29,7 +29,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Body pose if (poseModeString == "BODY_25") return PoseModel::BODY_25; @@ -78,7 +78,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (keypointScaleMode == 0) return ScaleMode::InputResolution; else if (keypointScaleMode == 1) @@ -107,7 +107,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (heatMapScaleMode == 0) return ScaleMode::PlusMinusOne; else if (heatMapScaleMode == 1) @@ -133,7 +133,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); if (detector >= 0 && detector < (int)Detector::Size) return (Detector)detector; else @@ -156,7 +156,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Avoid duplicates (e.g., selecting at the time camera & video) if (int(!imageDirectory.empty()) + int(!videoPath.empty()) + int(webcamIndex > 0) + int(flirCamera) + int(!ipCameraPath.empty()) > 1) @@ -193,7 +193,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); const auto type = flagsToProducerType(imageDirectory, videoPath, ipCameraPath, webcamIndex, flirCamera); if (type == ProducerType::ImageDirectory) @@ -312,8 +312,9 @@ namespace op { Point point; const auto nRead = sscanf(pointString.c_str(), "%dx%d", &point.x, &point.y); - checkE(nRead, 2, "Invalid resolution format: `" + pointString + "`, it should be e.g., `" + pointExample - + "`.", __LINE__, __FUNCTION__, __FILE__); + checkEqual( + nRead, 2, "Invalid resolution format: `" + pointString + "`, it should be e.g., `" + pointExample + + "`.", __LINE__, __FUNCTION__, __FILE__); return point; } catch (const std::exception& e) diff --git a/src/openpose/utilities/profiler.cpp b/src/openpose/utilities/profiler.cpp index 5dcba798..5bf0f98f 100644 --- a/src/openpose/utilities/profiler.cpp +++ b/src/openpose/utilities/profiler.cpp @@ -46,7 +46,7 @@ namespace op try { const auto message = firstMessage + std::to_string(getTimeSeconds(timerInit)) + secondMessage; - op::log(message, priority); + op::opLog(message, priority); } catch (const std::exception& e) { @@ -70,7 +70,7 @@ namespace op const std::string& function, const std::string& file) { const auto stringMessage = std::to_string( timePast / timeCounter / 1e6 ) + " msec"; - log(stringMessage, Priority::Max, line, function, file); + opLog(stringMessage, Priority::Max, line, function, file); } #endif @@ -189,13 +189,13 @@ namespace op { #ifdef PROFILER_ENABLED // Print line-function-file info - log("GPU usage.", Priority::Max, line, function, file); + opLog("GPU usage.", Priority::Max, line, function, file); // GPU info const auto nvidiaCommand = std::system("nvidia-smi | grep \"Processes:\"") | std::system("nvidia-smi | grep \"Process name\""); if (nvidiaCommand != 0) - log("Error on the nvidia-smi header. Please, inform us of this error.", Priority::Max); + opLog("Error on the nvidia-smi header. Please, inform us of this error.", Priority::Max); else { // Print GPU usage or empty otherwise @@ -203,9 +203,9 @@ namespace op const std::string getGpuMemoryCommand{"nvidia-smi | grep \"" + file.substr(0, file.size() - 3) + "\""}; const auto answer = std::system(getGpuMemoryCommand.c_str()); if (answer == 256) - log("Not used at all.", Priority::Max); + opLog("Not used at all.", Priority::Max); else if (answer != 0) - log("Bash error: " + std::to_string(answer), Priority::Max); + opLog("Bash error: " + std::to_string(answer), Priority::Max); } #else UNUSED(line); diff --git a/src/openpose/wrapper/wrapperAuxiliary.cpp b/src/openpose/wrapper/wrapperAuxiliary.cpp index 070310da..4d001773 100644 --- a/src/openpose/wrapper/wrapperAuxiliary.cpp +++ b/src/openpose/wrapper/wrapperAuxiliary.cpp @@ -14,7 +14,7 @@ namespace op { try { - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); // Check no wrong/contradictory flags enabled if (wrapperStructPose.alphaKeypoint < 0. || wrapperStructPose.alphaKeypoint > 1. @@ -28,7 +28,7 @@ namespace op { const auto message = "In order to save the rendered frames (`--write_images` or `--write_video`), you" " cannot disable `--render_pose`."; - log(message, Priority::High); + opLog(message, Priority::High); } if (!wrapperStructOutput.writeHeatMaps.empty() && wrapperStructPose.heatMapTypes.empty()) { @@ -91,14 +91,14 @@ namespace op " remove the display (set `--display 0` or `--no_gui_verbose`). If you" " simply want to use OpenPose to record video/images without keypoints, you" " only need to set `--num_gpu 0`." + additionalMessage; - log(message, Priority::High); + opLog(message, Priority::High); } if (wrapperStructInput.realTimeProcessing && savingSomething) { const auto message = "Real time processing is enabled as well as some writing function. Thus, some" " frames might be skipped. Consider disabling real time processing if you" " intend to save any results."; - log(message, Priority::High); + opLog(message, Priority::High); } } if (!wrapperStructOutput.writeVideo.empty() && producerSharedPtr == nullptr) @@ -124,7 +124,7 @@ namespace op " `--hand_detector`.", __LINE__, __FUNCTION__, __FILE__); // Warning if (ownDetectorProvided && wrapperStructPose.poseMode != PoseMode::Disabled) - log("Warning: Body keypoint estimation is enabled while you have also selected to provide your own" + opLog("Warning: Body keypoint estimation is enabled while you have also selected to provide your own" " face and/or hand rectangle detections (`face_detector 2` and/or `hand_detector 2`). Therefore," " OpenPose will not detect face and/or hand keypoints based on the body keypoints. Are you sure" " you want to keep enabled the body keypoint detector? (disable it with `--body 0`).", @@ -163,7 +163,7 @@ namespace op { wrapperStructPose.netInputSize.x = 656; wrapperStructPose.netInputSize.y = 368; - log("The default dynamic `--net_resolution` is not supported in MKL (MKL CPU Caffe) and OpenCL" + opLog("The default dynamic `--net_resolution` is not supported in MKL (MKL CPU Caffe) and OpenCL" " Caffe versions. Please, use a static `net_resolution` (recommended" " `--net_resolution 656x368`) or use the Caffe CUDA master branch when processing images" " and/or when using your custom image reader. OpenPose has automatically set the resolution" @@ -171,7 +171,7 @@ namespace op } #endif #ifndef USE_CUDA - log("---------------------------------- WARNING ----------------------------------\n" + opLog("---------------------------------- WARNING ----------------------------------\n" "We have introduced an additional boost in accuracy in the CUDA version of about 0.2% with" " respect to the CPU/OpenCL versions. We will not port this to CPU given the considerable slow" " down in speed it would add to it. Nevertheless, this accuracy boost is almost insignificant so" @@ -180,7 +180,7 @@ namespace op Priority::High); #endif - log("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); + opLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__); } catch (const std::exception& e) {