mirror of
https://github.com/gosticks/openpose.git
synced 2026-08-12 20:30:20 +00:00
Renamed check(), log() and dLog() to avoid 3rd-party function name redefinitions
This commit is contained in:
@@ -33,7 +33,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
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);
|
||||
|
||||
@@ -33,7 +33,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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);
|
||||
|
||||
@@ -35,7 +35,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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);
|
||||
|
||||
@@ -34,7 +34,7 @@ bool display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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
|
||||
|
||||
@@ -40,7 +40,7 @@ bool display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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<long long>::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<std::vector<std::shared_ptr<op::Datum>>> 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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
|
||||
|
||||
@@ -38,7 +38,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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
|
||||
|
||||
@@ -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<std::vector<std::shared_ptr<op::Datum>
|
||||
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);
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& 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<std::vector<std::shared_ptr<op::Datum>
|
||||
// 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<UserDatum>& 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<UserDatum>& 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<UserDatum> 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<UserDatum>& 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<UserDatum>& 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<UserDatum> 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
|
||||
|
||||
Reference in New Issue
Block a user