mirror of
https://github.com/gosticks/openpose.git
synced 2026-08-12 20:30:20 +00:00
OpenCV (so all 3rdparty deps) removed from headers
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
// ----------------------------- OpenPose C++ API Tutorial - Example 1 - Body from image -----------------------------
|
||||
// It reads an image, process it, and displays it with the pose keypoints.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_POSE
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -26,7 +28,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -99,7 +102,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Process and display image
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
auto datumProcessed = opWrapper.emplaceAndPop(imageToProcess);
|
||||
if (datumProcessed != nullptr)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// -------------------------- OpenPose C++ API Tutorial - Example 2 - Whole body from image --------------------------
|
||||
// It reads an image, process it, and displays it with the pose, hand, and face keypoints.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_POSE
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -26,7 +28,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -81,7 +84,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Process and display image
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
auto datumProcessed = opWrapper.emplaceAndPop(imageToProcess);
|
||||
if (datumProcessed != nullptr)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// It reads an image, process it, and displays it with the pose (and optionally hand and face) keypoints. In addition,
|
||||
// it includes all the OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -28,7 +30,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -165,7 +168,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Process and display image
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
auto datumProcessed = opWrapper.emplaceAndPop(imageToProcess);
|
||||
if (datumProcessed != nullptr)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// It reads images, process them, and display them with the pose (and optionally hand and face) keypoints. In addition,
|
||||
// it includes all the OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -28,7 +30,8 @@ bool display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
}
|
||||
else
|
||||
op::log("Nullptr or empty datumsPtr found.", op::Priority::High);
|
||||
@@ -172,7 +175,8 @@ int tutorialApiCpp()
|
||||
// Process and display images
|
||||
for (const auto& imagePath : imagePaths)
|
||||
{
|
||||
const auto imageToProcess = cv::imread(imagePath);
|
||||
const cv::Mat cvImageToProcess = cv::imread(imagePath);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
auto datumProcessed = opWrapper.emplaceAndPop(imageToProcess);
|
||||
if (datumProcessed != nullptr)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// It reads images, process them, and display them with the pose (and optionally hand and face) keypoints. In addition,
|
||||
// it includes all the OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -34,7 +36,8 @@ bool display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
}
|
||||
else
|
||||
op::log("Nullptr or empty datumsPtr found.", op::Priority::High);
|
||||
@@ -199,7 +202,8 @@ int tutorialApiCpp()
|
||||
{
|
||||
const auto& imagePath = imagePaths.at(imageId);
|
||||
// Faster alternative that moves imageToProcess
|
||||
auto imageToProcess = cv::imread(imagePath);
|
||||
cv::Mat cvImageToProcess = cv::imread(imagePath);
|
||||
op::Matrix imageToProcess = OP_CV2OPMAT(cvImageToProcess);
|
||||
opWrapper.waitAndEmplace(imageToProcess);
|
||||
// // Slower but safer alternative that copies imageToProcess
|
||||
// const auto imageToProcess = cv::imread(imagePath);
|
||||
@@ -245,7 +249,8 @@ int tutorialApiCpp()
|
||||
for (const auto& imagePath : imagePaths)
|
||||
{
|
||||
// Faster alternative that moves imageToProcess
|
||||
auto imageToProcess = cv::imread(imagePath);
|
||||
cv::Mat cvImageToProcess = cv::imread(imagePath);
|
||||
op::Matrix imageToProcess = OP_CV2OPMAT(cvImageToProcess);
|
||||
opWrapper.waitAndEmplace(imageToProcess);
|
||||
// // Slower but safer alternative that copies imageToProcess
|
||||
// const auto imageToProcess = cv::imread(imagePath);
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
// Output: OpenPose face keypoint detection.
|
||||
// NOTE: This demo is auto-selecting the following flags: `--body 0 --face --face_detector 2`
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -31,7 +33,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -173,7 +176,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Read image and face rectangle locations
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
const std::vector<op::Rectangle<float>> faceRectangles{
|
||||
op::Rectangle<float>{330.119385f, 277.532715f, 48.717274f, 48.717274f}, // Face of person 0
|
||||
op::Rectangle<float>{24.036991f, 267.918793f, 65.175171f, 65.175171f}, // Face of person 1
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
// Output: OpenPose hand keypoint detection.
|
||||
// NOTE: This demo is auto-selecting the following flags: `--body 0 --hand --hand_detector 2`
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -31,7 +33,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -173,7 +176,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Read image and hand rectangle locations
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
const std::vector<std::array<op::Rectangle<float>, 2>> handRectangles{
|
||||
// Left/Right hands of person 0
|
||||
std::array<op::Rectangle<float>, 2>{
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// It reads an image, process it, and displays it with the body heatmaps. In addition, it includes all the
|
||||
// OpenPose configuration flags (enable/disable hand, face, output saving, etc.).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -203,7 +205,8 @@ int tutorialApiCpp()
|
||||
opWrapper.start();
|
||||
|
||||
// Process and display image
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
auto datumProcessed = opWrapper.emplaceAndPop(imageToProcess);
|
||||
if (datumProcessed != nullptr)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
// its internal network, or it will lead to core dumped (segmentation) errors. You can modify the pose
|
||||
// estimation flags to match the dimension of both elements (e.g., `--net_resolution`, `--scale_number`, etc.).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -31,7 +33,8 @@ void display(const std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& dat
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
cv::waitKey(0);
|
||||
}
|
||||
else
|
||||
@@ -159,7 +162,8 @@ int tutorialApiCpp()
|
||||
const auto opTimer = op::getTimerInit();
|
||||
|
||||
// Image to process
|
||||
const auto imageToProcess = cv::imread(FLAGS_image_path);
|
||||
const cv::Mat cvImageToProcess = cv::imread(FLAGS_image_path);
|
||||
const op::Matrix imageToProcess = OP_CV2OPCONSTMAT(cvImageToProcess);
|
||||
|
||||
// Required flags to disable the OpenPose network
|
||||
FLAGS_body = 2;
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// In this function, the user can implement its own way to create frames (e.g., reading his own folder of images)
|
||||
// and emplaces/pushes the frames to OpenPose.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -49,7 +51,8 @@ public:
|
||||
datumPtr = std::make_shared<op::Datum>();
|
||||
|
||||
// Fill datum
|
||||
datumPtr->cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
const cv::Mat cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
datumPtr->cvInputData = OP_CV2OPCONSTMAT(cvInputData);
|
||||
|
||||
// If empty frame -> return nullptr
|
||||
if (datumPtr->cvInputData.empty())
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
// Asynchronous mode: ideal for fast prototyping when performance is not an issue.
|
||||
// In this function, the user can implement its own way to render/display/storage the results.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -24,8 +26,9 @@ public:
|
||||
// datumPtr->poseKeypoints: Array<float> with the estimated pose
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
}
|
||||
else
|
||||
op::log("Nullptr or empty datumsPtr found.", op::Priority::High);
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// In this function, the user can implement its own way to create frames (e.g., reading his own folder of images)
|
||||
// and its own way to render/display them after being processed by OpenPose.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -66,7 +68,8 @@ public:
|
||||
datumPtr = std::make_shared<UserDatum>();
|
||||
|
||||
// Fill datum
|
||||
datumPtr->cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
const cv::Mat cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
datumPtr->cvInputData = OP_CV2OPCONSTMAT(cvInputData);
|
||||
|
||||
// If empty frame -> return nullptr
|
||||
if (datumPtr->cvInputData.empty())
|
||||
@@ -106,7 +109,8 @@ public:
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
}
|
||||
else
|
||||
op::log("Nullptr or empty datumsPtr found.", op::Priority::High);
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// performance.
|
||||
// In this function, the user can implement its own way to create frames (e.g., reading his own folder of images).
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -53,7 +55,8 @@ public:
|
||||
datumPtr = std::make_shared<op::Datum>();
|
||||
|
||||
// Fill datum
|
||||
datumPtr->cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
const cv::Mat cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
datumPtr->cvInputData = OP_CV2OPCONSTMAT(cvInputData);
|
||||
|
||||
// If empty frame -> return nullptr
|
||||
if (datumPtr->cvInputData.empty())
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
// In this function, the user can implement its own pre-processing, i.e., his function will be called after the image
|
||||
// has been read by OpenPose but before OpenPose processes the frames.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
#include <openpose/headers.hpp>
|
||||
@@ -22,13 +24,18 @@ public:
|
||||
|
||||
void work(std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& datumsPtr)
|
||||
{
|
||||
// User's pre-processing (after OpenPose read the input image & before OpenPose processing) here
|
||||
// datumPtr->cvInputData: input frame
|
||||
try
|
||||
{
|
||||
// User's pre-processing (after OpenPose read the input image & before OpenPose processing) here
|
||||
// datumPtr->cvInputData: input frame
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
for (auto& datumPtr : *datumsPtr)
|
||||
cv::bitwise_not(datumPtr->cvOutputData, datumPtr->cvOutputData);
|
||||
{
|
||||
cv::Mat cvOutputData = OP_OP2CVMAT(datumPtr->cvOutputData);
|
||||
cv::bitwise_not(cvOutputData, cvOutputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
// In this function, the user can implement its own post-processing, i.e., his function will be called after OpenPose
|
||||
// has processed the frames but before saving or visualizing any result.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
#include <openpose/headers.hpp>
|
||||
@@ -22,14 +24,19 @@ public:
|
||||
|
||||
void work(std::shared_ptr<std::vector<std::shared_ptr<op::Datum>>>& datumsPtr)
|
||||
{
|
||||
// User's post-processing (after OpenPose processing & before OpenPose outputs) here
|
||||
// datumPtr->cvOutputData: rendered frame with pose or heatmaps
|
||||
// datumPtr->poseKeypoints: Array<float> with the estimated pose
|
||||
try
|
||||
{
|
||||
// User's post-processing (after OpenPose processing & before OpenPose outputs) here
|
||||
// datumPtr->cvOutputData: rendered frame with pose or heatmaps
|
||||
// datumPtr->poseKeypoints: Array<float> with the estimated pose
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
for (auto& datumPtr : *datumsPtr)
|
||||
cv::bitwise_not(datumPtr->cvOutputData, datumPtr->cvOutputData);
|
||||
{
|
||||
cv::Mat cvOutputData = OP_OP2CVMAT(datumPtr->cvOutputData);
|
||||
cv::bitwise_not(cvOutputData, cvOutputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
// performance.
|
||||
// In this function, the user can implement its own way to render/display/storage the results.
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
// OpenPose dependencies
|
||||
@@ -79,7 +81,8 @@ public:
|
||||
if (!FLAGS_no_display)
|
||||
{
|
||||
// Display rendered output image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
const char key = (char)cv::waitKey(1);
|
||||
if (key == 27)
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
// function will be called after OpenPose has processed the frames but before saving), visualizing any result
|
||||
// render/display/storage the results, and use their custom Datum structure
|
||||
|
||||
// Command-line user intraface
|
||||
// Third-party dependencies
|
||||
#include <opencv2/opencv.hpp>
|
||||
// Command-line user interface
|
||||
#define OPENPOSE_FLAGS_DISABLE_PRODUCER
|
||||
#define OPENPOSE_FLAGS_DISABLE_DISPLAY
|
||||
#include <openpose/flags.hpp>
|
||||
@@ -72,7 +74,8 @@ public:
|
||||
datumPtr = std::make_shared<UserDatum>();
|
||||
|
||||
// Fill datum
|
||||
datumPtr->cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
const cv::Mat cvInputData = cv::imread(mImageFiles.at(mCounter++));
|
||||
datumPtr->cvInputData = OP_CV2OPCONSTMAT(cvInputData);
|
||||
|
||||
// If empty frame -> return nullptr
|
||||
if (datumPtr->cvInputData.empty())
|
||||
@@ -112,14 +115,19 @@ public:
|
||||
|
||||
void work(std::shared_ptr<std::vector<std::shared_ptr<UserDatum>>>& datumsPtr)
|
||||
{
|
||||
// User's post-processing (after OpenPose processing & before OpenPose outputs) here
|
||||
// datumPtr->cvOutputData: rendered frame with pose or heatmaps
|
||||
// datumPtr->poseKeypoints: Array<float> with the estimated pose
|
||||
try
|
||||
{
|
||||
// User's post-processing (after OpenPose processing & before OpenPose outputs) here
|
||||
// datumPtr->cvOutputData: rendered frame with pose or heatmaps
|
||||
// datumPtr->poseKeypoints: Array<float> with the estimated pose
|
||||
if (datumsPtr != nullptr && !datumsPtr->empty())
|
||||
{
|
||||
for (auto& datumPtr : *datumsPtr)
|
||||
cv::bitwise_not(datumPtr->cvOutputData, datumPtr->cvOutputData);
|
||||
{
|
||||
cv::Mat cvOutputData = OP_OP2CVMAT(datumPtr->cvOutputData);
|
||||
cv::bitwise_not(cvOutputData, cvOutputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@@ -194,7 +202,8 @@ public:
|
||||
if (!FLAGS_no_display)
|
||||
{
|
||||
// Display rendered output image
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", datumsPtr->at(0)->cvOutputData);
|
||||
const cv::Mat cvMat = OP_OP2CVCONSTMAT(datumsPtr->at(0)->cvOutputData);
|
||||
cv::imshow(OPEN_POSE_NAME_AND_VERSION + " - Tutorial C++ API", cvMat);
|
||||
// Display image and sleeps at least 1 ms (it usually sleeps ~5-10 msec to display the image)
|
||||
const char key = (char)cv::waitKey(1);
|
||||
if (key == 27)
|
||||
|
||||
Reference in New Issue
Block a user