Look for usable camera instead of using default
This commit is contained in:
parent
05a4079418
commit
ed5b1c26e0
11
src/cv.cpp
11
src/cv.cpp
|
@ -25,9 +25,16 @@ void initCV() {
|
||||||
facemark = cv::face::FacemarkLBF::create();
|
facemark = cv::face::FacemarkLBF::create();
|
||||||
facemark->loadModel (resolvePath("cvdata/lbfmodel.yaml"));
|
facemark->loadModel (resolvePath("cvdata/lbfmodel.yaml"));
|
||||||
|
|
||||||
vid = cv::VideoCapture (0);
|
// cycle through all available cameras until we find one we can open
|
||||||
|
std::cout << "Looking for an open camera..." << std::endl;
|
||||||
|
for (int i = 0; i < 127; i++) {
|
||||||
|
vid = cv::VideoCapture (i);
|
||||||
|
if (vid.isOpened()) {
|
||||||
|
std::cout << "Camera " << i << " opened" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if(!vid.isOpened()) {std::cout << "Camera not opened!" << std::endl;}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dnnFaceDetect(cv::Mat inFrame, std::vector<cv::Rect>* faces) {
|
void dnnFaceDetect(cv::Mat inFrame, std::vector<cv::Rect>* faces) {
|
||||||
|
|
Loading…
Reference in a new issue