[ADD] static camera instance
This commit is contained in:
@@ -8,10 +8,10 @@
|
|||||||
#include "SkinDetector.h"
|
#include "SkinDetector.h"
|
||||||
#include "FaceDetector.h"
|
#include "FaceDetector.h"
|
||||||
#include "FingerCount.h"
|
#include "FingerCount.h"
|
||||||
|
#include "async/StaticCameraInstance.h"
|
||||||
|
|
||||||
namespace computervision
|
namespace computervision
|
||||||
{
|
{
|
||||||
cv::VideoCapture cap(0);
|
|
||||||
|
|
||||||
cv::Mat img, imgGray, img2, img2Gray, img3, img4;
|
cv::Mat img, imgGray, img2, img2Gray, img3, img4;
|
||||||
|
|
||||||
@@ -24,6 +24,8 @@ namespace computervision
|
|||||||
FaceDetector faceDetector;
|
FaceDetector faceDetector;
|
||||||
FingerCount fingerCount;
|
FingerCount fingerCount;
|
||||||
|
|
||||||
|
cv::VideoCapture cap = computervision_async::getCap();
|
||||||
|
|
||||||
ObjectDetection::ObjectDetection()
|
ObjectDetection::ObjectDetection()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ namespace computervision
|
|||||||
*/
|
*/
|
||||||
bool drawHandMaskRect(cv::Mat *input);
|
bool drawHandMaskRect(cv::Mat *input);
|
||||||
|
|
||||||
|
|
||||||
cv::VideoCapture getCap();
|
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) {
|
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(0);
|
cv::VideoCapture cap = computervision_async::getCap();
|
||||||
|
|
||||||
if (!cap.isOpened())
|
if (!cap.isOpened())
|
||||||
{
|
{
|
||||||
std::cout << "error opening video" << std::endl;
|
std::cout << "capture was closed, opening..." << std::endl;
|
||||||
return;
|
cap.open(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <opencv2/videoio.hpp>
|
#include <opencv2/videoio.hpp>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include "../OpenPoseVideo.h"
|
#include "../OpenPoseVideo.h"
|
||||||
|
#include "StaticCameraInstance.h"
|
||||||
|
|
||||||
|
|
||||||
namespace computervision
|
namespace computervision
|
||||||
|
|||||||
@@ -85,8 +85,6 @@ int main(void)
|
|||||||
cv::Mat cameraFrame;
|
cv::Mat cameraFrame;
|
||||||
|
|
||||||
|
|
||||||
//openPoseVideo.setup();
|
|
||||||
|
|
||||||
computervision::AsyncArmDetection as;
|
computervision::AsyncArmDetection as;
|
||||||
as.start(retrieve_points, objDetect.getCap(),openPoseVideo);
|
as.start(retrieve_points, objDetect.getCap(),openPoseVideo);
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="src\computervision\async\async_arm_detection.h" />
|
<ClInclude Include="src\computervision\async\async_arm_detection.h" />
|
||||||
|
<ClInclude Include="src\computervision\async\StaticCameraInstance.h" />
|
||||||
<ClInclude Include="src\computervision\FaceDetector.h" />
|
<ClInclude Include="src\computervision\FaceDetector.h" />
|
||||||
<ClInclude Include="src\computervision\FingerCount.h" />
|
<ClInclude Include="src\computervision\FingerCount.h" />
|
||||||
<ClInclude Include="src\computervision\BackgroundRemover.h" />
|
<ClInclude Include="src\computervision\BackgroundRemover.h" />
|
||||||
|
|||||||
@@ -116,6 +116,9 @@
|
|||||||
<ClInclude Include="src\computervision\async\async_arm_detection.h">
|
<ClInclude Include="src\computervision\async\async_arm_detection.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\computervision\async\StaticCameraInstance.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Xml Include="res\haarcascade_frontalface_alt.xml" />
|
<Xml Include="res\haarcascade_frontalface_alt.xml" />
|
||||||
|
|||||||
Reference in New Issue
Block a user