Develop into master #9

Merged
SemvdH merged 126 commits from develop into main 2021-06-18 15:56:41 +00:00
3 changed files with 22 additions and 22 deletions
Showing only changes of commit ab30c41bee - Show all commits

View File

@@ -24,7 +24,7 @@ namespace computervision
FaceDetector faceDetector; FaceDetector faceDetector;
FingerCount fingerCount; FingerCount fingerCount;
cv::VideoCapture cap = computervision_async::getCap(); cv::VideoCapture cap = static_camera::getCap();
ObjectDetection::ObjectDetection() ObjectDetection::ObjectDetection()
{ {

View File

@@ -11,17 +11,10 @@ namespace computervision
} }
void AsyncArmDetection::run_arm_detection() void AsyncArmDetection::run_arm_detection(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op)
{ {
}
void AsyncArmDetection::start(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op)
{
auto lambda = [](std::function<void(std::vector<Point>)> f, cv::VideoCapture c, OpenPoseVideo op) {
std::cout << "STARTING THREAD LAMBDA" << std::endl; std::cout << "STARTING THREAD LAMBDA" << std::endl;
cv::VideoCapture cap = computervision_async::getCap(); /*cv::VideoCapture cap = static_camera::getCap();*/
if (!cap.isOpened()) if (!cap.isOpened())
{ {
@@ -33,11 +26,18 @@ namespace computervision
{ {
Mat img; Mat img;
cap.read(img); cap.read(img);
op.movementSkeleton(img, f); op.movementSkeleton(img, points_ready_func);
} }
}; }
void AsyncArmDetection::start(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op)
{
std::cout << "starting function" << std::endl; std::cout << "starting function" << std::endl;
std::thread async_arm_detect_thread(lambda, points_ready_func, cap, op);
std::thread async_arm_detect_thread(&AsyncArmDetection::run_arm_detection,this, points_ready_func, cap, op);
async_arm_detect_thread.detach(); // makes sure the thread is detached from the variable.
} }
} }

View File

@@ -17,7 +17,7 @@ namespace computervision
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::VideoCapture cap, computervision::OpenPoseVideo op);
private: private:
void run_arm_detection(); void run_arm_detection(std::function<void(std::vector<Point>)> points_ready_func, cv::VideoCapture cap, OpenPoseVideo op);
}; };
} }