[ADD] static camera instance
This commit is contained in:
@@ -8,10 +8,10 @@
|
||||
#include "SkinDetector.h"
|
||||
#include "FaceDetector.h"
|
||||
#include "FingerCount.h"
|
||||
#include "async/StaticCameraInstance.h"
|
||||
|
||||
namespace computervision
|
||||
{
|
||||
cv::VideoCapture cap(0);
|
||||
|
||||
cv::Mat img, imgGray, img2, img2Gray, img3, img4;
|
||||
|
||||
@@ -24,6 +24,8 @@ namespace computervision
|
||||
FaceDetector faceDetector;
|
||||
FingerCount fingerCount;
|
||||
|
||||
cv::VideoCapture cap = computervision_async::getCap();
|
||||
|
||||
ObjectDetection::ObjectDetection()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ namespace computervision
|
||||
*/
|
||||
bool drawHandMaskRect(cv::Mat *input);
|
||||
|
||||
|
||||
cv::VideoCapture getCap();
|
||||
|
||||
};
|
||||
|
||||
12
src/computervision/async/StaticCameraInstance.h
Normal file
12
src/computervision/async/StaticCameraInstance.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <opencv2/videoio.hpp>
|
||||
|
||||
namespace static_camera
|
||||
{
|
||||
|
||||
static cv::VideoCapture getCap()
|
||||
{
|
||||
static cv::VideoCapture cap(0);
|
||||
return cap;
|
||||
}
|
||||
};
|
||||
@@ -21,12 +21,12 @@ namespace computervision
|
||||
|
||||
auto lambda = [](std::function<void(std::vector<Point>)> f, cv::VideoCapture c, OpenPoseVideo op) {
|
||||
std::cout << "STARTING THREAD LAMBDA" << std::endl;
|
||||
cv::VideoCapture cap(0);
|
||||
cv::VideoCapture cap = computervision_async::getCap();
|
||||
|
||||
if (!cap.isOpened())
|
||||
{
|
||||
std::cout << "error opening video" << std::endl;
|
||||
return;
|
||||
std::cout << "capture was closed, opening..." << std::endl;
|
||||
cap.open(0);
|
||||
}
|
||||
|
||||
while (true)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <opencv2/videoio.hpp>
|
||||
#include <functional>
|
||||
#include "../OpenPoseVideo.h"
|
||||
#include "StaticCameraInstance.h"
|
||||
|
||||
|
||||
namespace computervision
|
||||
|
||||
@@ -85,8 +85,6 @@ int main(void)
|
||||
cv::Mat cameraFrame;
|
||||
|
||||
|
||||
//openPoseVideo.setup();
|
||||
|
||||
computervision::AsyncArmDetection as;
|
||||
as.start(retrieve_points, objDetect.getCap(),openPoseVideo);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user