[FIX] showing of pose detection points
This commit is contained in:
@@ -44,7 +44,7 @@ namespace computervision
|
||||
net = readNetFromCaffe(protoFile, weightsFile);
|
||||
}
|
||||
|
||||
void OpenPoseVideo::movementSkeleton(Mat inputImage, std::function<void(std::vector<Point>)> f) {
|
||||
void OpenPoseVideo::movementSkeleton(Mat inputImage, std::function<void(std::vector<Point>,cv::Mat poinst_on_image)> f) {
|
||||
std::cout << "movement skeleton start" << std::endl;
|
||||
|
||||
int inWidth = 368;
|
||||
@@ -60,7 +60,7 @@ namespace computervision
|
||||
|
||||
frame = inputImage;
|
||||
Mat inpBlob = blobFromImage(frame, 1.0 / 255, Size(inWidth, inHeight), Scalar(0, 0, 0), false, false);
|
||||
|
||||
|
||||
std::cout << "done reading image and blob" << std::endl;
|
||||
|
||||
net.setInput(inpBlob);
|
||||
@@ -96,9 +96,10 @@ namespace computervision
|
||||
}
|
||||
|
||||
cv::putText(frame, cv::format("time taken = %.2f sec", t), cv::Point(50, 50), cv::FONT_HERSHEY_COMPLEX, .8, cv::Scalar(255, 50, 0), 2);
|
||||
// imshow("Output-Keypoints", frameCopy);
|
||||
imshow("Output-Skeleton", frame);
|
||||
std::cout << "time taken: " << t << std::endl;
|
||||
//imshow("Output-Keypoints", frame);
|
||||
//imshow("Output-Skeleton", frame);
|
||||
std::cout << "about to call points receiving method" << std::endl;
|
||||
f(points);
|
||||
f(points,frame);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ namespace computervision
|
||||
private:
|
||||
|
||||
public:
|
||||
void movementSkeleton(Mat inputImage,std::function<void(std::vector<Point>)> f);
|
||||
void movementSkeleton(Mat inputImage,std::function<void(std::vector<Point>, cv::Mat poinst_on_image)> f);
|
||||
void setup();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "async_arm_detection.h"
|
||||
#include "../OpenPoseVideo.h"
|
||||
#include <thread>
|
||||
#include "StaticCameraInstance.h"
|
||||
|
||||
|
||||
namespace computervision
|
||||
@@ -11,8 +12,10 @@ namespace computervision
|
||||
|
||||
}
|
||||
|
||||
void AsyncArmDetection::run_arm_detection(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op)
|
||||
void AsyncArmDetection::run_arm_detection(std::function<void(std::vector<Point>, cv::Mat poinst_on_image)> points_ready_func, OpenPoseVideo op)
|
||||
{
|
||||
VideoCapture cap = static_camera::getCap();
|
||||
|
||||
std::cout << "STARTING THREAD LAMBDA" << std::endl;
|
||||
/*cv::VideoCapture cap = static_camera::getCap();*/
|
||||
|
||||
@@ -30,13 +33,13 @@ namespace computervision
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncArmDetection::start(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op)
|
||||
void AsyncArmDetection::start(std::function<void(std::vector<Point>, cv::Mat poinst_on_image)> points_ready_func, OpenPoseVideo op)
|
||||
{
|
||||
|
||||
std::cout << "starting function" << std::endl;
|
||||
|
||||
|
||||
std::thread async_arm_detect_thread(&AsyncArmDetection::run_arm_detection,this, points_ready_func, cap, op);
|
||||
std::thread async_arm_detect_thread(&AsyncArmDetection::run_arm_detection,this, points_ready_func, op);
|
||||
|
||||
async_arm_detect_thread.detach(); // makes sure the thread is detached from the variable.
|
||||
}
|
||||
|
||||
@@ -15,9 +15,9 @@ namespace computervision
|
||||
AsyncArmDetection(void);
|
||||
|
||||
|
||||
void start(std::function<void(std::vector<cv::Point>)>, cv::VideoCapture cap, computervision::OpenPoseVideo op);
|
||||
void start(std::function<void(std::vector<cv::Point>, cv::Mat poinst_on_image)>, computervision::OpenPoseVideo op);
|
||||
private:
|
||||
void run_arm_detection(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op);
|
||||
void run_arm_detection(std::function<void(std::vector<Point>, cv::Mat poinst_on_image)> points_ready_func, OpenPoseVideo op);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user